Skip to content

Ask bar fails with "Prompt is too long" when the user has many MCP servers — spawn claude with --strict-mcp-config #66

Closed

Description

@Kadreev

What happens

On a machine with a large global MCP roster (claude.ai connectors + plugins), every Ask-bar question fails immediately with "Prompt is too long". The map itself is innocent — floorplanAskInstructions is ~1.2 KB — but serve.mjs spawns claude -p in the codebase root, and that session inherits the user's full MCP configuration. The tool schemas alone can exceed the model's context before the question is even added.

Measurements (Windows, Claude Code CLI 2.1.316, floorplan 0.6.2)

claude -p "Say just OK" --output-format json --model haiku
  → input + cache ≈ 832,000 tokens   (MCP tool schemas dominate)

claude -p "Say just OK" --output-format json --model haiku   --strict-mcp-config --mcp-config '{"mcpServers":{}}'
  → ≈ 32,000 tokens

With the default model the first form overflows the context window, so the Ask bar surfaces the API error verbatim.

Suggested fix

Ask answers only ever use Read/Grep/Glob and node floorplan/query.mjs, never MCP tools, so claudeRun() in assets/serve.mjs can safely opt out of MCP:

const args = [...cli.args, '-p', '--output-format', 'stream-json', '--verbose',
  '--strict-mcp-config', '--mcp-config', '{"mcpServers":{}}',
  ...

Patched locally this way: Ask works again end-to-end, answers stream normally, and each question is ~25× cheaper as a side effect. The Codex path may deserve an equivalent (its sandbox config), though I haven't measured it.

Happy to turn this into a PR if you'd like.

Activity

  1. Kadreev commented on Nov 2, 2026

    @Kadreev
    Author

    Correction on the numbers after digging deeper: the 832k reading was a genuine single-request measurement (cache_creation=832,020 — the CLI had inlined every MCP tool schema; toolSearchAbsent: true in its logs). However it doesn't always reproduce: later runs on the same machine/version defer MCP tools behind ToolSearch and start at ~110k, apparently a server-side rollout. So the failure is intermittent — whenever the CLI inlines schemas, a large MCP roster still overflows the Ask run's context. The suggested --strict-mcp-config opt-out remains the reliable fix (and drops even the deferred-mode baseline from ~110k to ~32k per question).

  2. added a commit that references this issue on Nov 15, 2026
  3. added a commit that references this issue on Nov 15, 2026
    c566483
  4. haydenschmitty commented on Nov 15, 2026

    @haydenschmitty
    Owner

    Fixed in 0.9.0: questions on the map now run with no MCP servers loaded (which also makes each one much cheaper), and with @psingh-valorx's #120 Claude Code is told not to read the map's own generated files. Codex has no switch that turns off only its MCP servers, so it still loads them. Thanks for reporting it.

    Update with claude plugin update floorplan@floorplan.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions