The end of MCP for ai agents?
By Arseny Shatokhin
Key Concepts
- Model Context Protocol (MCP): An open standard for connecting AI agents to external systems, essentially acting as APIs designed for AI agents.
- Token Consumption: The amount of data processed by an AI model, directly impacting cost and latency.
- Code Execution: An alternative approach to MCPs where AI agents generate and execute code to interact with external systems.
- Progressive Disclosure: The ability to dynamically load and access tools as needed, rather than all at once.
- Anonymization: The process of masking sensitive data to protect privacy.
- State Persistence: The ability of an agent to retain and reuse learned skills or functions.
- Sandbox Environment: A secure, isolated environment for executing code to prevent unintended consequences.
Problems with MCPs and the Proposed Solution
The video discusses a recent blog post from Entropic that challenges the efficacy of Model Context Protocols (MCPs) for building AI agents. The core argument is that MCPs, while a standardized way to connect AI agents to external systems (essentially APIs for agents), lead to significant inefficiencies.
1. Excessive Token Consumption:
- Tool Definition Overload: When an agent connects to an MCP, it receives definitions for all available tools within that MCP. If an agent connects to multiple MCPs (e.g., five or six), the context window becomes overloaded with descriptions and parameters for dozens, if not hundreds, of tools. Even if the agent only intends to use one tool, it still processes this extensive context, leading to increased costs, latency, and a higher chance of hallucinations.
- Intermediate Tool Results: Tools might return large amounts of data (e.g., a 50,000-token transcript from Google Drive). If the agent only needs a small portion of this data (like the first paragraph), it still has to process the entire output, further inflating token usage and potentially exceeding context window limits.
2. The Alternative: Code Execution
The proposed solution is to shift from MCPs to a code execution approach. This involves structuring tools as simple TypeScript files within a hierarchical folder system (e.g., MCP_Server_Name/tool_name.ts).
- How it Works: When an agent needs to use a tool, it imports and calls that specific tool directly in its code.
- Benefits:
- Reduced Token Consumption: Only the definition of the single tool being used is passed into the agent's context. The agent also doesn't need to read entire documents; it can save them as variables or in the file system and fetch only the necessary details. In one example, an agent could send a transcript to a Salesforce MCP server without even reading its content.
- Progressive Disclosure: Agents are no longer limited by the context window of MCPs. They can be connected to thousands of MCP servers and use search tools to discover and access the specific MCP or tool they need at that moment.
- Privacy Benefits: For enterprise clients concerned about exposing sensitive data to third-party model providers, this approach allows for a "harness" to be added to the agent. This harness can anonymize data before it's fetched or processed by the agent. For instance, a
get_sheettool could be modified to return anonymized emails. - State Persistence and Skills: This is highlighted as a "game-changing" benefit. If an agent lacks a specific skill, it can generate a function for itself, save it in a folder, and reuse it later. This allows agents to evolve and learn, aligning with concepts like "skills" introduced by platforms like Claude.
Limitations of Code Execution
- Reliability: Generating code on the fly for every tool call increases the chance of errors and mistakes.
- Infrastructure Overhead: Setting up a secure sandbox environment for the agent to safely execute code and interact with APIs requires significant effort.
Conclusion and Future Outlook
The video concludes that since AI agents are becoming increasingly proficient at generating code, it makes more sense to leverage this capability directly rather than building abstractions on top of abstractions (like MCPs). Adding abstractions can reduce an agent's autonomy, which is counterproductive to their primary purpose of autonomously executing tasks.
While MCPs may still be suitable for simpler use cases (e.g., customer support where minimal data transformation is needed), the code execution approach is presented as significantly more powerful for complex scenarios. The speaker intends to primarily use this new approach for their agents moving forward.
The speaker also mentions that their platform has already implemented this code execution approach, allowing agents to connect to any API without relying on MCPs.
Chat with this Video
AI-PoweredHi! I can answer questions about this video "The end of MCP for ai agents?". What would you like to know?