Skip to content

Add X-Realize-Client identity header to MCP requests#5

Open
yanush88 wants to merge 2 commits into
mainfrom
feature/DEV-221555-x-realize-client-header
Open

Add X-Realize-Client identity header to MCP requests#5
yanush88 wants to merge 2 commits into
mainfrom
feature/DEV-221555-x-realize-client-header

Conversation

@yanush88

Copy link
Copy Markdown
Contributor

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.

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>
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant