Split protocol types into a standalone `mcp-types` package
What
Extract the protocol wire types from src/mcp/types/ into a separate distribution, mcp-types (imported as mcp_types), wired into the existing uv workspace as a member under src/mcp-types/ (same nesting as httpx2/httpcore2).
mcp-types depends only on pydantic + typing-extensions, so tooling and lightweight clients can (de)serialize MCP traffic without pulling in httpx, starlette, uvicorn, and the rest of the server/transport stack.
Key changes
src/mcp/types/→src/mcp-types/mcp_types/(_types,jsonrpc,_wire_base,methods,v2025_11_25/,v2026_07_28/), moved withgit mvso history is preserved.src/mcp/shared/version.py→src/mcp-types/mcp_types/version.py. It is a pure leaf with nomcpdependencies, which is what letsmcp_typesdepend on nothing inmcp(methods.pyneedsKNOWN_PROTOCOL_VERSIONS).mcp.typesandmcp.shared.versionare removed (no shim). All importers are rewritten tomcp_types/mcp_types.version.mcp.__init__still re-exports the type names frommcp_types, sofrom mcp import Toolis unchanged.- Workspace/build wiring:
[tool.uv.workspace]member,[tool.uv.sources],mcpdependency, pyrightinclude, ruff per-file-ignore, coveragesource+[tool.coverage.paths]mapping, andscripts/gen_surface_types.pyoutput path +--base-class.
Breaking change
from mcp.types import X and from mcp.shared.version import X no longer work; use from mcp_types import X / from mcp_types.version import X. The top-level from mcp import X re-exports are unchanged. Documented in docs/migration.md.
Verification
- 2714 tests pass; pyright reports 0 errors; ruff/format clean.
- 100.00% coverage,
strict-no-coverclean. mcp-typesbuilds standalone (wheel includespy.typedand all modules).scripts/gen_surface_types.py --checkregenerates thev*validators identically from the new path.
AI Disclaimer
This PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.