feat: add stdio MCP server support for client-side tool execution#707
Open
pmukeshreddy wants to merge 5 commits intoletta-ai:mainfrom
Open
feat: add stdio MCP server support for client-side tool execution#707pmukeshreddy wants to merge 5 commits intoletta-ai:mainfrom
pmukeshreddy wants to merge 5 commits intoletta-ai:mainfrom
Conversation
Implements letta-ai#495 - enables connecting stdio MCP servers to Letta Cloud through client-side tool execution. Key changes: - Add MCP module (src/mcp/) for managing stdio server connections - Register MCP tools with Letta Cloud using approval flow - Execute MCP tools locally via stdio when approved - Track tool-to-server mappings for proper routing - Support tool name mapping (Python-safe to original names) The implementation leverages the existing approval architecture: 1. User adds stdio MCP server via `/mcp add --transport stdio` 2. CLI spawns subprocess and fetches tool definitions 3. Tools are registered with Letta Cloud (require_approval=true) 4. When agent calls tool, CLI intercepts approval request 5. CLI executes tool locally and returns result to server
Author
Testing Instructions# Clone & setup
git clone https://github.com/pmukeshreddy/letta-code.git
cd letta-code
git checkout feat/stdio-mcp-support
bun install
# Run with your API key
export LETTA_API_KEY=your-key-here
bun run devTest stdio MCP/mcp add --transport stdio test npx @modelcontextprotocol/server-everything
# Try these:
echo "Hello from MCP!"
What are my environment variables?
Calculate sum of 15 and 27Should see tools execute locally via stdio subprocess. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #150 - adds support for connecting stdio MCP servers through client-side tool execution.
Since agents run on Letta Cloud, they can connect to
httpandsseMCP servers directly. This PR enablesstdioserver support by executing tools client-side via the CLI.How it works
/mcp add --transport stdio <name> <command> [args...]require_approval=true)Changes
src/mcp/module for managing stdio server connectionssrc/cli/commands/mcp.tswith stdio server registrationsrc/agent/approval-execution.tsfor client-side MCP tool executionsrc/headless.tsfor MCP initialization and cleanupTest plan
Demo
All 9 tools from
@modelcontextprotocol/server-everythingtested successfully:Closes #150