Replies: 1 comment
-
|
I’d like to propose a third option: executing code on the middleware itself - a design that mcpproxy implementation already realizes. Today, the widely adopted pattern is to use an MCP proxy or gateway: clients access tools via standardized middleware methods like search_tools and execute_tool. That works well. However,  the middleware could present a virtual filesystem abstraction. I'm not sure that this filesystem-like semantics gives any advantages. Meanwhile, the middleware maintains connections to upstream MCP servers (local and remote). If code execution is implemented at the middleware level, then clients can compose tools from different servers seamlessly. There’s no need to change the client or server: everything works through the unified MCP protocol and middleware orchestration. This, to me, represents the most flexible and scalable architecture for multi-tool/multi-server workflows. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Pre-submission Checklist
Your Idea
Context
Anthropic's recent blog post describes a powerful pattern for interacting with MCP tools through generated code instead of sequential tool calls, achieving up to 98.7% token reduction (150k → 2k tokens).
The blog describes presenting MCP tools as a virtual filesystem that agents can explore:
Agents progressively discover tools by exploring this structure, reading only the definitions they need, then generating code that imports and calls multiple tools efficiently.
However, the blog post doesn't specify where this should be implemented. I see two possible architectures, each with significant trade-offs. I'd like the community's input on which makes more sense.
Option 1: Client-Side Execution (What Blog Appears to Describe)
Architecture
How It Works
tools/liston all connected servers, caches metadata locally.tsfilesls servers/,cat servers/google-drive/getDocument.ts)from servers.google_drive import getDocumentcallMCPTool()which routes to actual MCP serversPros
✅ MCP servers unchanged - works with all existing servers
✅ Client controls security - single sandbox implementation
✅ Cross-server coordination - code can orchestrate multiple servers
✅ Privacy by default - data processing happens client-side
✅ Solves token problem - only loads needed tool definitions
Cons
❌ Every client reimplements - fragmentation across Claude Code, Desktop, third-party clients
❌ Complex client-side - execution environment, sandboxing, security
❌ No standardization - different virtual filesystem structures per client
❌ Heavy client - not suitable for lightweight integrations
Option 2: Server-Side Execution (Alternative)
Architecture
How It Works
execute_code(language: str, code: str)tools/callPros
✅ Works with current clients - just another MCP tool
✅ Server controls security - sandbox near the data
✅ No client fragmentation - standardized tool interface
✅ Lightweight clients - web apps, CLI tools work unchanged
✅ Better for privacy - data never leaves server
Cons
❌ Every server must implement - execution environment, sandboxing
❌ Security burden on server devs - harder to get right
❌ Can't coordinate across servers - each executes in isolation
❌ Doesn't solve token problem - still need all tool definitions upfront (unless combined with client-side caching)
Hybrid Approach?
Could we combine both?
execute_codefor data-heavy operationsQuestions for the Community
Which architecture makes more sense for the MCP ecosystem?
Should this be standardized?
How do we avoid fragmentation?
What about the token efficiency problem?
Security considerations?
Backwards compatibility?
My Current Thinking
I'm leaning toward Option 1 (client-side) because:
But I'm concerned about:
What does the community think? Has anyone started implementing this? Are there other approaches I'm missing?
Why I'm Asking
For my own MCP server, I need to know which of these architectures are on the roadmap so I can understand how I need to write my server to comply with it (if its server based). Just want to understand the direction of the ecosystem before investing development time.
My goals with this discussion:
Have I Missed Something?
I've searched the following repositories and found no public implementations or discussions:
If there are existing implementations, documentation, or active development efforts I've missed, please point me in the right direction! The last thing I want is to duplicate work or miss ongoing efforts.
References
Scope
Beta Was this translation helpful? Give feedback.
All reactions