Skip to content

Extract protocol types into a standalone mcp-types package#2762

Open
Kludex wants to merge 1 commit into
mainfrom
extract-mcp-types-package
Open

Extract protocol types into a standalone mcp-types package#2762
Kludex wants to merge 1 commit into
mainfrom
extract-mcp-types-package

Conversation

@Kludex
Copy link
Copy Markdown
Member

@Kludex Kludex commented Jun 2, 2026

Summary

Converts the repository into a uv workspace mirroring pydantic/httpx2, introducing a standalone mcp-types package for the protocol types.

  • Root pyproject.toml becomes a pure coordinator ([tool.uv] package = false, no [project]); shared tool config (ruff, pyright, pytest, coverage) stays at root.
  • Two distributable packages, each nested under src/<pkg>/<pkg>/ with its own pyproject.toml:
    • src/mcp/mcp/mcp
    • src/mcp-types/mcp_types/mcp-types (import name mcp_types, with py.typed)
  • The protocol types (_types.py, jsonrpc.py) move into mcp_types, which only depends on pydantic and typing-extensions. mcp depends on mcp-types=={{ version }} via uv-dynamic-versioning, so installing mcp continues to pull the types in.
  • The mcp.types module path is removed; all imports now use mcp_types. The curated re-exports on the top-level mcp package (from mcp import Tool) are unchanged.
  • Migration guide and README.v2.md snippets updated.

Verification

  • uv lock / uv sync build both packages from their new locations
  • ruff check + ruff format --check: clean
  • pyright: 0 errors
  • ./scripts/test: 1750 passed, 100% coverage, strict-no-cover clean

AI Disclaimer

This PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.

Convert the repository into a uv workspace mirroring pydantic/httpx2. The
root pyproject becomes a pure coordinator (package = false) and the two
distributable packages live nested under src/<pkg>/<pkg>/ each with their
own pyproject:

- src/mcp/mcp/ -> mcp
- src/mcp-types/mcp_types/ -> mcp-types (import mcp_types)

The protocol types (_types.py, jsonrpc.py) move into mcp_types, which only
depends on pydantic and typing-extensions. mcp depends on mcp-types via
uv-dynamic-versioning, so installing mcp still pulls the types in. The
mcp.types module path is removed; all imports now use mcp_types. The
curated re-exports on the top-level mcp package are unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant