The Letta MCP Server is an implementation of the Model Context Protocol for the Letta API, providing tools to manage agents, memory blocks, and tools within the Letta system. It offers a structured way to create, manage, and interact with AI agents and their associated data.
To get started with the Letta MCP Server:
# Clone the repository
git clone https://github.com/oculairmedia/Letta-MCP-server.git
cd letta-server
# Install dependencies
npm install
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.
The server can be started using one of the following commands:
# Build and start the server
npm run build
npm run start
# Or run in development mode with auto-reload
npm run dev
Agents can be configured with various options:
Memory blocks serve different purposes based on their labels:
Tools extend the capabilities of agents.
When integrated with Cline, you can use the MCP tools as follows:
<!-- Create a memory block -->
<use_mcp_tool>
<server_name>letta</server_name>
<tool_name>create_memory_block</tool_name>
<arguments>
{
"name": "example_block",
"label": "custom",
"value": "This is an example memory block.",
"metadata": {
"version": "1.0",
"type": "documentation"
}
}
</arguments>
</use_mcp_tool>
<!-- List memory blocks with filtering -->
<use_mcp_tool>
<server_name>letta</server_name>
<tool_name>list_memory_blocks</tool_name>
<arguments>
{
"label": "custom",
"page": 1,
"pageSize": 10,
"include_full_content": true
}
</arguments>
</use_mcp_tool>
<!-- Update a memory block -->
<use_mcp_tool>
<server_name>letta</server_name>
<tool_name>update_memory_block</tool_name>
<arguments>
{
"block_id": "block-123",
"value": "Updated content",
"metadata": {
"version": "1.1"
}
}
</arguments>
</use_mcp_tool>
<!-- Attach block to agent with label -->
<use_mcp_tool>
<server_name>letta</server_name>
<tool_name>attach_memory_block</tool_name>
<arguments>
{
"block_id": "block-123",
"agent_id": "agent-456",
"label": "persona"
}
</arguments>
</use_mcp_tool>
<!-- Upload a new tool -->
<use_mcp_tool>
<server_name>letta</server_name>
<tool_name>upload_tool</tool_name>
<arguments>
{
"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
}
</arguments>
</use_mcp_tool>
<!-- List tools with filtering -->
<use_mcp_tool>
<server_name>letta</server_name>
<tool_name>list_tools</tool_name>
<arguments>
{
"filter": "weather",
"page": 1,
"pageSize": 10
}
</arguments>
</use_mcp_tool>
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...
}
The server handles various error scenarios:
Each error response includes detailed information to help troubleshoot issues.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.