Skip to content

feat(local-mcp): report the real plugin version - #10

Open
steve-calvert-glean wants to merge 1 commit into
steve/rename-local-mcpfrom
steve/local-mcp-plugin-version
Open

feat(local-mcp): report the real plugin version#10
steve-calvert-glean wants to merge 1 commit into
steve/rename-local-mcpfrom
steve/local-mcp-plugin-version

Conversation

@steve-calvert-glean

@steve-calvert-glean steve-calvert-glean commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Stacked on #9. Review only the top commit.

What

The local MCP server hardcoded version: "1.0.0" in its clientInfo and serverInfo. That placeholder never tracked the real plugin version (3.2.0), so every install ever shipped reports the same value.

Now it reads the version at runtime from the package.json already shipped beside the bundle — ../package.json resolves from both src/ and dist/, and that file must exist anyway for Node to load the bundle as ESM. The prebuild sync (sync-changelog.mjssync-release-metadata.mjs) keeps it in step with the root manifest that release-it bumps.

Not changing the User-Agent

An earlier revision also set User-Agent: glean-plugin/<version>, since that's what feeds the backend's client_user_agent. Dropped: that field identifies the calling client, which here is the host (Claude Code, Codex, Cursor) — the plugin is an intermediary. Stamping it would collapse every host into one bucket.

Consequence: the version isn't visible backend-side yet. scio reads client_user_agent from the header and doesn't log MCP clientInfo. A version field on GatewayRequestMetadata is the natural home, but that needs a coordinated api.proto change.

Full reasoning in the commit message.

@steve-calvert-glean
steve-calvert-glean force-pushed the steve/local-mcp-plugin-version branch from 26065e0 to 502ddb2 Compare August 1, 2026 00:03
@steve-calvert-glean steve-calvert-glean changed the title feat(local-mcp): report the real plugin version to the backend feat(local-mcp): report the real plugin version Aug 1, 2026
@steve-calvert-glean
steve-calvert-glean force-pushed the steve/local-mcp-plugin-version branch 3 times, most recently from f699e4d to b82b605 Compare August 1, 2026 16:11
The local MCP server hardcoded version "1.0.0" in both its outbound
clientInfo and its serverInfo. That placeholder never tracked the plugin
version (3.2.0), so every install that ever shipped reports the same value
and there is no way to tell versions apart.

Read the version at runtime from the package.json already shipped next to
the bundle. `../package.json` resolves in both contexts because the
manifest sits one level above the code either way:

  dev    sources/local-mcp/src/version.ts -> sources/local-mcp/package.json
  built  <plugin-root>/dist/index.js      -> <plugin-root>/package.json

That manifest is guaranteed present next to the bundle — it is shipped
specifically so Node loads dist/index.js as an ES module, so a missing
manifest breaks module loading long before this read.

Its version is kept in step with the repo-root package.json (the one
release-it bumps) by the prebuild sync, extending the existing changelog
propagation; sync-changelog.mjs is renamed to sync-release-metadata.mjs to
match its widened job. release-it's after:bump hook runs the build before
committing, so the bumped version lands in the release commit alongside the
changelogs, and publish.yml's bare `build:bundle` needs no extra step
because the committed manifest is already correct.

No build-time injection: an earlier revision used an esbuild `define` with
a declared-but-nonexistent global and a typeof guard, which left tests
reading a 0.0.0-dev sentinel instead of real behavior. build.mjs is
untouched here.

Deliberately not touching the User-Agent header. That field identifies the
calling client application, and in this path the client is the host
(Claude Code, Codex, Cursor) — the plugin is an intermediary. Stamping the
plugin there would collapse every host into one bucket in
client_user_agent and lose host attribution. If that header is ever
populated it should carry the host identity, which the local server
already receives via the host's own clientInfo on the stdio connection.

Note the version is therefore not yet visible backend-side: scio reads
client_user_agent from the raw User-Agent header and does not log MCP
clientInfo. Getting it to the backend wants a Glean-specific channel —
most naturally a version field on GatewayRequestMetadata, which already
carries the GLEAN_PLUGIN origin marker — needing a coordinated change in
scio's api.proto.
@steve-calvert-glean
steve-calvert-glean force-pushed the steve/local-mcp-plugin-version branch from b82b605 to 2e2b8bd Compare August 1, 2026 16:14
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