[PR #1179] [MERGED] fix(server): report 2025-era client identity and features in binary_session #2703

Closed
opened 2026-10-17 21:09:15 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1179
Author: @kaoru0822-kitauji
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: fix/session-client-metadata-2025


📝 Commits (1)

  • b8312fa fix(server): report 2025-era client identity and features in binary_session

📊 Changes

4 files changed (+122 additions, -11 deletions)

View changed files

📝 src/server/mcpClientMetadata.ts (+27 -7)
📝 src/server/registerSessionStatusTool.ts (+4 -2)
📝 tests/boundary/mcp/clientCapabilities.test.ts (+88 -0)
📝 tests/boundary/mcp/serverIdentity.test.ts (+3 -2)

📄 Description

Summary

binary_session reported server_identity.client: null, negotiated_protocol_version: null, and all four client_features as false for every 2025-era MCP client, even though the client declared its name, version, and capabilities in initialize. mcpClientMetadata read these values only from the 2026-era per-request _meta envelope, and 2025-era requests never carry one.

Fixes #1167. Thanks to the reporter's follow-up, which confirmed the cause and the SDK's 2025-era accessor behavior.

Change

  • src/server/mcpClientMetadata.ts: an envelope, when present, is still the only source, so a 2026-era request keeps its own client info and capabilities. When a request has no envelope, the values come from the connection's initialize handshake through the SDK's getClientVersion(), getNegotiatedProtocolVersion(), and getClientCapabilities(). The SDK marks these accessors deprecated in favor of the envelope, but documents that they keep returning the initialize-scoped values on 2025-era connections. There is no other source for those connections; the code comment records this.
  • src/server/registerSessionStatusTool.ts passes server.server as that connection.

Tests

  • tests/boundary/mcp/clientCapabilities.test.ts (new initialize-scoped client metadata):
    • a client initializing with elicitation (form and URL), roots, and sampling is reported with its name, version, negotiated protocol, and all four features; empty capabilities still report none;
    • a per-request envelope overrides the initialize values (client, protocol 2026-07-28, and empty capabilities).
    • The first case fails on main.
  • tests/boundary/mcp/serverIdentity.test.ts: the live identity test previously expected client: null and elicitation_form: false from a client that declares form elicitation. It now expects that client's identity and feature.

Verification

  • npm run check:fast, npm run jscpd
  • npm run test:focused -- tests/boundary/mcp/{serverIdentity,clientCapabilities,sessionMcp,mcpDoctor,toolSchemaValidity}.test.ts tests/composition/analysis-sessions/binarySession.test.ts (57 passed)
  • Built server over stdio with a raw newline-delimited JSON-RPC client (initialize at 2025-11-25 with roots, sampling, and form elicitation, then tools/call binary_session): {"client":{"name":"raw-demo","version":"1.0"},"protocol":"2025-11-25","features":{"elicitation_form":true,"elicitation_url":false,"roots":true,"sampling":true}}. On main the same exchange returned null, null, and all false.

No Hopper/Ghidra verification was needed: the change is limited to MCP session metadata.

🤖 Generated with Claude Code


🔄 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/morluto/rea/pull/1179 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/session-client-metadata-2025` --- ### 📝 Commits (1) - [`b8312fa`](https://github.com/morluto/rea/commit/b8312fa8d184ba9f422d1f5592fb41e49811544a) fix(server): report 2025-era client identity and features in binary_session ### 📊 Changes **4 files changed** (+122 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `src/server/mcpClientMetadata.ts` (+27 -7) 📝 `src/server/registerSessionStatusTool.ts` (+4 -2) 📝 `tests/boundary/mcp/clientCapabilities.test.ts` (+88 -0) 📝 `tests/boundary/mcp/serverIdentity.test.ts` (+3 -2) </details> ### 📄 Description ## Summary `binary_session` reported `server_identity.client: null`, `negotiated_protocol_version: null`, and all four `client_features` as `false` for every 2025-era MCP client, even though the client declared its name, version, and capabilities in `initialize`. `mcpClientMetadata` read these values only from the 2026-era per-request `_meta` envelope, and 2025-era requests never carry one. Fixes #1167. Thanks to the reporter's follow-up, which confirmed the cause and the SDK's 2025-era accessor behavior. ## Change - `src/server/mcpClientMetadata.ts`: an envelope, when present, is still the only source, so a 2026-era request keeps its own client info and capabilities. When a request has no envelope, the values come from the connection's `initialize` handshake through the SDK's `getClientVersion()`, `getNegotiatedProtocolVersion()`, and `getClientCapabilities()`. The SDK marks these accessors deprecated in favor of the envelope, but documents that they keep returning the initialize-scoped values on 2025-era connections. There is no other source for those connections; the code comment records this. - `src/server/registerSessionStatusTool.ts` passes `server.server` as that connection. ## Tests - `tests/boundary/mcp/clientCapabilities.test.ts` (new `initialize-scoped client metadata`): - a client initializing with elicitation (form and URL), roots, and sampling is reported with its name, version, negotiated protocol, and all four features; empty capabilities still report none; - a per-request envelope overrides the initialize values (client, protocol `2026-07-28`, and empty capabilities). - The first case fails on `main`. - `tests/boundary/mcp/serverIdentity.test.ts`: the live identity test previously expected `client: null` and `elicitation_form: false` from a client that declares form elicitation. It now expects that client's identity and feature. ## Verification - `npm run check:fast`, `npm run jscpd` - `npm run test:focused -- tests/boundary/mcp/{serverIdentity,clientCapabilities,sessionMcp,mcpDoctor,toolSchemaValidity}.test.ts tests/composition/analysis-sessions/binarySession.test.ts` (57 passed) - Built server over stdio with a raw newline-delimited JSON-RPC client (`initialize` at `2025-11-25` with roots, sampling, and form elicitation, then `tools/call binary_session`): `{"client":{"name":"raw-demo","version":"1.0"},"protocol":"2025-11-25","features":{"elicitation_form":true,"elicitation_url":false,"roots":true,"sampling":true}}`. On `main` the same exchange returned `null`, `null`, and all `false`. No Hopper/Ghidra verification was needed: the change is limited to MCP session metadata. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:09:15 +00: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
morluto/rea#2703
No description provided.