Letta-MCP-server
Language:
JavaScript
Stars:
9
Forks:
3
Letta MCP Server
An MCP (Model Context Protocol) server implementation for interacting with the Letta API. This server provides tools for managing agents, memory blocks, and tools in the Letta system.
Features
- Create and manage Letta agents
- List and filter available agents
- Create, read, update, and manage memory blocks
- List memory blocks with filtering and pagination
- Attach memory blocks to agents with custom labels
- List and manage agent tools
- Send messages to agents and receive responses
Installation
# Clone the repository
git clone https://github.com/oculairmedia/Letta-MCP-server.git
cd letta-server
# Install dependencies
npm install
Configuration
- Create a
.env
file in the root directory with the following variables:
LETTA_BASE_URL=your_letta_api_url
LETTA_PASSWORD=your_letta_api_password
You can use the provided .env.example
as a template.
Available Scripts
npm run build
: Build the TypeScript codenpm run start
: Build and start the servernpm run dev
: Start the server in development mode with watch mode enabled
Tools
Agent Configuration
Agents can be configured with various options:
- Model selection (e.g., 'gpt-4', default: 'openai/gpt-4')
- Embedding model (default: 'openai/text-embedding-ada-002')
- Context window size (default: 16000)
- Temperature and token settings
- Custom function configurations
Memory Block Types
Memory blocks serve different purposes based on their labels:
persona
: Define agent personality and behaviorhuman
: Store conversation history and user preferencessystem
: Store system-level instructions and configurationscustom
: User-defined memory blocks for specific use cases
Agent Management
create_agent
: Create a new Letta agent with specified configurationlist_agents
: List all available agents in the Letta systemprompt_agent
: Send a message to an agent and get a response
Memory Block Management
- `create_memory_block`: Create a new memory block with name, label, and content
read_memory_block
: Get full details of a specific memory blockupdate_memory_block
: Update contents and metadata of a memory blocklist_memory_blocks
: List memory blocks with filtering options:- Filter by name, label, or content
- Filter by agent
- Filter templates only
- Pagination support
- Include full content or previews
attach_memory_block
: Attach a memory block to an agent with custom labels
Tool Management
list_tools
: List all available tools with filtering and paginationlist_agent_tools
: List tools available for a specific agentattach_tool
: Attach a tool to an agentupload_tool
: Upload a new Python tool with:- Custom name and description
- Source code implementation
- Category/tag support
- Optional automatic agent attachment
API Version
This server interacts with version 1 of the Letta API (endpoint: /v1
). The API version is automatically handled by the server based on the configured LETTA_BASE_URL
.
Example Usage
When integrated with Cline, you can use the MCP tools as follows:
Memory Block Operations
// Create a memory block
letta
create_memory_block
{
"name": "example_block",
"label": "custom",
"value": "This is an example memory block.",
"metadata": {
"version": "1.0",
"type": "documentation"
}
}
// List memory blocks with filtering
letta
list_memory_blocks
{
"label": "custom",
"page": 1,
"pageSize": 10,
"include_full_content": true
}
// Update a memory block
letta
update_memory_block
{
"block_id": "block-123",
"value": "Updated content",
"metadata": {
"version": "1.1"
}
}
// Attach block to agent with label
letta
attach_memory_block
{
"block_id": "block-123",
"agent_id": "agent-456",
"label": "persona"
}
Tool Management
// Upload a new tool
letta
upload_tool
{
"name": "weather_tool",
"description": "Get weather information for a location",
"source_code": "def get_weather(location):\n # Tool implementation\n return {'temp': 72, 'condition': 'sunny'}",
"category": "utilities",
"agent_id": "agent-456" // Optional: automatically attach to agent
}
// List tools with filtering
letta
list_tools
{
"filter": "weather",
"page": 1,
"pageSize": 10
}
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
Response Format
All MCP tools return responses in a consistent format:
{
"success": boolean,
"message": string, // Success/error message
"error"?: string, // Present only on error
"details"?: any, // Additional error details if available
// Tool-specific data...
}
Error Handling
The server handles various error scenarios:
- Invalid arguments or missing required parameters
- API authentication failures
- Resource not found errors
- Rate limiting and quota errors
- Network connectivity issues
Each error response includes detailed information to help troubleshoot issues.
Performance Considerations
- Memory blocks support pagination to handle large datasets efficiently
- Tool source code is validated before upload
- Streaming support for agent responses to handle long conversations
- Automatic cleanup of old/unused resources
- Request rate limiting to prevent API overload
License
This project is licensed under the MIT License - see the LICENSE file for details.
Publisher info
Emmanuel Umukoro
More MCP servers built with JavaScript
MCP Server Semgrep is a [Model Context Protocol](https://modelcontextprotocol.io) compliant server that integrates the powerful Semgrep static analysis tool with AI assistants like Anthropic Claude. It enables advanced code analysis, security vulnerability detection, and code quality improvements directly through a conversational interface.
This MCP server provides email sending functionality using Protonmail's SMTP service. It allows both Claude Desktop and Cline VSCode extension to send emails on your behalf using your Protonmail credentials.
Model Context Protocol server that integrates AgentQL's data extraction capabilities.