Letta MCP Server
Letta MCP 服务器
一个高性能的 Model Context Protocol (MCP) 服务器,专为 Letta AI 构建,使用 Rust 和 TurboMCP 框架开发。
特性
7 个整合工具:使用判别器模式涵盖 103 种操作
高性能 -- Rust 编写,内存占用约 10-30MB,启动时间 <500ms,通过
tokio::join!和buffer_unordered实现并行扇出双重传输 -- 支持 stdio(Claude Desktop、Cursor 等)和 HTTP(生产环境部署)
响应大小优化 -- 响应大小减少 68-96%,提升 LLM 上下文效率
类型收窄模式 -- 具有特定
object/array类型及参数描述(无通用Value参数)多平台支持 -- macOS、Linux、Windows (x64 和 arm64)
兼容 Letta 0.16.x -- 支持存档、对话、MCP 服务器 v2
符合 MCP 2025-11-25 标准 -- 支持带 SSE 的流式 HTTP 传输
编译时路由 -- 通过 TurboMCP v3 宏实现零运行时开销的工具分发
Related MCP server: A2A Client MCP Server
快速入门
npm (推荐)
npm install -g letta-mcp-server系统会自动安装适合您平台的二进制文件。
平台 | 软件包 |
macOS Intel |
|
macOS Apple Silicon |
|
Linux x64 |
|
Linux arm64 |
|
Windows x64 |
|
Docker
docker pull ghcr.io/oculairmedia/letta-mcp-server-rust:rust-latest
docker run -d \
-p 6507:6507 \
-e LETTA_BASE_URL=http://your-letta-instance:8283 \
-e LETTA_PASSWORD=your-password \
-e TRANSPORT=http \
--name letta-mcp \
ghcr.io/oculairmedia/letta-mcp-server-rust:rust-latestDocker Compose
services:
letta-mcp:
image: ghcr.io/oculairmedia/letta-mcp-server-rust:rust-latest
container_name: letta-mcp
restart: unless-stopped
ports:
- '6507:6507'
environment:
LETTA_BASE_URL: ${LETTA_BASE_URL}
LETTA_PASSWORD: ${LETTA_PASSWORD}
TRANSPORT: http
PORT: 6507
RUST_LOG: info
env_file:
- .env
healthcheck:
test: ['CMD-SHELL', "timeout 1 bash -c '</dev/tcp/localhost/6507' || exit 1"]
interval: 30s
timeout: 10s
retries: 3环境变量
变量 | 必需 | 默认值 | 描述 |
| 是 | — | Letta API URL (例如 |
| 是 | — | Letta API 密码 |
| 否 |
| 传输模式: |
| 否 |
| HTTP 端口 (当 |
| 否 |
| 日志级别: |
| 否 |
| 启用回溯 ( |
| 否 |
| 块/段落/搜索值的最大字符数 |
| 否 |
| 核心内存预览的最大字符数 |
可用工具
该服务器提供 7 个整合工具,包含 103 种操作:
工具 | 操作数 | 描述 |
| 28 | 智能体生命周期、消息传递、对话、上下文、导出/导入 |
| 24 | 核心内存、块、存档段落、存档、搜索 |
| 13 | 工具 CRUD、挂载/卸载、批量操作 |
| 15 | 数据源、文件、段落、附件 |
| 4 | 任务跟踪、取消、主动监控 |
| 8 | 文件会话、文件夹管理 |
| 11 | MCP 服务器生命周期、工具发现、v2 API 支持 |
工具操作
letta_agent_advanced (28 种操作)
list, create, get, update, delete, search, list_tools, send_message,
export, import, clone, get_config, bulk_delete, context, reset_messages,
summarize, stream, async_message, cancel_message, preview_payload,
search_messages, get_message, count, list_conversations,
get_conversation, send_conversation_message, cancel_conversation,
compact_conversationletta_memory_unified (24 种操作)
get_core_memory, update_core_memory, get_block_by_label, list_blocks,
create_block, get_block, update_block, attach_block, detach_block,
list_agents_using_block, search_archival, list_passages, create_passage,
update_passage, delete_passage, search_memory, list_archives,
get_archive, create_archive, update_archive, delete_archive,
attach_archive, detach_archive, list_agents_using_archiveletta_tool_manager (13 种操作)
list, get, create, update, delete, upsert, attach, detach, bulk_attach,
generate_from_prompt, generate_schema, run_from_source, add_base_toolsletta_source_manager (15 种操作)
list, get, create, update, delete, count, attach, detach, list_attached,
upload, delete_files, list_files, list_folders, get_folder_contents,
list_agents_usingletta_job_monitor (4 种操作)
list, get, cancel, list_activeletta_file_folder_ops (8 种操作)
list_files, open_file, close_file, close_all_files, list_folders,
attach_folder, detach_folder, list_agents_in_folderletta_mcp_ops (11 种操作)
add, update, delete, test, connect, resync, list_servers, list_tools,
register_tool, execute, attach_mcp_server响应大小优化
Rust 实现包含针对 LLM 上下文效率的显著响应大小优化:
操作 | 优化 | 大小缩减 |
智能体列表 | 默认分页 (15 项),摘要模式 | 68-85% |
工具列表 | 默认分页 (25 项),截断描述 | 70-90% |
内存块 | 列表模式下排除繁重字段 | 60-80% |
源列表 | 摘要模式,分页 | 75-95% |
分页
所有列表操作均支持分页:
{
"operation": "list",
"pagination": {
"limit": 25,
"offset": 0
}
}摘要模式 vs 完整模式
列表操作默认返回摘要数据。使用带有特定 ID 的 get 操作获取完整详情:
// Summary (default for list)
{
"id": "agent-123",
"name": "My Agent",
"model": "gpt-4",
"tool_count": 5
}
// Full (with get operation)
{
"id": "agent-123",
"name": "My Agent",
"model": "gpt-4",
"system_prompt": "...",
"tools": [...],
"memory_blocks": [...]
}MCP 客户端配置
Claude Desktop
{
"mcpServers": {
"letta": {
"command": "letta-mcp",
"env": {
"LETTA_BASE_URL": "http://localhost:8283",
"LETTA_PASSWORD": "your-password"
}
}
}
}Cursor / Windsurf
{
"mcpServers": {
"letta": {
"command": "letta-mcp",
"env": {
"LETTA_BASE_URL": "http://localhost:8283",
"LETTA_PASSWORD": "your-password"
}
}
}
}OpenCode (HTTP)
{
"mcp": {
"letta-mcp": {
"type": "remote",
"url": "http://localhost:6507/mcp",
"enabled": true
}
}
}从源码构建
前置要求
Rust nightly (支持 2024 版本) - 通过 rustup 安装
Docker (可选,用于容器化构建)
本地构建
git clone https://github.com/oculairmedia/Letta-MCP-server.git
cd Letta-MCP-server
cargo build --release
LETTA_BASE_URL=http://your-letta:8283 \
LETTA_PASSWORD=your-password \
./target/release/letta-serverDocker 构建
docker build -f Dockerfile.rust -t letta-mcp .
docker run -d \
-p 6507:6507 \
-e LETTA_BASE_URL=http://your-letta:8283 \
-e LETTA_PASSWORD=your-password \
-e TRANSPORT=http \
letta-mcp架构
letta-server/
├── src/
│ ├── main.rs # Entry point, transport selection
│ ├── lib.rs # Server init, compile-time tool registration
│ └── tools/
│ ├── mod.rs # Tool module exports
│ ├── response_utils.rs # Unified ToolResponse, pagination helpers
│ ├── validation_utils.rs # require_field, require_id, sdk_err
│ ├── id_utils.rs # ID parsing utilities
│ ├── agent_advanced/ # Agent operations (28 ops)
│ │ ├── crud.rs # list, create, get, update, delete, search
│ │ ├── messaging.rs # send_message, stream, async, preview
│ │ ├── conversations.rs # list, get, send, cancel, compact
│ │ └── management.rs # export, import, clone, config, bulk_delete
│ ├── memory_unified/ # Memory operations (24 ops)
│ │ ├── core.rs # get/update core memory
│ │ ├── blocks.rs # block CRUD, attach/detach
│ │ ├── passages.rs # archival passage CRUD
│ │ ├── archives.rs # archive CRUD, attach/detach
│ │ └── search.rs # search_archival, search_memory
│ ├── tool_manager.rs # Tool operations (13 ops)
│ ├── source_manager.rs # Source operations (15 ops)
│ ├── job_monitor.rs # Job operations (4 ops)
│ ├── file_folder_ops.rs # File/folder operations (8 ops)
│ └── mcp_ops.rs # MCP server v2 operations (11 ops)
├── tests/ # Integration tests
└── Cargo.toml关键依赖
TurboMCP v3 -- 具有编译时路由和流式 HTTP 的 MCP 框架
letta-rs -- 供应商提供的 Rust Letta API 客户端 (0.16.x)
Tokio -- 异步运行时
Futures -- 流组合器 (
buffer_unordered用于并行扇出)Serde -- 序列化/反序列化
故障排除
连接被拒绝 (Connection Refused)
确保服务器正在运行:
docker ps | grep letta-mcp检查日志:
docker logs letta-mcp验证端口是否可访问:
curl http://localhost:6507/mcp
认证错误
验证
LETTA_BASE_URL是否指向您的 Letta 实例检查
LETTA_PASSWORD是否正确确保从容器中可以访问 Letta 服务器
工具未找到
通过 MCP 列出可用工具:
tools/list验证您是否使用了正确的操作名称 (例如
list而不是list_agents)
日志
# View server logs
docker logs -f letta-mcp
# Enable debug logging
RUST_LOG=debug letta-mcp贡献
Fork 本仓库
创建功能分支:
git checkout -b feature/my-feature进行更改并添加测试
运行测试:
cargo test提交 Pull Request
许可证
MIT 许可证 - 详情请参阅 LICENSE 文件。
相关项目
Letta - Letta AI 框架
TurboMCP - Rust 的 MCP 框架
Model Context Protocol - MCP 规范
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- MIT
- FlicenseAqualityDmaintenanceAn MCP server that enables LLMs to interact with Agent-to-Agent (A2A) protocol compatible agents, allowing for sending messages, tracking tasks, and receiving streaming responses.528
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables AI agents to interact with the SpaceTraders API, managing agents, fleets, contracts, and trading operations in the SpaceTraders universe.MIT
- AlicenseBqualityDmaintenanceConnects any MCP-compatible AI client to Letta.ai's stateful agents for agent conversations, memory management, and tool orchestration.1812MIT
Related MCP Connectors
MCP server exposing the Backtest360 engine API as tools for AI agents.
MCP server for AI dialogue using various LLM models via AceDataCloud
Cloud-hosted MCP server for durable AI memory
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/oculairmedia/Letta-MCP-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server