Skip to content

Tag native OAuth connections and failures in MCP analytics - #274

Open
rgarcia wants to merge 1 commit into
mainfrom
hypeship/mcp-auth-method-analytics
Open

rgarcia wants to merge 1 commit into
mainfrom
hypeship/mcp-auth-method-analytics

Conversation

@rgarcia

@rgarcia rgarcia commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Summary

MCP analytics could not tell Kernel-issued (native) OAuth apart from Clerk OAuth, and native authentication failures left no analytics record at all: they return 401/403/503 straight from the native path, before the scope resolution that emits mcp_connection_scope_failure. That makes a native rollout hard to watch, since a native-only failure or drop in connections is invisible.

  • $mcp_initialize events now report $mcp_auth_method: "native_oauth" for native connections. Clerk OAuth stays "oauth" and API keys stay "api_key", so existing queries keep their meaning.
  • A native credential the server refuses (rejected token, revoked grant, refused scope, issuer outage) now emits mcp_connection_scope_failure with connection_credential_type: "native_oauth", the outcome (rejected or unavailable), and the response status for rejections.

The credential type is passed from the route, which already knows which path authenticated the request; /auth/context reports jwt/oauth for both OAuth kinds.

Tests

  • Route: a native initialize produces $mcp_auth_method: "native_oauth"; a revoked native grant captures a rejected/401 failure; an issuer outage captures an unavailable failure.
  • connectionAnalyticsFromContext maps OAuth contexts to the caller's credential type.
  • bunx tsc --noEmit and bun test (1190 tests) pass.

@vercel

vercel Bot commented Nov 12, 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 12, 2026 9:05pm UTC

This branch was successfully deployed

1 active deployment
Preview — 5b5a8970 Deployed Nov 12, 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.

1 participant