Commit Graph

859 Commits

Author SHA1 Message Date
David Soria Parra dc49dd795a Replace well-known server card discovery with AI Catalog discovery
Server cards are no longer served from a fixed .well-known path. Discovery
now goes through an AI Catalog (https://github.com/Agent-Card/ai-catalog)
published at /.well-known/ai-catalog.json, whose entries point at server
cards hosted anywhere:

- Add mcp.shared.experimental.ai_catalog: Pydantic models for the AI
  Catalog CDDL schema (entries, host, publisher, trust manifest), enforcing
  the url/data exclusivity and trust-manifest identity binding rules. The
  transitional MCP Catalog (/.well-known/mcp/catalog.json) is a structural
  subset and parses with the same models.
- Add mcp.server.experimental.ai_catalog: build catalog entries from server
  cards (urn:mcp:server:<name>) and serve catalogs from the well-known path.
- Add discover_server_cards(): fetch a host's catalog (AI Catalog path with
  fallback to the MCP Catalog path), then fetch or inline-validate every
  MCP server entry. Non-http(s) card URLs from the catalog are rejected.
- Drop WELL_KNOWN_PATH and well_known_url; fetch_server_card now takes the
  card URL directly and server_card_route/mount_server_card require an
  explicit path.

Review fixes:

- Fix the version-range validator rejecting valid semver prereleases like
  1.0.0-x; wildcard segments now only count in the release part, and bare
  "x"/"*" are caught.
- Serve discovery documents with the CORS headers the spec requires
  (MUST) and Cache-Control (SHOULD), exported as DISCOVERY_HEADERS.
- Restrict URL resolution to http(s) schemes to match its error message.
- Rename httpx_client to http_client and default to create_mcp_http_client()
  (30s timeout) to match SDK conventions.
- Document that lenient ingestion defaults a missing $schema/specVersion,
  diverging from the JSON Schema's required fields.
- Correct the mount_server_card docstring: mounting does not bypass auth
  middleware.
- Add missing test package __init__.py files; assert response headers and
  bodies in route tests; patch the SDK's own client factory instead of
  httpx.AsyncClient.
2026-06-03 12:28:57 +01:00
David Soria Parra a8426fc106 Add experimental Server Cards support (SEP-2127)
Adds SDK support for MCP Server Cards: static metadata documents that
describe a remote server's identity, transport endpoints, and supported
protocol versions for pre-connection discovery.

- mcp.shared.experimental.server_card: Pydantic models (ServerCard, Server,
  Remote, Package, ...) mirroring mcp.types conventions and validating purely
  through Pydantic.
- mcp.server.experimental.server_card: build_server_card derives a card from a
  server's identity; server_card_route / mount_server_card serve it from a
  Starlette app at /.well-known/mcp/server-card.
- mcp.client.experimental.server_card: fetch_server_card / load_server_card /
  well_known_url ingest and validate a card.

