Skip to content
Letta Platform Letta Platform Letta Docs
Sign up
Core concepts
Tools

MCP tools

Connect agents to external MCP servers for remote tool execution

MCP tools execute on external MCP servers. Unlike server tools (where the tool code runs in Letta’s sandbox) or client tools (where the tool code runs in your app), MCP tools only require registering the server URL - the tool execution happens on the MCP server.

Tool typeWhere code runsYou provideUse case
Server toolsLetta sandboxTool codeCustom logic, API calls
Client toolsYour applicationTool schema + local handlerLocal resources, HITL
MCP toolsExternal MCP serverServer URL onlyYou have an existing MCP server you want to use
from letta_client import Letta
client = Letta()
# Register a remote MCP server
server = client.mcp_servers.create(
server_name="github",
config={
"mcp_server_type": "streamable_http",
"server_url": "https://mcp.example.com/github",
"auth_header": "Authorization",
"auth_token": "Bearer your-token",
}
)
# List available tools from the server
tools = client.mcp_servers.list_tools(server.id)
for tool in tools:
print(f"{tool.name}: {tool.description}")

Once registered, attach MCP tools to agents like any other tool:

# Create agent with MCP tools
agent = client.agents.create(
name="github-assistant",
tool_ids=[tool.id for tool in tools], # MCP tools from server
)
TransportLetta APIDockerNotes
Streamable HTTPRecommended. Supports auth headers.
SSELegacy, for compatibility only.
stdioLocal development only.
client.mcp_servers.create(
server_name="my-server",
config={
"mcp_server_type": "streamable_http",
"server_url": "https://mcp.example.com/endpoint",
"auth_header": "Authorization",
"auth_token": "Bearer token",
"custom_headers": {"X-API-Version": "v1"}
}
)
client.mcp_servers.create(
server_name="local-server",
config={
"mcp_server_type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path"]
}
)

Use templated variables in auth tokens for per-agent credentials:

client.mcp_servers.create(
server_name="user-api",
config={
"mcp_server_type": "streamable_http",
"server_url": "https://api.example.com/mcp",
"auth_token": "Bearer {{USER_API_KEY | default_key}}", # Falls back to default_key
}
)

Set variables per-agent using tool variables.

sequenceDiagram
    participant Agent as Letta Agent
    participant Server as Letta Server
    participant MCP as MCP Server

    Agent->>Server: Tool call (create_issue)
    Server->>MCP: Forward request
    MCP->>MCP: Execute tool
    MCP-->>Server: Return result
    Server-->>Agent: Continue with result

The agent doesn’t need credentials or API details - the MCP server handles authentication and execution.