Skip to content

feat(mcp): record input aliases used from a server-owned alias map - #5117

Merged
gesh merged 1 commit into
mainfrom
posthog/mcp-input-aliases
Sep 28, 2026
Merged

gesh merged 1 commit into
mainfrom
posthog/mcp-input-aliases

Conversation

@pauldambra

Copy link
Copy Markdown
Member

Problem

MCP servers that accept alternative argument names (for example experimentId for id) want to know which spelling agents use. Without SDK support, each server adds its own $mcp_* property and format. Review on #5048 asked for this to be SDK work.

Changes

  • getToolInputProperties(args, schema, { inputAliases }) takes a server-owned map of canonical name to aliases, in the order the server tries them.
  • Alias names count as declared, so they stay visible in $mcp_input_keys.
  • New $mcp_input_aliases_used, for example ["experimentId:id"]: one entry for each canonical name the call did not send, using the first alias present. It is omitted when no alias was needed, and it is capped at 20. Argument values are never read.
  • New public type InputAliasMap. Documented in ARCHITECTURE.md.

Stacked on #5048. The PostHog MCP server will use this in place of its own $mcp_param_aliases_used (PostHog/posthog#101133).

Closes #5116

Release info Sub-libraries affected

Libraries affected

  • @posthog/mcp: minor release for the new option and property.

Checklist

  • Tests for new code
  • Accounted for the impact of any changes across different platforms
  • Accounted for backwards compatibility of any changes (no breaking changes!)
  • Took care not to unnecessarily increase the bundle size

Created with PostHog Desktop

🤖 Generated with Claude Code

@pauldambra pauldambra self-assigned this Sep 25, 2026
@pauldambra
pauldambra added this pull request to stack #5049 September 25, 2026 19:45
pauldambra added a commit to PostHog/posthog that referenced this pull request Sep 25, 2026
Pass the schema's normalizeParamAliases map to getToolInputProperties as inputAliases, so the SDK records $mcp_input_aliases_used (alias:canonical) in place of the server's own $mcp_param_aliases_used (alias->canonical). describeAliasesUsed is removed; its rule tests now run through describeInputShape. Taxonomy, generated JSON, and the analytics vocabulary are updated.

Depends on PostHog/posthog-js#5117 (stacked on #5048): CI fails until both are released and the @PostHog/mcp-analytics pin is bumped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: 8a3c5163-fb8f-423e-8008-17af786b8cae
@pauldambra
pauldambra marked this pull request as ready for review September 25, 2026 19:51
@pauldambra
pauldambra requested review from a team as code owners September 25, 2026 19:51
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-25T19:54:21.337663Z 5eab9ee Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copy link
Copy Markdown
Member Author

Note

🤖 Automated comment by QA Swarm — not written by a human

Multi-perspective review: router (cheap-first pass) + delegated lenses (qa-team, paul-reviewer, xp-reviewer, security-audit, engineering-systems-thinking as warranted)

Verdict: ✅ APPROVE (round 1 @ 5eab9ee)

No actionable findings. inputAliases reads only key names (the getter test proves values are never read), uses hasOwnProperty for presence, keeps alias names under the existing 64-character and 20-entry caps, and changes nothing when the option is omitted.

Key findings

None.

Convergence

None (single reviewer).

Reviewer summaries

Reviewer Assessment
🧭 router No findings. Danger MEDIUM (public API addition to @posthog/mcp, but optional and additive), confidence HIGH. Nothing delegated. The tool-input tests pass (26).

Automated by QA Swarm — not a human review

@pauldambra pauldambra added the stamphog label Sep 25, 2026 — with PostHog
stamphog[bot]

This comment was marked as outdated.

@pauldambra
pauldambra requested a review from gesh September 25, 2026 20:04

Copy link
Copy Markdown
Member Author

@gesh this is the alias telemetry you asked for on #5048, built now instead of later. The server passes its own alias map as inputAliases. Alias names count as declared in $mcp_input_keys, and $mcp_input_aliases_used records alias:canonical only when the canonical name was not sent. It never reads values. It is stacked on #5048. This adds public API (inputAliases, InputAliasMap), so please confirm the shape here or on #5116. PostHog/posthog#101133 already uses it.

Base automatically changed from posthog/mcp-safe-input-properties to main September 28, 2026 10:47
@stamphog
stamphog Bot dismissed their stale review September 28, 2026 10:47

The PR was retargeted to a different base branch, so the approved diff is no longer what was reviewed. Stamphog re-reviews automatically.

getToolInputProperties takes inputAliases (canonical name to aliases). Alias names count as declared in $mcp_input_keys, and $mcp_input_aliases_used records alias:canonical for each canonical the call did not send, using the first alias present. Argument values are never read.

Closes #5116

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: 8a3c5163-fb8f-423e-8008-17af786b8cae
@gesh
gesh force-pushed the posthog/mcp-input-aliases branch from 5eab9ee to 02543de Compare September 28, 2026 10:47

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

This adds a new public option/type to the MCP SDK, but it's optional, additive, well-tested (including a test proving argument values are never read), and the author has STRONG familiarity with this exact code (100% of touched lines, 52 merged PRs in these paths), which substitutes for a fresh independent review on risky public-API surface. No unresolved concerns in the reviews or discussion.

  • Author wrote 100% of the modified lines and has 52 merged PRs in these paths (familiarity STRONG).
  • 👍 on the PR from chatgpt-codex-connector[bot].
Gate mechanics and policy version
Gate Result
prerequisites ✓ all clear
deny-list ✓ no deny categories matched
size ✓ 45L, 4F substantive, 114L/7F incl. docs/generated/snapshots — within ceiling
tier ✓ T1-agent / T1c-medium (114L, 7F, two-areas, feat)
stamphog 2.2.0 .stamphog/policy.yml @ 02543de · reviewed head 02543de

@gesh
gesh merged commit 51699b4 into main Sep 28, 2026
64 checks passed
@gesh
gesh deleted the posthog/mcp-input-aliases branch September 28, 2026 11:04
gesh added a commit to PostHog/posthog that referenced this pull request Sep 28, 2026
Pass the schema's normalizeParamAliases map to getToolInputProperties as inputAliases, so the SDK records $mcp_input_aliases_used (alias:canonical) in place of the server's own $mcp_param_aliases_used (alias->canonical). describeAliasesUsed is removed; its rule tests now run through describeInputShape. Taxonomy, generated JSON, and the analytics vocabulary are updated.

Depends on PostHog/posthog-js#5117 (stacked on #5048): CI fails until both are released and the @PostHog/mcp-analytics pin is bumped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: 8a3c5163-fb8f-423e-8008-17af786b8cae
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.

feat(mcp): record input aliases used from a server-owned alias map

2 participants