Pi 1.0 Adds MCP Support Through Codemode

What Is Codemode

Pi 1.0 Adds MCP Support Through Codemode

Pi 1.0 now supports MCP servers via Codemode, a JavaScript sandbox running in the harness that lets the LLM orchestrate tool calls without bloating its context. Codemode enables concurrent operations, state persistence, and direct access to internal APIs like image generation and classifiers. It runs in a QuickJS WASM sandbox with no network, file system, or timers, keeping the execution environment separate and secure.

Codemode runs in the harness, in its own sandbox.
  1. ssivark

    Between this and the Cloudflare post, this is a lot of words and no simple system level picture. Here's what I think is going on:

    1. Homoiconicity: Harness mechanics are kludgy and we need proper homoiconicity to uniformly handle code (tool calls) and data ("natural language") as token streams.

    2. Actor semantics: for isolation, encapsulation and concurrency.

    3. Object capabilities: injected references and no ambient authority. Capabality-based reflection/introspection is a clean way to discover interfaces and affordances.

    "Code mode" or whatever is basically rediscovering this by hacking outward from LLM token streams, instead of from system design principles based on decades of computer science. It is the beginning of treating an LLM as a programming-language runtime participant (any takers for eval/apply?) rather than as a text/token generator with the harness as an ad-hoc interpreter.

    If existing implementations of code mode don't already support all this, I anticipate they will keep piling on hacks till they get to this point.

    ----

    I think it was Dan Ingalls who said "An operating system is a collection of things that don't fit into a language. There shouldn't be one.". I see the same for harnesses -- they're awkward middle children which fit neither in an LLM nor in the programming environment.

    Maybe the answer is to partner LLMs with Common Lisp or Scheme fibers / Spritely Goblins or Erlang BEAM and be done!

  2. dnlgrmm

    Sadly this seems like introducing a very complex apparatus for little gain. I don't need MCP or many tool calls that the agent can program around - in fact the promise of pi was that you basically just need bash and no other tools. The minimally-invasive approach would have been to just "inject" tool calls as virtual bash commands. No code mode required, no hands vs. brains dichotomy. LLM can use language of its own choosing to interact with tools.

  3. freakynit

    Can someone please tell me how to disable it permanently in pi? I have already disabled it in settings.json, but, it just doesn't get disabled:

    {

    "source": "npm:pi-mcp-adapter",

    "extensions": [

    "-index.ts",

    "-builtin:codemode"

    ]

    }

    and

    "autoEnableCodemode": false,

  4. ylxdzsw

    I'm not sure why almost all codemode implementations choose Javascript. I prototyped an agent[1] to use bash as the language for codemode, which in my opinion worked equally well and requires no teaching (there is literally 0 prompt to teach the LLM about codemode. A tool named "bash" is enough to have them know the usage).

    [1] https://github.com/ylxdzsw/mu

  5. mi_lk

    Why is this a personal blog, not a Pi post?

    https://earendil.com/posts/you-said-no-mcp/ remains difficult to read without understanding what codemode is, with some quote like "Now we talked so much about Codemode, it might be worth explaining what that even is."

More from this day

2026-10-07