From 5286fc795c526c05f10d5aa4d8ed9e9fb2fa0816 Mon Sep 17 00:00:00 2001 From: Algis Dumbris Date: Tue, 24 Nov 2026 15:25:31 +0200 Subject: [PATCH 1/2] docs: keep mcpproxy tools loaded when the client defers MCP tools Co-Authored-By: Claude Sonnet 5.5 --- docs/features/clients-that-defer-tools.md | 117 ++++++++++++++++++++++ docs/features/connect-clients.md | 4 + docs/features/routing-modes.md | 2 + website/sidebars.js | 1 + 4 files changed, 124 insertions(+) create mode 100644 docs/features/clients-that-defer-tools.md diff --git a/docs/features/clients-that-defer-tools.md b/docs/features/clients-that-defer-tools.md new file mode 100644 index 000000000..775211329 --- /dev/null +++ b/docs/features/clients-that-defer-tools.md @@ -0,0 +1,117 @@ +--- +id: clients-that-defer-tools +title: Clients that defer MCP tools +sidebar_label: Clients that defer tools +description: Keep MCPProxy's built-in tools such as retrieve_tools loaded in clients that hide MCP tools behind their own tool search or code mode. +keywords: [tool search, deferred tools, alwaysLoad, deferTools, codemode, exposure, retrieve_tools, claude code, copilot cli, pi, opencode, codex, kiro] +--- + +# Clients that defer MCP tools + +Some MCP clients no longer put every MCP tool definition in the model's context. They list tool names only, or hide MCP behind a code sandbox, and the model finds a tool through the client's own search first. MCPProxy already does its own discovery, so a deferring client adds a second search layer in front of it. + +**What goes wrong.** The model must first find `retrieve_tools` through the client's search. That costs a round trip, can fail ("tool not found" for a name the model never searched for), and the two searches run one after the other. + +**The fix.** Mark the MCPProxy server as "always loaded" in the client. The few built-in tools (`retrieve_tools`, `describe_tool`, `call_tool_read`, `call_tool_write`, `call_tool_destructive`, …) then sit in context from the first turn. Your upstream servers' tools stay out of context, because MCPProxy still serves them on demand. See [Routing modes](/features/routing-modes) for what each mode exposes. + +Clients that load every tool up front (for example Cursor, Windsurf or Gemini CLI) need none of this. + +:::note Verified against vendor documentation +Each snippet below was checked against the client's own documentation on 24 November 2026. Clients change these settings often, so confirm against the linked page for your version. A row marked **not verified** means the vendor documentation showed no per-server setting. +::: + +## Claude Code + +Claude Code defers MCP tools by default ([MCP docs](https://code.claude.com/docs/en/mcp)). Set `alwaysLoad` on the MCPProxy server entry. It works for every server type and overrides `ENABLE_TOOL_SEARCH`: + +```bash +claude mcp add-json --scope user mcpproxy '{"type":"http","url":"http://127.0.0.1:8080/mcp","headers":{"X-API-Key":"YOUR_KEY"},"alwaysLoad":true}' +``` + +Or in `.mcp.json`: + +```json +{ + "mcpServers": { + "mcpproxy": { + "type": "http", + "url": "http://127.0.0.1:8080/mcp", + "headers": { "X-API-Key": "YOUR_KEY" }, + "alwaysLoad": true + } + } +} +``` + +Setting `alwaysLoad: true` makes startup wait for the server's tools (up to the 5-second connect timeout). Setting `ENABLE_TOOL_SEARCH=false` also works, but turns deferral off for every server. + +## GitHub Copilot CLI + +Tool search is on by default for supported models ([docs](https://docs.github.com/en/copilot/concepts/agents/copilot-cli/tool-search)). Set `deferTools` to `"never"` on the server, either through `/mcp edit` (Defer Tools → Never) or in `~/.copilot/mcp-config.json`: + +```json +{ + "mcpServers": { + "mcpproxy": { + "type": "http", + "url": "http://127.0.0.1:8080/mcp", + "headers": { "X-API-Key": "YOUR_KEY" }, + "deferTools": "never", + "tools": ["*"] + } + } +} +``` + +`toolSearch: false` in your personal settings turns tool search off for all servers. + +## pi + +Since pi 0.99 an MCP server's tools default to `codemode`: they are not declared to the model. Give the MCPProxy server `direct` exposure so its tools are declared like built-ins ([MCP docs](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/mcp.md)). You can also change it from `/mcp` in a session. + +```json +{ + "mcpServers": { + "mcpproxy": { + "url": "http://127.0.0.1:8080/mcp", + "headers": { "X-API-Key": "YOUR_KEY" }, + "exposure": "direct" + } + } +} +``` + +The file location and the transport keys are described in pi's MCP document; only `exposure` is the setting that matters here. + +## opencode (Code Mode) + +In opencode versions with Code Mode, a server's tools are reached through a single `execute` tool by default. Set `codemode` to `false` on the server to keep them on the model's native tool list ([docs](https://opencode.ai/docs/mcp-servers/)): + +```jsonc +{ + "mcp": { + "servers": { + "mcpproxy": { + "type": "remote", + "url": "http://127.0.0.1:8080/mcp", + "codemode": false + } + } + } +} +``` + +Add the API key header using the remote-server options in opencode's documentation. The snippet above only shows the Code Mode switch. + +## Codex CLI and Kiro + +| Client | Status | +| --- | --- | +| Codex CLI | **Not verified.** Codex's MCP documentation ([developers.openai.com/codex/mcp](https://developers.openai.com/codex/mcp)) lists `enabled_tools` and `disabled_tools` per server, but no setting to force a server's tools to be declared directly. Do not assume `enabled_tools` does this. If `retrieve_tools` is not found, name it in the prompt or add the [agent instructions](/features/agent-instructions). | +| Kiro | **Partly verified.** Kiro IDE 1.3+ and Kiro CLI 2.31+ (V3) load MCP tools on demand by default. The [Tool Search page](https://kiro.dev/docs/mcp/tool-search/) documents `toolSearch.enabled`, `toolSearch.minPct` and `toolSearch.minTokens` but no per-server exemption. Whether `toolSearch.enabled false` turns it off for V3 was not verified. | + +## Check that it worked + +Start a fresh session and ask the model to call `retrieve_tools` with a short query, without searching first. If it calls the tool straight away, the pin works. `mcpproxy activity list --type tool_call --from=-15m` shows the call. + +If the client still hides the tools, see [Connect Clients](/features/connect-clients) to confirm which entry the client reads, and [Find out why an agent cannot use a tool](/guides/diagnose-unavailable-tool). diff --git a/docs/features/connect-clients.md b/docs/features/connect-clients.md index b10cb1135..0e45946f4 100644 --- a/docs/features/connect-clients.md +++ b/docs/features/connect-clients.md @@ -15,6 +15,10 @@ talks to the proxy instead of to each upstream server directly. It is available from the Web UI wizard, the macOS tray ("Connect Client…"), and the `mcpproxy connect` CLI. +:::tip Client hides `retrieve_tools`? +Claude Code, Copilot CLI, pi, opencode and others defer MCP tools behind their own search. Pin the MCPProxy server as always loaded: [Clients that defer MCP tools](/features/clients-that-defer-tools). +::: + :::tip Agents not using your servers? If Claude Code or Codex reaches for `gh` or `curl` instead of the proxied tools, add the snippet from [Agent Instructions](/features/agent-instructions) to its `CLAUDE.md` / `AGENTS.md`. diff --git a/docs/features/routing-modes.md b/docs/features/routing-modes.md index 64a7355f0..e4db95dfa 100644 --- a/docs/features/routing-modes.md +++ b/docs/features/routing-modes.md @@ -23,6 +23,8 @@ To serve **one** upstream server at its own URL, under its own tool names and wi > The configured mode is served on the default `/mcp` endpoint. Each mode also has a dedicated endpoint (`/mcp/call`, `/mcp/all`, `/mcp/code`) — see [Dedicated Endpoints](#dedicated-endpoints) below. +> Clients that defer MCP tools behind their own search can hide `retrieve_tools`; see [Clients that defer MCP tools](/features/clients-that-defer-tools) for the per-client pin. + ## Configuration Set the routing mode in your config file (`~/.mcpproxy/mcp_config.json`): diff --git a/website/sidebars.js b/website/sidebars.js index b3fc3d256..b7e667272 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -108,6 +108,7 @@ const sidebars = { 'features/profiles', 'features/mcp-credential-lifecycle', 'features/connect-clients', + 'features/clients-that-defer-tools', 'features/skills', 'features/agent-instructions', 'features/config-import', From 7dc874d1236af97eae9d5cadb3b7539f3d4f1c85 Mon Sep 17 00:00:00 2001 From: Algis Dumbris Date: Tue, 24 Nov 2026 15:28:30 +0200 Subject: [PATCH 2/2] docs: address review of clients-that-defer-tools Co-Authored-By: Claude Sonnet 5.5 --- docs/features/clients-that-defer-tools.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/features/clients-that-defer-tools.md b/docs/features/clients-that-defer-tools.md index 775211329..db2466d1b 100644 --- a/docs/features/clients-that-defer-tools.md +++ b/docs/features/clients-that-defer-tools.md @@ -12,7 +12,7 @@ Some MCP clients no longer put every MCP tool definition in the model's context. **What goes wrong.** The model must first find `retrieve_tools` through the client's search. That costs a round trip, can fail ("tool not found" for a name the model never searched for), and the two searches run one after the other. -**The fix.** Mark the MCPProxy server as "always loaded" in the client. The few built-in tools (`retrieve_tools`, `describe_tool`, `call_tool_read`, `call_tool_write`, `call_tool_destructive`, …) then sit in context from the first turn. Your upstream servers' tools stay out of context, because MCPProxy still serves them on demand. See [Routing modes](/features/routing-modes) for what each mode exposes. +**The fix.** Mark the MCPProxy server as "always loaded" in the client. The few built-in tools (`retrieve_tools`, `describe_tool`, `call_tool_read`, `call_tool_write`, `call_tool_destructive`, …) then sit in context from the first turn. In the default `retrieve_tools` routing mode your upstream servers' tools stay out of context, because MCPProxy serves them on demand. In `direct` mode the pinned endpoint would load every upstream tool, so pin only a `retrieve_tools` or `code_execution` endpoint (for example `/mcp/call`). See [Routing modes](/features/routing-modes). Clients that load every tool up front (for example Cursor, Windsurf or Gemini CLI) need none of this. @@ -101,7 +101,7 @@ In opencode versions with Code Mode, a server's tools are reached through a sing } ``` -Add the API key header using the remote-server options in opencode's documentation. The snippet above only shows the Code Mode switch. +The `mcp.servers` layout is the one in the Code Mode documentation. Older opencode releases (and the entry MCPProxy's Connect writes) use `mcp.` directly; the `codemode` key sits in the same server entry either way. Add the API key header using the remote-server options in opencode's documentation. ## Codex CLI and Kiro @@ -112,6 +112,6 @@ Add the API key header using the remote-server options in opencode's documentati ## Check that it worked -Start a fresh session and ask the model to call `retrieve_tools` with a short query, without searching first. If it calls the tool straight away, the pin works. `mcpproxy activity list --type tool_call --from=-15m` shows the call. +Start a fresh session and ask the model to call `retrieve_tools` with a short query, without searching first. If the client's own tool trace shows it calling `retrieve_tools` directly, with no search step first, the pin works. `mcpproxy activity list --type internal_tool_call --tool retrieve_tools --from=-15m` confirms MCPProxy received the call, but not how the client found the tool. If the client still hides the tools, see [Connect Clients](/features/connect-clients) to confirm which entry the client reads, and [Find out why an agent cannot use a tool](/guides/diagnose-unavailable-tool).