Add X-Realize-Client identity header to MCP requests#5
Open
yanush88 wants to merge 2 commits into
Open
Conversation
Wire an outgoing X-Realize-Client header on every Realize MCP request via
the .mcp.json `headers` block, mirrored in the SessionStart CLI fallback
(scripts/ensure-realize-mcp.sh) so plugin-provided and CLI-installed
sessions stay consistent. Version is sourced from plugin.json in the
script; .mcp.json uses ${REALIZE_PLUGIN_VERSION:-0.3.0} as an override
hatch with a correct default.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
yanush88
requested review from
chrishall-taboola,
vladimanaev and
yuri-g-taboola
July 16, 2026 11:54
The static ${REALIZE_PLUGIN_VERSION} in .mcp.json never populates: a
SessionStart hook can't inject env vars into the parent Claude Code
process that reads .mcp.json, so it always emitted the default.
Switch to a `headersHelper` (scripts/mcp-headers.sh) that Claude Code
runs at each connection and merges into request headers. For a
plugin-provided server it runs with CLAUDE_PLUGIN_ROOT set and cwd at
the plugin root, so the helper reads the version live from
.claude-plugin/plugin.json — true single source of truth, no env var,
always current. Requires Claude Code v2.1.195+.
The CLI-install fallback (ensure-realize-mcp.sh) keeps a static
--header since `claude mcp add` has no headers-helper flag; its version
is still resolved from plugin.json at add time. Comment updated to
explain the split.
Verified on the wire: helper output lands as
`x-realize-client: realize-mcp-plugin/0.3.0` on Claude's MCP request.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wire an outgoing X-Realize-Client header on every Realize MCP request via the .mcp.json
headersblock, mirrored in the SessionStart CLI fallback (scripts/ensure-realize-mcp.sh) so plugin-provided and CLI-installed sessions stay consistent. Version is sourced from plugin.json in the script; .mcp.json uses ${REALIZE_PLUGIN_VERSION:-0.3.0} as an override hatch with a correct default.