MoonshotAI / MoonshotAI/kimi-code
ACP: stdio MCP servers rejected in session/new, session/load, session/resume since v0.37.0 (regression from #2961)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
Summary
Since v0.37.0, any ACP session/new, session/load, or session/resume request that carries a stdio-type MCP server declaration fails with:
-32603 Internal error: ACP stdio MCP server <name> does not declare a runtime identity
This breaks every ACP client that forwards stdio MCP servers — including Zed, whose context servers are stdio by default and are sent with session/new. ACP treats stdio as the implied baseline transport (the kimi-code agent itself only advertises mcpCapabilities: { http: true, sse: true } because stdio needs no capability flag), so clients send stdio declarations unconditionally.
Reproduction
With any ACP client (e.g. Zed) connected to kimi-code >= 0.37.0:
mcpServers payload |
Result |
|---|---|
| empty / absent | OK |
[{ name, command, args, env }] (standard ACP stdio, no type field) |
-32603 ... does not declare a runtime identity |
[{ type: "stdio", name, command, args, env }] |
same error |
http / sse entries |
OK |
v0.36.1 accepts both stdio spellings. First bad release is v0.37.0; still broken on current main (d4e0ad4b2).
Root cause
Regression introduced by 84da6629b / PR #2961 ("refactor(agent-core-v2): decouple workspace from session DI via runtime binding"), which made two changes:
packages/acp-server/src/convert.ts:179— the stdio branch ofacpMcpServersToConfigRecord(which in 0.36.1 mapped stdio entries to{ transport: 'stdio', command, args, env }) was replaced withthrow new Error('ACP stdio MCP server ... does not declare a runtime identity').packages/agent-core-v2/src/workspace/workspaceMcp/workspaceMcpService.ts:128— the session-overlayMcpConnectionManagergainedrequireStdioRuntimeId: true, so ephemeral per-session stdio servers without an explicitruntime_idare refused (connection-manager.ts:393: "MCP stdio requires runtime_id and runtime binding").
The ACP wire protocol cannot express a runtime_id, so the two changes together categorically reject ACP stdio MCP servers.
Note on the explicit "type": "stdio" case: @agentclientprotocol/sdk@1.3.0's zMcpServerStdio schema has no type field, so zod strips it during request parsing and both spellings land in the same !('type' in server) branch. But even without the stripping, convert.ts no longer has any stdio handling — the missing branch is the bug, not the SDK.
The same commit also updated tests (test/convert.test.ts, test/lifecycle.test.ts) to assert the rejection, i.e. the behavior change was deliberate but protocol-breaking.
Suggested fix (minimal)
convert.ts: restore the 0.36.1 stdio mapping branch.workspaceMcpService.ts: droprequireStdioRuntimeId: truefrom the session-overlay manager (it already defaultsruntimeId: 'local', matching the baseline manager, which does not set the flag — user-config-file stdio MCP still works today). Fixing only (1) would just move the failure to engine connect time.- Restore the three affected tests to assert stdio servers are accepted/mapped.
Impact
- All ACP clients + stdio MCP servers (Zed included): session creation/loading fails outright.
- Affected versions: v0.37.0, v0.37.1, v0.37.2, v0.38.0, and
main. - Baseline (user config-file) stdio MCP servers are unaffected; only ACP ephemeral session-level servers are blocked.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with packages/acp-server/src/convert.ts and packages/agent-core-v2/src/workspace/workspaceMcp/workspaceMcpService.ts, then inspect the related connection-manager behavior. Run test/convert.test.ts and test/lifecycle.test.ts; done means ACP stdio declarations are accepted and session-level stdio servers no longer fail due to a required runtime identity.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100