Skip to content
Sign up
Tools
Tool execution

MCP Remote Execution

Learn how tools from Model Context Protocol servers execute remotely and integrate with Letta agents.

MCP (Model Context Protocol) tools execute on external MCP servers, not in Letta’s sandbox or your application. This allows agents to access external services and APIs through a standardized protocol.

When an agent calls an MCP tool, the execution flow is:

  1. Agent Decision - Agent decides to call an MCP tool with specific arguments
  2. Request Forwarding - Letta server forwards the tool call to the MCP server
  3. Remote Execution - MCP server executes the tool in its environment
  4. Result Return - MCP server returns the result to Letta
  5. Agent Continuation - Agent receives the result and continues processing
flowchart LR
    Agent[Letta Agent] -->|Tool Call| Letta[Letta Server]
    Letta -->|Forward Request| MCP[MCP Server]
    MCP -->|Execute Tool| Tool[External Service]
    Tool -->|Result| MCP
    MCP -->|Return Result| Letta
    Letta -->|Continue| Agent
  • Controlled by: MCP server (external)
  • Permissions: Defined by MCP server implementation
  • Dependencies: Managed by MCP server
  • Security: MCP server’s responsibility
  • State: MCP server can maintain persistent state

Unlike custom tools that run in Letta’s sandbox or client-side tools that run in your application, MCP tools are completely managed by the external MCP server.

MCP execution is ideal for:

Connect to services that provide MCP servers:

  • GitHub API (repositories, issues, pull requests)
  • Slack API (channels, messages, workspace data)
  • Database services (PostgreSQL, MySQL)
  • Cloud storage (S3, Google Drive)
  • Third-party APIs with MCP implementations
  • Share tools across multiple agents and projects
  • Update tools without redeploying agents
  • Maintain state in the MCP server between calls
  • Control access to sensitive services centrally
  • Complex business logic that shouldn’t run in agent sandbox
  • Operations requiring persistent connections (databases, message queues)
  • Tools that need access to server-side resources
  • Integration with existing backend services

For detailed setup instructions, see the MCP documentation:

Here’s how an MCP tool works in practice with a GitHub MCP server:

  1. Connect MCP Server - Configure Letta to connect to a GitHub MCP server
  2. Automatic Tool Discovery - Letta discovers available tools (e.g., create_issue, list_repos)
  3. Attach to Agent - Add the MCP tools to your agent
  4. Agent Uses Tool - Agent calls create_issue with repository and issue details
  5. MCP Server Executes - GitHub MCP server creates the issue via GitHub API
  6. Result Returns - Agent receives confirmation of issue creation

The agent doesn’t need to know about GitHub API authentication, rate limiting, or API details - the MCP server handles everything.

FeatureMCP RemoteSandbox
Execution locationExternal MCP serverLetta sandbox (E2B/local)
Tool definitionMCP server providesYou define in code
State managementMCP server can maintainStateless per execution
External API accessMCP server handlesLimited from sandbox
Setup complexityMCP server setup requiredDirect tool creation

Use MCP when integrating existing services with MCP implementations. Use Sandbox when writing custom logic specific to your agent.

FeatureMCP RemoteClient-Side
Execution locationExternal MCP serverYour application
ControlMCP server managedYou manage completely
Local resourcesNoYes
API credentialsMCP server storesYour app manages
Approval flowOptionalRequired (HITL)

Use MCP when you want centralized tool management and external service integration. Use Client-Side when you need access to local resources or full control over execution.

FeatureMCP RemoteBuilt-in
Execution locationExternal MCP serverLetta server (privileged)
ModifiableVia MCP serverNo
Service scopeExternal servicesSystem operations
ExamplesGitHub, Slackweb_search, run_code

Use MCP for external service integrations. Use Built-in for system operations like web search and code execution.

When using MCP remote execution:

  • MCP server handles authentication - Credentials stored on MCP server, not in Letta
  • Network security - Ensure secure connection between Letta and MCP server
  • Trust the MCP server - The server has full control over tool execution
  • Rate limiting - MCP server may implement rate limits
  • Access control - MCP server manages permissions for external services