Repository navigation
Description
Problem
Since 0.39.0 devstack mcp passes the upstreams' MCP instructions on in its own initialize result: devstack's text first, then one ## \__` (MCP server ...) section per upstream, each capped at 4000 characters. The sum has no cap. Claude Code keeps at most 4096 characters of a server's instructions and cuts the rest (… [truncated]`). Every upstream whose section starts after character 4096 never reaches the agent, and one before it may be cut in the middle.
The upstreams that most need their instructions are often the small, in-house ones: a routine the agent must follow in every session, kept in the instructions so it stays in context even when the client drops the matching skill from its listing. Those come last here.
What I saw
devstack 0.39.0, Windows 11, Claude Code 2.1.312. A pool with three upstreams that send instructions: Linear's hosted MCP, GitHub's, and an own small server.
The initialize result of devstack mcp (sent by hand over stdio) has 7307 characters of instructions:
| Offset | Section |
|---|---|
| 0 | devstack's own text (about 1450 characters) |
| 1450 | ## \linear__` ...` (about 2980) |
| 4428 | ## \github__` ...` (about 1890) |
| 6313 | ## \__` ...` (about 990) |
In a Claude Code session the server's instructions end at character 4096, in the middle of the Linear section, with … [truncated]. The GitHub section and the own server's section are missing. A fresh claude -p session, asked to quote the own server's section, answers that it only has devstack's and Linear's instructions.
Expected
What the agent gets fits the client's budget and includes every upstream's instructions, or at least says which ones were left out. A short in-house routine should not be lost behind a long public server's text.
Ideas
- Keep the whole text under 4096 characters (the smallest limit known; a setting if other clients differ). Fill it in an order that does not depend on how long each text is: devstack's own text, then each upstream gets a fair share (budget / n), and a share one does not use goes to the others.
- Or put short sections first, or let the pool admin set an order or priority per upstream (
devstack pool upstreams). - Where a section is cut or dropped, say so in one line (
instructions of \github__` shortened, full text: ...), and offer the full texts some other way, e.g. an MCP resource or a toolinstructions(prefix)`. devstack doctor(or the dashboard) could warn when the passed-on instructions exceed the budget, naming the upstreams that do not fit.
Possibly related (not verified)
An upstream that was redeployed with new instructions still showed its old text in a new session through the same hub (the hub had been running since before the deploy). If the hub fixes the upstream instructions when it connects, a note in the docs or a refresh on reconnect would help. I have not restarted the hub to confirm.
Activity
fix(mcp): passed-on instructions fit the client's 4096 characters