Urgent.News

What's breaking now, across thousands of outlets.

AI

One MCP server used 18,000 tokens before doing anything. Here’s the workaround.

Pi spent much of the past year leaving MCP out of its coding agent, even as the protocol became standard The post One MCP server used 18,000 tokens before doing anything. Here’s the workaround. appeared first on The New Stack .

One MCP server used 18,000 tokens before doing anything. Here’s the workaround.

Mario Zechner, the creator of the CodeM apply (MCP) protocol, initially resisted its use in Pi, his coding agent, due to the high context cost it imposed. Measuring the context cost of popular browser-automation servers, Zechner found that Chrome DevTools MCP alone required about 18,000 tokens, or around 9% of a 200,000-token context window, before the agent could perform any useful task.

To address this issue, Pi now uses Codemode, a pattern that places code mode between the model and its tools. MCP tools are discovered and called from JavaScript, with only useful output returned. This approach allows developers to control which tools are exposed to the model, with the default behavior keeping MCP servers' tools out of the model's context. Codemode handles tool discovery, allowing scripts to run operations concurrently and process results before returning any data to the model.

The reduction in context cost and improved tool management has led Earendil, which acquired Pi, to incorporate MCP into its core system. While this move doesn't fully address Zechner's concerns about composability, Codemode provides a practical solution to Pi's use of the MCP protocol without adopting the approach Zechner initially objected to.

Written by urgent.news from The New Stack's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at thenewstack.io →

More in AI

AI Is Making It Too Easy to Avoid Thinking

I use AI every day. I build things with it, experiment with it, write code with it, learn about new things with it, and generally think it's one of the most interesting technologies I've ever had…

I Build GDPR Compliance Tools Using Claude Code

How AI Accelerated the Development of GDPR Compliance Software: Building GDPR compliance software has traditionally required extensive legal research, complex engineering, and countless hours spent…

More from Monday 5 October →