On November 4, 2025, Anthropic published an engineering blog post proposing to prioritize the "code execution" path within the MCP (Model Context Protocol) ecosystem: generating callable code APIs for tools on each MCP server, allowing proxies to write code first and then call the tools, rather than cramming all tool definitions and intermediate results into the context. The post describes generating TypeScript file trees per server/tool, with proxies reading the required interfaces on demand, filtering and merging data in the execution environment, and only sending back necessary summaries to the model. Official examples show that the context consumption of approximately 150,000 tokens can be compressed to approximately 2,000, significantly reducing cost and latency. The post also cites Cloudflare's "Code Mode" observation, pointing to the same approach.
The article emphasizes the additional benefits of this method: handling loops, conditions, and errors through the execution environment; anonymizing personal data in a local/sandbox environment to prevent sensitive information from entering the model context; and combining it with file system persistence of intermediate artifacts, while also integrating with Claude Skills' reusable "skills" mechanism. However, code execution requires a reliable sandbox, quotas, and monitoring, introducing new operational and security requirements, thus necessitating a trade-off between efficiency and risk control.
Frequently Asked Questions
Q: What is the core message of this release?
A: Use code execution to connect to MCP: Map the tool to code API, load definitions on demand, process data in the execution environment, and then send the result summary back to the model, reducing context usage and error rate.
Q: How does its efficiency compare to the "model direct connection tool"?
A: The official example shows a comparison of reducing the number of tokens from approximately 150,000 to approximately 2,000, representing a saving of approximately 98.7%; the specific benefits depend on the scale of the tool and the amount of data.
Q: What is the relationship between this and Cloudflare's "Code Mode"?
A: Both viewpoints agree: allowing models to write code to call abstract APIs is more efficient. Anthropic directly cites this practice in its article.
Q: What improvements have been made to privacy and compliance?
A: Intermediate data remains in the execution environment by default. Sensitive fields such as emails and phone numbers can be tokenized and restored on the client side when transferring data across tools, reducing the leakage surface.
Q: How does it work in conjunction with Claude Skills?
A: The agent can save verified scripts as reusable skills (including SKILL.md and resources), which can be directly referenced in subsequent tasks, improving robustness and maintainability.