Skip to content

fix(mcp): passed-on instructions fit the client's 4096 characters - #469

Merged
7schmiede merged 1 commit into
mainfrom
fix/mcp-instructions-budget
Nov 6, 2026
Merged

7schmiede merged 1 commit into
mainfrom
fix/mcp-instructions-budget

Conversation

@7schmiede

Copy link
Copy Markdown
Member

What and why

devstack mcp passed on its MCP upstreams' instructions in initialize with no limit on the whole. Claude Code keeps 4096 characters of a server's instructions, so an upstream whose section started past that never reached the agent; a short in-house routine listed after two long public servers was lost (#456).

  • The whole instructions text (devstack's own, the preface, every upstream's section and the notes) now stays within 4096 characters, counted in UTF-16 units as a JavaScript client counts.
  • The upstreams share what devstack's own text leaves: evenly, and what a short one does not need goes to the longer ones. The shares do not depend on the order of the upstreams.
  • A shortened section is cut at a line (or within one, with …) and ends with one quoted line: [shortened by devstack: the tool \instructions` with prefix `

    ` returns the full text]`.

  • Where too many upstreams would each get less than a useful share (300 characters), the last ones are left out and named, as before.
  • New read-only MCP tool instructions (prefix, with or without __): an upstream's full text, as the hub has it (GET /hub/upstreams/instructions); an unknown prefix names those that gave instructions.
  • README, the devstack skill and docs/dashboard-api.md name the tool; CHANGELOG entry under Fixed.

Not addressed here: the issue's side note about an upstream redeployed with new instructions while the hub kept the old text (unverified).

Review card

# Category Point Beats Reversing costs
4 contract devstack mcp keeps its whole instructions under 4096 characters; each upstream gets a fair share (budget/n, an unused share goes to the others), and a shortened section says so in one line. Order by length; a priority per upstream set by the pool admin low
5 term A new MCP tool instructions with prefix returns an upstream's full text; the shortening line points to it. An MCP resource (clients rarely read resources); no way to the full text medium: agents and skills get used to the tool name

Approved by the owner on 2026-11-06: points 4 and 5 (together with points 1–3 for #467, built in a separate PR).

Decided on my own: the 300-character minimum share, counting in UTF-16 units, cutting at a line boundary where possible.

Tests

Closes #456

🤖 Generated with Claude Code

Claude Code keeps 4096 characters of a server's instructions. devstack mcp
now keeps devstack's own text and every upstream's section within that:
the upstreams share what is left evenly, and what a short one does not
need goes to the longer ones. A shortened section says so; the new tool
`instructions` with the upstream's prefix returns the full text.

Closes #456

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@7schmiede
7schmiede force-pushed the fix/mcp-instructions-budget branch from 5db8791 to 9268878 Compare November 6, 2026 12:47
@7schmiede
7schmiede merged commit 0df5038 into main Nov 6, 2026
@7schmiede
7schmiede deleted the fix/mcp-instructions-budget branch November 6, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

devstack mcp: passed-on upstream instructions exceed Claude Code's 4096 characters, later upstreams are cut off

1 participant