modelcontextprotocol / modelcontextprotocol/python-sdk
Implement server-side support for Client ID Metadata Documents (CIMD)
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 24.3k
- Fork
- 4k
- Merge trung bình
- 1 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 31
Mô tả
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=truein 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
- MCP Spec: https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization#client-id-metadata-documents
- CIMD RFC: https://datatracker.ietf.org/doc/html/draft-ietf-oauth-client-id-metadata-document-00
- SEP-991: https://github.com/modelcontextprotocol/modelcontextprotocol/issues/991
- Client-side PR: #1652
- Original tracking issue: #1538 (closed prematurely - only client-side was implemented)
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng việc xem xét hỗ trợ CIMD phía client trong PR #1652, cùng với siêu dữ liệu OAuth của SDK và việc xử lý ủy quyền phía server. Ánh xạ việc phát hiện URL client_id bị thiếu, tìm nạp tài liệu, xác thực, bộ nhớ đệm và các biện pháp bảo vệ SSRF vào các entry point hiện có. Hoàn tất khi các authorization server công bố hỗ trợ CIMD và đáp ứng các yêu cầu CIMD và MCP được liệt kê mà không cache lỗi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- api, authentication, backend, security
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100