[task] Sign members in to MCP and manage sessions

Aperta
#440 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
18/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Start by reading the blocking issues #437 (SDK choice), #438 (directory client) and #439 (shared start/confirm logic), since this work cannot begin until all three land. Then check whether the chosen Python MCP SDK exposes OAuth authorization-server routes behind a provider interface; if so implement the provider, otherwise record why the routes are hand-built. Existing email-code flow lives in the /v1/auth/* handlers from #331 and prior art is PR #125. Done means the listed tests around /authorize, /token, /revoke and the admin revoke command pass.

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

Descrizione

area/integration area/service type/feature
Blocked by

#437

What

Give allowlisted coding agents browser OAuth sign-in using the gateway’s email-code login and a durable, revocable session.

Why

Members need to sign in as themselves and keep the agent connected across access-token expiry.

Area

integration, service

Done looks like
  • Extract shared email-login start and confirm functions for the browser and the existing gateway routes. Preserve authenticated caller identity, challenge binding, delivery timing, limits and the existing public login contract.
  • Add migration 003 with a working downgrade and matching in-memory and Postgres adapters. Bind each session to the member, client and environment. Store only hashes of authorization codes and tokens.
  • Exchange each short-lived code once. Rotate refresh tokens, handle concurrent refresh within the agreed grace policy, and revoke on reuse outside it. Support single-session and all-session revocation.
  • Discovery documents (/.well-known/oauth-protected-resource/mcp and /.well-known/oauth-authorization-server) and /authorize are served only when both the MCP switch and email_login_enabled are on. /authorize accepts only S256 PKCE, this gateway's /mcp as resource, a client ID on the allowlist, and a loopback redirect address listed in that client's metadata document.
  • The login page signs the member in through #331's shared start and confirm logic under the app name mcp, with their real IP and the same "check your email" message for members and non-members. It sends no-store, a content security policy and framing protection, rejects cross-site form posts, and escapes everything it shows back.
  • /token exchanges the code and PKCE verifier for tokens and rotates refresh tokens, checking membership on each refresh. /revoke ends the session. Tokens are bound to /mcp and the environment.
  • A gateway-keys-style CLI command revokes all of a person's sessions.
  • Sign-in, refresh, logout, revocation and failed sign-in attempts are written to the audit log, with no tokens, codes or email addresses.
  • Tests cover the whole sign-in from /authorize, against fake directory and verification clients: success, non-member, wrong or expired code, wrong PKCE verifier, unknown client, bad redirect address, refresh, refresh after membership ends, revoke, and the admin command.
Design notes

Part of #436. Storage and the email-login refactor can begin alongside #437. Mounted OAuth routes depend on its SDK and feature switch. #442 owns authorization on tool requests. Detailed storage and email-login contracts: #438 and #439. Approved design: #335 / PR #399.

Lingua principale
Python
Stelle
0
Fork
2
Merge medio
3g 3h
PR unite (30g)
31

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

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 UTMIST/Misty

Tutte le issue di UTMIST/Misty

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.