whoami returns a bare HTTP 400 when the token has no user behind it (org auth tokens)

Aperta Adatta ai principianti
#2,315 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
75/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

Leggi packages/mcp-core/src/internal/error-handling.ts e segui come whoami gestisce una risposta 400 da /auth/. Aggiorna l’errore mostrato in questo caso per spiegare che al token non è associato alcun utente e consigliare un token personale o OAuth. Il lavoro è completato quando l’errore fornisce queste indicazioni e la gestione generica esistente rimane adatta agli altri errori; l’issue non indica alcun file di test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

mcp-feedback-pattern

An agent connected to the hosted MCP with a direct Sentry-Bearer token got 403s naming org:read on find_organizations and find_projects and event:read on search_issues, and then whoami failed with a bare HTTP 400 Bad Request. It concluded the token "has no usable scopes" and stopped. Reported through submit_feedback_to_sentry_team (MCP 0.42.0).

Likely token type (inference: we can't see the token). These failures fit an org auth token (sntrys_...):

  • Org auth tokens carry only org:ci. It's the only allowed scope (sentry src/sentry/models/orgauthtoken.py:32-36), so every read tool gets an insufficient_scope 403. Since getsentry/toolkit#2222, the MCP names the missing scopes correctly.
  • Org auth tokens authenticate with no user (OrgAuthTokenAuthentication passes None as the user, sentry src/sentry/api/authentication.py:751-787). GET /api/0/auth/ then returns a bodiless 400 when request.user isn't authenticated (sentry src/sentry/api/endpoints/auth_index.py:63-65).

MCP gap. whoami passes that 400 through the generic Input Error template ("There was an HTTP 400 error... trying again", packages/mcp-core/src/internal/error-handling.ts). That message doesn't tell the agent the token isn't tied to a user, or that org auth tokens can't drive the MCP.

Fix. whoami should explain a 400 from /auth/: the token isn't tied to a user, org auth tokens only carry org:ci, so connect with a personal token or OAuth.

Possible follow-up, not in the fix: reject sntrys_ tokens up front in Sentry-Bearer mode, since no read tool can work with org:ci alone.

Reports: 1

via automation evt_905b9c478746fd9deeb853f85ad7441b · Run ID dispatch_d428b39c5339ad27cbfcee6c1a8f7e77.

--

View Session [Sentry]

Lingua principale
TypeScript
Stelle
975
Fork
189
Merge medio
19h 57m
PR unite (30g)
542

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di getsentry/toolkit

Tutte le issue di getsentry/toolkit

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.