Skip to content

Track client-declared MCP Events extension capability - #285

Merged
rgarcia merged 2 commits into
mainfrom
hypeship/track-client-events-capability
Nov 30, 2026
Merged

rgarcia merged 2 commits into
mainfrom
hypeship/track-client-events-capability

Conversation

@rgarcia

@rgarcia rgarcia commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

SEP-3415 (io.modelcontextprotocol/events) is now Final and the Events extension is in beta. This adds it to the explicit client-extension allow-list so $mcp_initialize events record a bounded $mcp_client_supports_events boolean, mirroring the existing Tasks/Apps/OAuth-client-credentials/enterprise-auth wiring.

  • New MCP_EVENTS_EXTENSION constant in client-capabilities.ts
  • New $mcp_client_supports_events property: false unless the client declares the extension as an object
  • The analytics type, the false defaults, and the extension entries in SENT_PROPERTIES now derive from CLIENT_EXTENSION_PROPERTIES, so a future extension is a one-entry change and a missing allow-list entry can no longer drop a property silently. The legacy core capabilities.tasks declaration still counts as Tasks support
  • Both declaration paths are covered with no extra code: initialize capabilities.extensions, and per-request _meta client capabilities, which eventProperties already routes through clientCapabilityAnalytics

Only the boolean is captured; extension settings and unknown extension identifiers still never reach analytics.

Testing

  • bun test src/lib/mcp/analytics.test.ts — 58 pass (existing shape tests extended for declared, malformed, and absent Events declarations)
  • SDK integration test now declares Events in request _meta and asserts the property survives the SENT_PROPERTIES filter (verified it fails if Events is dropped from the allow-list)
  • Full bun test: 1355 pass
  • bunx tsc --noEmit clean
  • prettier --check clean on changed files

SEP-3415 (io.modelcontextprotocol/events) is Final and in beta. Add it to
the extension allow-list so $mcp_initialize events record
$mcp_client_supports_events, matching the existing tasks/apps/oauth
extension wiring. Both declaration paths are covered: initialize
capabilities.extensions and per-request _meta client capabilities, which
eventProperties already routes through clientCapabilityAnalytics.
@vercel

vercel Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
mcp Ready Ready Preview Nov 30, 2026 12:05am UTC

@rgarcia

rgarcia commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

Picked masnwilliams to review: recent commits in mcp; 6 pending

@masnwilliams masnwilliams left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. This follows the existing extension pattern exactly, and the real change is the new map entry.

Two optional suggestions. Neither blocks this PR, and both apply equally to the existing extensions:

  1. Derive the per-extension wiring from CLIENT_EXTENSION_PROPERTIES. Adding an extension currently takes four hand-synced edits: the map, the McpClientCapabilityAnalytics type, SENT_PROPERTIES, and the false default. tsc catches a missing type field or default. A missing map entry or SENT_PROPERTIES entry fails silently. Deriving the type (Record<ClientExtensionProperty, boolean>), spreading Object.values(CLIENT_EXTENSION_PROPERTIES) into SENT_PROPERTIES, and building the booleans with Object.fromEntries would make the next extension a one-line change. Tasks keeps its extra || isRecord(capabilities.tasks). I prototyped it locally: tsc is clean, all tests pass, and it's net −10 lines.

  2. Assert that the property is actually sent. Removing MCP_CLIENT_SUPPORTS_EVENTS_PROPERTY from SENT_PROPERTIES still passes the suite, because the new assertions only check what clientCapabilityAnalytics returns. Adding the events property to the _meta end-to-end test's toMatchObject (next to the apps property) would cover the path through beforeSend.

The analytics type, the false defaults, and SENT_PROPERTIES now come from
CLIENT_EXTENSION_PROPERTIES, so adding an extension is a one-entry change and
a missing allow-list entry can no longer drop a property silently. The legacy
core tasks capability still counts as Tasks support.

The SDK integration test now declares the Events extension in request _meta
and asserts the property survives the SENT_PROPERTIES filter.
@rgarcia
rgarcia merged commit 37746f5 into main Nov 30, 2026
10 checks passed
@rgarcia
rgarcia deleted the hypeship/track-client-events-capability branch November 30, 2026 00:08

This branch was successfully deployed

1 active deployment
Preview — 6f3c8aec Deployed Nov 30, 2026 by vercel[bot]
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.

2 participants