Full test coverage for the new modules.
2026-05-26 19:17:15 +01:00
Max 3eb579948a Add subject and claims to AccessToken (#2686) 2026-05-26 13:13:55 +00:00
Marcelo Trylesinski e8e6484278 ci: add zizmor for GitHub Actions security analysis (#2648) 2026-05-20 17:06:57 +02:00
Max f4753440da ci: deploy docs to py.sdk.modelcontextprotocol.io via Pages artifact (v1 at /, v2 at /v2/) (#2634) 2026-05-18 15:28:13 +01:00
Max 161834d4ae refactor: import SSEError from httpx_sse public API (#2560) 2026-05-08 12:42:44 -04:00
Dayna Blackwell bf3e0010b8 fix: chain exceptions in get_prompt and read_resource handlers (#2542) 2026-05-08 14:28:36 +01:00
Max 2b0da5631a build: pin PEP 517 build dependencies (#2547) 2026-05-07 17:32:30 +01:00
Gyeongjun Paik (Kent) 3d7b311de0 fix: align Context logging methods with MCP spec data type (#2366)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Max Isbey <224885523+maxisbey@users.noreply.github.com>
2026-04-14 21:41:51 +00:00
Wils Dawson 437d15aa71 SEP-2207: Refresh token guidance (#2039) 2026-04-14 11:48:07 +01:00
Max 5cbd259c3b fix: catch PydanticUserError when generating output schema (pydantic 2.13 compat) (#2434) 2026-04-13 17:03:40 +01:00
Felix Weinberger 2dfb51a4d1 fix(auth): coerce empty-string optional URL fields to None in OAuthClientMetadata (#2404) 2026-04-13 15:42:35 +01:00
Max 941089e06a docs: modernize development guidelines and rename to AGENTS.md (#2413) 2026-04-13 12:50:04 +01:00
dependabot[bot] 8f806da611 chore(deps): bump cryptography from 46.0.5 to 46.0.7 in the uv group across 1 directory (#2406)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-12 12:48:13 +00:00
Matt LeMay c5f12ec1e9 Add resources parameter to MCPServer (#2414)
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2026-04-12 14:42:12 +02:00
Max Isbey f27d2aac05 docs: fill migration guide gaps surfaced by automated upgrade eval (#2412) 2026-04-09 13:25:16 +01:00
Marcelo Trylesinski cf4e435db0 Use shared is_async_callable instead of inspect.iscoroutinefunction (#2389) 2026-04-08 13:12:20 +01:00
dependabot[bot] d5b9155f14 chore(deps): bump requests from 2.32.5 to 2.33.0 in the uv group across 1 directory (#2350)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-31 17:11:12 -04:00
Marcelo Trylesinski 37891f42a4 Add basic OpenTelemetry tracing for client and server requests (#2381) 2026-03-31 20:33:33 +00:00
Max Isbey 3ce0f76e6e Don't block the event loop on sync resource and prompt functions (#2380) 2026-03-31 13:43:56 -04:00
Marcelo Trylesinski e6235d1667 Propagate contextvars.Context through anyio streams without modifying SessionMessage (#2298) 2026-03-31 12:49:38 -04:00
Max Isbey fb2276b95f ci: remove claude-code-review workflow (#2359) 2026-03-27 14:02:41 +00:00
Max Isbey 3517a29c82 feat(server): restore dependencies parameter on MCPServer (#2358) 2026-03-27 13:42:15 +00:00
Marcelo Trylesinski 98f8ef295a Restrict httpx version to <1.0.0 (#2345)
Co-authored-by: Max Isbey <224885523+maxisbey@users.noreply.github.com>
2026-03-25 22:29:13 +00:00
Felix Weinberger 7ba4fb881d ci: skip claude.yml when comment is '@claude review' (#2337) 2026-03-24 20:36:36 +00:00
Max Isbey 92c693bb73 fix: cancel in-flight handlers when transport closes in server.run() (#2306) 2026-03-20 13:37:32 +00:00
Max Isbey 883d893097 test: rewrite cli.claude config tests to assert JSON output directly (#2311)
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Felix Weinberger <felixweinberger@users.noreply.github.com>
2026-03-19 15:16:34 +00:00
Jonathan Hefner 5388bea53a docs: generate hierarchical per-module API reference pages (#2103) 2026-03-18 18:15:17 +00:00
Max Isbey 20dd94632e feat(client): store InitializeResult as initialize_result (#2300) 2026-03-18 17:31:26 +00:00
Max Isbey 67201a9bbd test: fix WS test port race; narrow to single smoke test covering both transport ends (#2267) 2026-03-18 15:48:30 +00:00
Max Isbey 7826ade12b test: convert test_integration.py to in-memory transport (fix flaky) (#2277) 2026-03-18 15:25:11 +00:00
Max Isbey ff50351f9e ci: run strict-no-cover in scripts/test to catch stale pragmas locally (#2305) 2026-03-17 19:53:39 +00:00
Max Isbey 1a2244f402 fix: handle non-UTF-8 bytes in stdio server stdin (#2302) 2026-03-17 18:40:39 +00:00
Max Isbey 75a80b6f07 refactor: connect-first stream lifecycle for sse and streamable_http (#2292)
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2026-03-16 23:30:20 +00:00
Max Isbey abfb482246 refactor(examples): migrate all HTTP examples to streamable_http_app() (#2291) 2026-03-16 11:37:01 +00:00
Max Isbey e1fd62e0f3 fix: close all memory stream ends in client transport cleanup (#2266) 2026-03-13 14:43:54 +00:00
dependabot[bot] 2c73a2a881 chore(deps): bump black from 25.1.0 to 26.3.1 in the uv group across 1 directory (#2290)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-13 10:39:56 +00:00
Max Isbey dd52713517 Rewrite TestChildProcessCleanup with socket-based deterministic liveness probe (#2265) 2026-03-12 12:52:32 +00:00
Max Isbey 62eb08e5b2 fix: don't send log notification on transport error (#2257) 2026-03-09 17:47:27 +00:00
Max Isbey 31a38b5078 fix: correct Context type parameters across examples and tests (#2256) 2026-03-09 16:52:56 +00:00
Shivam Aggarwal 51c53f2c18 fix: accept wildcard media types in Accept header per RFC 7231 (#2152)
Co-authored-by: Shivam <shivam@Shivams-MacBook-Air-2.local>
2026-03-09 16:30:02 +00:00
Max Isbey 7ba41dcfae fix: make local coverage runs reliable (#2236) 2026-03-06 17:24:18 +00:00
Ramesh Reddy Adutla eaf971cf25 Add warning log when rejecting request with unknown/expired session ID (#2212)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Max Isbey <224885523+maxisbey@users.noreply.github.com>
2026-03-06 16:55:37 +00:00
Max Isbey 92f1b1500d fix: remove MIME type validation from MCPServer Resource (#2235) 2026-03-06 14:50:58 +00:00
Giulio Leone b33c811675 perf: use deque for InMemoryTaskMessageQueue FIFO operations (#2165) 2026-03-05 15:44:33 +00:00
Giulio Leone 7c0224828b fix(oauth): include client_id in token request body for client_secret_post (#2185)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-05 14:57:33 +00:00
Max Isbey 528abfab86 tests: remove lax-no-cover pragmas by moving assertions before cancellation (#2206) 2026-03-04 16:11:34 +00:00
Varun6578 b3149d2f33 fix: clean up SSE session on client disconnect (#2200)
Co-authored-by: Varun Sharma <sharmava@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Max Isbey <224885523+maxisbey@users.noreply.github.com>
2026-03-04 14:45:11 +00:00
Max Isbey cc22bf5464 refactor: remove request_ctx ContextVar, thread Context explicitly (#2203)
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2026-03-04 13:23:02 +00:00
Max Isbey 62575edabd ci: sign weekly lockfile commits as github-actions[bot] (#2148) 2026-02-26 15:36:46 +00:00