Skip to content

feat(mcp): surface account identity via a whoami tool (#672) - #673

Merged
serge-ivo merged 1 commit into
mainfrom
feat/mcp-whoami-account-identity
Aug 16, 2026
Merged

feat(mcp): surface account identity via a whoami tool (#672)#673
serge-ivo merged 1 commit into
mainfrom
feat/mcp-whoami-account-identity

Conversation

@serge-ivo

Copy link
Copy Markdown
Contributor

Closes #672.

Problem

Over the MCP connector a user cannot find out which account they are connected as. The session is verified but nothing names the identity behind it — there is no whoami tool (it exists only as a CLI command), and no API endpoint returns the identity in a compact shape. GET /v1/auth/me is the SDK-ish profile shape (name/avatar/subscription/board), not an identity answer.

What this adds

  • GET /v1/auth/me/accountid, login, provider, providerLabel, email, roles, createdAt, tokenExpiry. Gated by the session Bearer only (requireUser, which also applies the live suspension check). The row returned is always the caller's own — there is no lookup-by-id parameter to abuse.
  • MCP whoami tool (in the account group) — ungated read, no dry-run, mirrors billing_status/keys_status; just authedCall("/v1/auth/me/account").

provider is derived from the uid the OAuth callbacks mint: google:<id> → Google, a bare numeric id → GitHub. email is surfaced only for Google, whose sign-in stores the address in github_login; a GitHub github_login is a username, returned as login, never email. No migration — nothing new is stored.

Why no internal-token gate (unlike ProAppStore #138)

The PAS original guards this behind a second X-Internal-Token gate because PAS ships the identity shape into creator-controlled app JS (the SDK User contract) and de-privileges MCP-origin sessions to ['user']. PAGS does neither — it has no SDK User contract carrying this, and does not de-privilege MCP sessions — so that gate would be net-new plumbing guarding a leak PAGS does not have. Plain requireUser is the honest gate here.

Tool-count / docs bookkeeping

MCP_TOOL_COUNT 135→136, MCP_TOOL_ALWAYS_ON 117→118, the derived contract.test.ts golden row, the README tool table, every swept doc claim (platform-docs/mcp.md, store/llms-full.txt, store/about/index.html, workers/mcp/CLAUDE.md incl. the per-file account.ts count), and the OpenAPI spec.

Tests

4 new integration tests in auth.integration.test.ts: 401 without a bearer, 404 with no row, github-shape → email null, google-shape → email surfaced.

Verified locally, all green: pnpm typecheck (all packages), biome check, auth + MCP suites (199 tests), docs-drift.mjs, openapi-coverage.mjs, check-file-size.mjs.

🤖 Generated with Claude Code

…as (#672)

Over the MCP connector a caller holds a session but has no tool that names
the identity behind it. Add GET /v1/auth/me/account (gated by the session
Bearer only — the row returned is always the caller's own) returning id,
login, provider + label, email, roles, createdAt and this token's expiry,
and a `whoami` MCP tool that reads it.

provider is derived from the uid the OAuth callbacks mint: `google:<id>` is
Google, a bare numeric id is GitHub. email is surfaced only for Google, whose
sign-in stores the address in github_login; a GitHub login is a username and
comes back as `login`, never email. No migration — nothing new is stored.

Unlike the ProAppStore original (#138) this needs no internal-token second
gate: PAGS does not de-privilege an MCP-origin session and does not ship this
shape into creator-controlled app JS, so there is no leak for that gate to
close.

Tool-count bookkeeping: MCP_TOOL_COUNT 135->136, ALWAYS_ON 117->118, the
contract-test golden row, the README tool table, the swept doc claims
(mcp.md, llms-full, about, CLAUDE.md) and the OpenAPI spec.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@serge-ivo
serge-ivo force-pushed the feat/mcp-whoami-account-identity branch from 61507e3 to 69c6af7 Compare August 16, 2026 02:06
@serge-ivo
serge-ivo merged commit 6089336 into main Aug 16, 2026
1 check failed
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.

MCP connector: no way for a user to retrieve their own account identity

2 participants