Skip to content

Expose MCP JSON-RPC protocol metadata via $mcp.getClientInfo#1792

Merged
nmaguiar merged 2 commits intot8from
codex/add-extra-data-to-getclientinfo
Mar 28, 2026
Merged

Expose MCP JSON-RPC protocol metadata via $mcp.getClientInfo#1792
nmaguiar merged 2 commits intot8from
codex/add-extra-data-to-getclientinfo

Conversation

@nmaguiar
Copy link
Copy Markdown
Collaborator

@nmaguiar nmaguiar commented Mar 28, 2026

Motivation

  • Improve MCP client introspection by returning protocol-level data received via the underlying JSON-RPC transport so callers can inspect the last request/response and transport headers such as mcp-session-id.
  • Make it possible to correlate MCP initialize payload/result with captured transport state for debugging and telemetry.

Description

  • Added JSON-RPC-level tracking object _mcpInfo (session, lastRequest, lastResponse, lastResponseHeaders) inside $jsonrpc and populate it on each call. (js/openaf.js)
  • Exposed a new $jsonrpc.getClientInfo() via getClientInfo that returns the collected _mcpInfo, and added $mcp.getClientInfo() to merge the MCP initialize result into the returned client info. (js/openaf.js)
  • Capture mcp-session-id from HTTP response headers and store it in the tracked session info, and record response headers for remote/SSE/notification flows. (js/openaf.js)
  • Updated the MCP test server to return a mcp-session-id on initialize and added a test testGetClientInfoIncludesJSONRPCMCPData that asserts getClientInfo() contains lastRequest, lastResponse envelope, captured session.mcpSessionId, and the initialize result. (tests/autoTestAll.MCP.js)

Testing

  • Added/updated tests in tests/autoTestAll.MCP.js, including testGetClientInfoIncludesJSONRPCMCPData which validates JSON-RPC/MCP metadata fields and mcp-session-id capture; the test file was modified as part of this change.
  • Attempted to run the test orchestrator with cd tests && ../openaf --ojob autoTestAll.MCP.yaml, which failed because the openaf CLI is not available in this environment.
  • Attempted to run with the built JAR via cd tests && java -jar ../openaf.jar --ojob autoTestAll.MCP.yaml, which failed because openaf.jar is not present in this environment.

@nmaguiar nmaguiar marked this pull request as ready for review March 28, 2026 03:16
@nmaguiar nmaguiar merged commit e38abe1 into t8 Mar 28, 2026
1 check passed
@nmaguiar nmaguiar deleted the codex/add-extra-data-to-getclientinfo branch March 28, 2026 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant