Connecting Letta to Local MCP Servers

Using stdio transport for local development

stdio is self-hosted only. Letta Cloud does not support stdio.

stdio transport launches MCP servers as local subprocesses, ideal for development and testing. Local (stdio) MCP servers can be useful for local development, testing, and situations where the MCP server you want to use is only available via stdio.

Setup

ADE: Tool Manager → Add MCP Server → stdio → specify command and args

1from letta_client import Letta
2from letta_client.types import StdioServerConfig
3
4# Self-hosted only
5client = Letta(base_url="http://localhost:8283")
6
7# Connect a stdio server (npx example - works in Docker!)
8stdio_config = StdioServerConfig(
9 server_name="github-server",
10 command="npx",
11 args=["-y", "@modelcontextprotocol/server-github"],
12 env={"GITHUB_PERSONAL_ACCESS_TOKEN": "your-token"}
13)
14client.tools.add_mcp_server(request=stdio_config)
15
16# List available tools
17tools = client.tools.list_mcp_tools_by_server(
18 mcp_server_name="github-server"
19)
20
21# Add a tool to use with agents
22tool = client.tools.add_mcp_tool(
23 mcp_server_name="github-server",
24 mcp_tool_name="create_repository"
25)

Docker Support

Letta’s Docker image includes npx, so npm-based MCP servers work out of the box. Custom Python scripts or missing dependencies require workarounds.

Troubleshooting

  • Server won’t start: Check command path, dependencies, environment variables
  • Connection fails: Review Letta logs, test command manually
  • Tools missing: Verify MCP protocol implementation and tool registration