Skip to content

fix(mcp): explain resolver refusals for restricted or unfinished accounts - #518

Draft
dodeja wants to merge 1 commit into
mainfrom
claude/sentry-triage-fixes-6bfhu1
Draft

dodeja wants to merge 1 commit into
mainfrom
claude/sentry-triage-fixes-6bfhu1

Conversation

@dodeja

@dodeja dodeja commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

This is the gateway half of the MCP-SERVER-G fix.

The backend (Terminal49/t49, fix(tnt-api): refuse MCP resolve…) now refuses /v2/connected-clients/resolve with a 403 and a fixed code for two kinds of account:

  • billing-restricted accounts;
  • accounts that have not finished onboarding.

Before this, resolve issued a token that every tool call then failed with a 401.

What changes in the gateway:

  • api/mcp.ts: RESOLVE_REFUSAL_MESSAGES maps each known code to a fixed, plain message:
    • for a billing-restricted account, update billing;
    • for an unfinished account, finish onboarding in the dashboard.
  • The gateway returns {error: 'Forbidden', code, message}.
  • An unknown code keeps the generic 403 text, so no upstream text reaches clients.
  • refusal_code is logged. Resolve refusals are still not reported to Sentry.

Testing

  • packages/mcp/tests/api-handler.test.ts: 34/34 pass, including one test per known code and one confirming that an unknown code stays generic.
  • npm run agent-verify passes every step (Node 24).

Generated by Claude Code


Get evidence
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…unts

The Terminal49 resolve endpoint now refuses a WorkOS MCP grant with 403
and a fixed code when the account is billing-restricted
(billing_access_restricted) or has not finished onboarding
(account_onboarding_incomplete), instead of issuing a token every tool
call would get 401 for (MCP-SERVER-G).

The gateway maps those known codes to fixed, actionable messages and
returns the code; unknown codes keep the generic 403 text, so upstream
text never reaches the client. The refusal code is logged with the
request. Resolver refusals are not reported to Sentry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V8cPhjxmTweWGCzzfxM9ys
@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
api Ready Ready Preview Nov 16, 2026 11:03am UTC

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

Shadow risk calibration

Signal Result Authority
Path classifier risk:high Deterministic advisory policy
heuristic fallback risk-shadow:high Shadow only

Calibration result: agreement.

Shadow risk never blocks or enables merge. Keep it in observation mode until roughly 50 pull requests have human-reviewed labels, then calibrate before considering any policy use.

@github-actions github-actions Bot added risk:unknown Advisory evidence unavailable or changed; no merge permission risk:high Advisory path risk; current-head human review needed and removed risk:unknown Advisory evidence unavailable or changed; no merge permission labels Nov 16, 2026

This branch was successfully deployed

1 active deployment
Preview — d26b0e2f Deployed Nov 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:high Advisory path risk; current-head human review needed risk-shadow:high Shadow-only risk signal: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants