Skip to content

Native MCP: register servers with deferred exposure by default, as Claude Code's tool search does #406

Closed

Description

@stalgiag

What is the problem or missing behavior?

Since #304, toNativeServer() registers each server it hands to pi with exposure: "direct" (native.ts#L116), so all of its tools are declared to the model on every request. Claude Code's default is the opposite: "Tool search is enabled by default: MCP tools are deferred and discovered on demand", with "alwaysLoad": true per server and ENABLE_TOOL_SEARCH=false as the server and global settings that load tools upfront.

With two plugin servers here (chrome-devtools-mcp and claude-mem), that is 46 tools and about 39k characters of definitions in every request, roughly 10k tokens. On llama.cpp with qwen3.6-35b-a3b that is about two minutes of prompt processing before the first token of each new session. The only overrides I found are /mcp, which lasts one session for a registered server, or restating the whole server in ~/.pi/agent/mcp.json; for a plugin server that means copying its versioned cache path and plugin environment.

pi-code 1.5.2, pi 1.3.0.

Proposed solution

Map Claude's settings onto pi's exposures:

Claude Code pi
default (tool search on) exposure: "deferred", declared once tool_search loads a match
server "alwaysLoad": true exposure: "direct"
server "alwaysLoad": false exposure: "deferred"
ENABLE_TOOL_SEARCH=false exposure: "direct" for every server

Claude Code docs reference

https://code.claude.com/docs/en/mcp#configure-tool-search

Activity

  1. added
    enhancement
    on Oct 21, 2026
  2. added a commit that references this issue on Nov 3, 2026
    b2de62a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions