[PR #6587] [MERGED] MCP: serve the stateless 2026-07-28 revision from one implementation #6966

Closed
opened 2026-11-03 06:30:24 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6587
Author: @JustKarkat
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: fix/mcp-protocol-2026-07-28


📝 Commits (2)

  • 81cc6b6 Answer the stateless MCP revision from one implementation
  • 857b399 Launcher CI and releases follow crates/horizon-mcp

📊 Changes

17 files changed (+668 additions, -208 deletions)

View changed files

📝 .github/workflows/launcher.yml (+1 -0)
📝 Cargo.lock (+9 -0)
📝 Cargo.toml (+2 -0)
📝 crates/horizon-client-lib/Cargo.toml (+2 -0)
📝 crates/horizon-client/src/bin/horizon-ctl/mcp.rs (+60 -72)
➕ crates/horizon-mcp/Cargo.toml (+13 -0)
➕ crates/horizon-mcp/src/lib.rs (+476 -0)
📝 crates/horizon-server/Cargo.toml (+2 -0)
📝 crates/horizon-server/src/mcp.rs (+37 -74)
📝 docs/agent-control.md (+22 -0)
📝 docs/launcher-commands.md (+1 -0)
📝 launcher/Cargo.lock (+8 -0)
📝 launcher/Cargo.toml (+2 -0)
📝 launcher/src/game_tools.rs (+3 -1)
📝 launcher/src/mcp.rs (+28 -61)
📝 tests/test_ci_rust_changes.py (+1 -0)
📝 tools/release_train.py (+1 -0)

📄 Description

🤖 Opened by JustKarkat's AI agent (ZCode) on their behalf, not by JustKarkat personally.

Fixes #5673.

#5877 stopped the three servers from echoing whatever version a client asked for. This is the rest of the issue: they now implement the current revision, and the three no longer keep separate copies of the protocol.

What changed

New crates/horizon-mcp. horizon-ctl mcp, horizon-server mcp and horizon-launcher mcp each carried their own SUPPORTED list, negotiate_version and JSON-RPC line loop, plus their own handshake answer. All of that is now one crate; each server supplies its name, its version, its instructions and the two tool methods (tools/list, tools/call). The protocol methods and the framing are the crate's.

Two revisions, newest first.

  • 2026-07-28, stateless: every request declares its version and capabilities in _meta (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities); server/discover reports supportedVersions, capabilities, instructions and identity; every result carries resultType: "complete"; tools/list carries ttlMs (30 s: the launcher's list grows when a game starts, and no tools/list_changed follows it) and cacheScope: "public"; every modern result names the server in _meta["io.modelcontextprotocol/serverInfo"].
  • 2025-06-18, the handshake revision, kept unchanged. Its results carry none of the modern framing, so existing clients see exactly what they saw before.

Era from the request, not from history. A request with no _meta is answered in the handshake revision's shapes; initialize always opens the handshake revision. A version we do not serve is refused with UnsupportedProtocolVersion (-32022) with data.supported and data.requested, a modern request missing clientCapabilities is malformed (-32602), and ping is answered for the handshake revision only, since 2026-07-28 removed it. server/discover is answered even without _meta, so it works as the stdio probe a client that speaks both revisions sends first.

The launcher's child handshake stays legacy on purpose. game_tools.rs starts whichever horizon-ctl the player has installed, which may predate this change, so it opens with initialize and horizon_mcp::LEGACY rather than the new revision.

docs/agent-control.md gains a short section on the two revisions.

Testing

  • horizon-mcp: 13 unit tests over negotiation, discovery, unsupported versions, missing capabilities, both framings, ping, notifications, null ids, parse errors.
  • horizon-server: 111 tests, horizon-ctl: 18, horizon-launcher: 69. cargo clippy clean on all three, rustfmt applied.
  • Live stdio, driving each built binary (server/discover, modern and legacy tools/list, initialize, ping, a bad version, missing capabilities). All three advertise ["2026-07-28", "2025-06-18"]; the modern list gets resultType/ttlMs/cacheScope/serverInfo; the legacy list is byte-for-byte what it was (89 / 22 / 179 tools); the refusals come back with the spec's codes (-32022 / -32602 / -32601).

Note

This also regenerates docs/launcher-commands.md: #6462 added --server-output to native-build without regenerating it, so cli_tools::tests::the_launcher_reference_is_up_to_date fails on main today. The one added line is that generator's output, not an unrelated edit.

tools/pr_ready.py flags the scope (14 files, 850 lines of code, over its 500-line advisory): this one does not ship smaller without recreating the problem. The crate has to exist before any server can move onto it, and leaving one server on its own copy is exactly the drift the issue is about. The bulk is the crate itself (13 tests) and the deleted copies.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/6587 **Author:** [@JustKarkat](https://github.com/JustKarkat) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/mcp-protocol-2026-07-28` --- ### 📝 Commits (2) - [`81cc6b6`](https://github.com/horizon-rust/horizon/commit/81cc6b61d32cf167ec0483bbd02852eeb26bad01) Answer the stateless MCP revision from one implementation - [`857b399`](https://github.com/horizon-rust/horizon/commit/857b3991033c6435a61e256d1efcd79ce2e401ad) Launcher CI and releases follow crates/horizon-mcp ### 📊 Changes **17 files changed** (+668 additions, -208 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/launcher.yml` (+1 -0) 📝 `Cargo.lock` (+9 -0) 📝 `Cargo.toml` (+2 -0) 📝 `crates/horizon-client-lib/Cargo.toml` (+2 -0) 📝 `crates/horizon-client/src/bin/horizon-ctl/mcp.rs` (+60 -72) ➕ `crates/horizon-mcp/Cargo.toml` (+13 -0) ➕ `crates/horizon-mcp/src/lib.rs` (+476 -0) 📝 `crates/horizon-server/Cargo.toml` (+2 -0) 📝 `crates/horizon-server/src/mcp.rs` (+37 -74) 📝 `docs/agent-control.md` (+22 -0) 📝 `docs/launcher-commands.md` (+1 -0) 📝 `launcher/Cargo.lock` (+8 -0) 📝 `launcher/Cargo.toml` (+2 -0) 📝 `launcher/src/game_tools.rs` (+3 -1) 📝 `launcher/src/mcp.rs` (+28 -61) 📝 `tests/test_ci_rust_changes.py` (+1 -0) 📝 `tools/release_train.py` (+1 -0) </details> ### 📄 Description > 🤖 Opened by JustKarkat's AI agent (ZCode) on their behalf, not by JustKarkat personally. Fixes #5673. #5877 stopped the three servers from echoing whatever version a client asked for. This is the rest of the issue: they now implement the current revision, and the three no longer keep separate copies of the protocol. ## What changed **New `crates/horizon-mcp`.** `horizon-ctl mcp`, `horizon-server mcp` and `horizon-launcher mcp` each carried their own `SUPPORTED` list, `negotiate_version` and JSON-RPC line loop, plus their own handshake answer. All of that is now one crate; each server supplies its name, its version, its instructions and the two tool methods (`tools/list`, `tools/call`). The protocol methods and the framing are the crate's. **Two revisions, newest first.** - `2026-07-28`, stateless: every request declares its version and capabilities in `_meta` (`io.modelcontextprotocol/protocolVersion`, `io.modelcontextprotocol/clientCapabilities`); `server/discover` reports `supportedVersions`, `capabilities`, `instructions` and identity; every result carries `resultType: "complete"`; `tools/list` carries `ttlMs` (30 s: the launcher's list grows when a game starts, and no `tools/list_changed` follows it) and `cacheScope: "public"`; every modern result names the server in `_meta["io.modelcontextprotocol/serverInfo"]`. - `2025-06-18`, the handshake revision, kept unchanged. Its results carry none of the modern framing, so existing clients see exactly what they saw before. **Era from the request, not from history.** A request with no `_meta` is answered in the handshake revision's shapes; `initialize` always opens the handshake revision. A version we do not serve is refused with `UnsupportedProtocolVersion` (`-32022`) with `data.supported` and `data.requested`, a modern request missing `clientCapabilities` is malformed (`-32602`), and `ping` is answered for the handshake revision only, since `2026-07-28` removed it. `server/discover` is answered even without `_meta`, so it works as the stdio probe a client that speaks both revisions sends first. **The launcher's child handshake stays legacy on purpose.** `game_tools.rs` starts whichever `horizon-ctl` the player has installed, which may predate this change, so it opens with `initialize` and `horizon_mcp::LEGACY` rather than the new revision. `docs/agent-control.md` gains a short section on the two revisions. ## Testing - `horizon-mcp`: 13 unit tests over negotiation, discovery, unsupported versions, missing capabilities, both framings, `ping`, notifications, null ids, parse errors. - `horizon-server`: 111 tests, `horizon-ctl`: 18, `horizon-launcher`: 69. `cargo clippy` clean on all three, `rustfmt` applied. - Live stdio, driving each built binary (`server/discover`, modern and legacy `tools/list`, `initialize`, `ping`, a bad version, missing capabilities). All three advertise `["2026-07-28", "2025-06-18"]`; the modern list gets `resultType`/`ttlMs`/`cacheScope`/`serverInfo`; the legacy list is byte-for-byte what it was (89 / 22 / 179 tools); the refusals come back with the spec's codes (`-32022` / `-32602` / `-32601`). ## Note This also regenerates `docs/launcher-commands.md`: #6462 added `--server-output` to `native-build` without regenerating it, so `cli_tools::tests::the_launcher_reference_is_up_to_date` fails on `main` today. The one added line is that generator's output, not an unrelated edit. `tools/pr_ready.py` flags the scope (14 files, 850 lines of code, over its 500-line advisory): this one does not ship smaller without recreating the problem. The crate has to exist before any server can move onto it, and leaving one server on its own copy is exactly the drift the issue is about. The bulk is the crate itself (13 tests) and the deleted copies. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:30:24 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#6966
No description provided.