RC RANDOM CHAOS

Pi brings MCP into core with Codemode

Pi brings MCP into core and uses Codemode, a JavaScript sandbox that runs with the harness, to compose tool calls.

· 3 min read
Pi brings MCP into core with Codemode

Pi now loads Codemode automatically whenever MCP is configured. That is a sharp reversal for a project whose website once declared that Pi did not support MCP and whose developers had publicly dismissed the protocol. MCP support now ships in Pi’s core rather than living only in an extension.

The developers give two reasons for the change. MCP has improved over the past year, and the work required to support it turned out to be useful elsewhere in Pi. Both Pi and MCP need an interpreter sandbox. The same changes also make it easier to use Jev within Pi.

An MCP extension already existed, so protocol support alone did not require a core change. The harder problem involved Pi’s tool model. Recent work added support for models that can defer tool loading, accept system messages during a conversation, and change reasoning levels. Pi’s tool loadout had not yet been revised to make full use of those capabilities.

Codemode forces an explicit distinction between tools available directly to the model and tools available only inside its orchestration environment. According to Pi’s developers, a normal MCP extension lacked enough metadata from the existing tool loadout to handle that distinction well. Bringing the functionality into core allowed tools to be marked as deferred or specific to Codemode.

MCP still has a composition problem

Pi’s developers remain critical of the way many MCP servers are designed. They describe MCP as hard to compose, even when Codemode provides a sandbox for coordinating calls. Many servers assume a harness will dump their tools into the model context. Some return text in an attempt to reduce token use.

Pi takes a different approach: MCP should behave more like OpenAPI with intelligent discovery. Tools should expose useful documentation and descriptions, be loaded when needed, and return structured data. That gives an agent something it can combine programmatically instead of forcing it to parse prose between calls.

Command-line tools already benefit from this style of composition because a model can connect them with shell operations. Pi exposes MCP tools to a JavaScript sandbox so the model can choose call order and combine results without placing every intermediate result into the conversation context. The post gives one example: combining a Linear MCP server with Jev to identify the 20 most frustrated commenters on an issue tracker.

Codemode runs with the harness

The placement of that JavaScript environment matters. Pi’s developers divide tool execution into two broad locations: the environment where shell commands run and the environment where the harness agent loop runs. They describe the harness loop as commonly trusted, while executed tools often run in a less trusted sandbox.

Codemode runs with the harness. Its purpose is to orchestrate tool calls, and its state is retained in the session transcript rather than the filesystem. Pi uses JavaScript because small JavaScript implementations can ship as WebAssembly binaries while providing what the developers call reasonable levels of protection.

For operators, “sandbox” is therefore an incomplete security description. The useful questions are where the sandbox runs, which tool interfaces it can reach, what data those tools return, and which state is retained in the transcript. Codemode’s location on the harness side should be part of a threat model for any deployment that connects MCP servers to sensitive services.

Tool metadata also becomes a security and operability control. Deferred discovery limits what must be loaded into context, while Codemode-specific configuration determines which capabilities are exposed inside the orchestration environment. Structured outputs reduce the need for brittle text parsing and make validation at tool boundaries more practical.

After upgrading Pi, inspect the effective tool configuration rather than checking only whether an MCP server was added. Configuring MCP automatically loads Codemode. Codemode can also be enabled as a default tool through Pi’s configuration, including for uses beyond MCP.

Share

Keep Reading

Latest on the Wire

Full wire →

New signal daily · RSS

Stay in the loop

New writing delivered when it's ready. No schedule, no spam.