modelcontextprotocol / modelcontextprotocol/python-sdk

Implement server-side support for Client ID Metadata Documents (CIMD)

Aperta
#1,801 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

auth enhancement needs decision P2
Lingua principale
Python
Stelle
24.3k
Fork
4k
Merge medio
1g 1h
PR unite (30g)
31

Descrizione

Summary

PR #1652 implemented client-side support for Client ID Metadata Documents (CIMD) per SEP-991, but the server-side implementation is missing. Authorization servers built with the Python SDK cannot currently support CIMD.

Background

CIMD (draft-ietf-oauth-client-id-metadata-document-00) allows OAuth clients to use HTTPS URLs as client identifiers, where the URL points to a JSON document containing client metadata. This is the recommended registration approach per the MCP spec (ahead of DCR).

From the MCP Authorization spec:

Authorization servers and MCP clients SHOULD support OAuth Client ID Metadata Documents

Current State

Client-side (implemented in #1652)
  • is_valid_client_metadata_url() - validates HTTPS URLs with path component
  • should_use_client_metadata_url() - checks if server advertises CIMD support
  • create_client_info_from_metadata_url() - uses URL as client_id
  • ✅ OAuth flow integration with DCR fallback
Server-side (missing)
  • ❌ Never advertises client_id_metadata_document_supported=true in OAuth metadata
  • ❌ No detection of URL-formatted client_ids
  • ❌ No metadata document fetching
  • ❌ No validation (client_id matching, redirect_uri verification, document structure)
  • ❌ No caching infrastructure
  • ❌ No SSRF protection for fetching

Spec Requirements for Authorization Servers

From the MCP spec and CIMD RFC:

Requirement Level
Fetch metadata documents when encountering URL-formatted client_ids SHOULD
Validate that fetched document's client_id matches the URL exactly MUST
Validate redirect URIs against those in the metadata document MUST
Validate document structure is valid JSON with required fields MUST
Cache metadata respecting HTTP cache headers SHOULD
Protect against SSRF attacks SHOULD
Limit document size (~5KB recommended) SHOULD
Display client_id hostname during consent SHOULD
Never cache error responses MUST NOT

References

AI Disclaimer

Guida per i contributori

Apri la 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.

Direzione di ricerca

Inizia esaminando il supporto CIMD lato client in PR #1652, nonché i metadati OAuth dell'SDK e la gestione dell'autorizzazione lato server. Mappa il rilevamento dell'URL client_id mancante, il recupero dei documenti, la validazione, il caching e le protezioni SSRF sui punti di ingresso esistenti. Il lavoro è completato quando i server di autorizzazione dichiarano il supporto CIMD e soddisfano i requisiti CIMD e MCP elencati senza memorizzare nella cache gli errori.

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

Valutazione

Stack tecnologico
python
Ambito
api, authentication, backend, security
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.