Make the per-version wire packages private (mcp_types._v*) (#3191)

This commit is contained in:
Max 2026-07-27 22:16:48 +01:00 • committed by GitHub
commit b9422f1c9b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 133 additions and 127 deletions

View file

@ -3,7 +3,7 @@
One model per protocol construct, carrying every field from every supported
protocol version, so application code sees a single set of types regardless of
the negotiated version. Per-field docstrings note version availability. The
`mcp_types.v*` surface packages carry the schema-exact wire shapes.
`mcp_types._v*` surface packages carry the schema-exact wire shapes.
"""
from __future__ import annotations

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
"""Shared pydantic base for the generated `mcp_types.v*` wire-shape packages."""
"""Shared pydantic base for the generated `mcp_types._v*` wire-shape packages."""
from pydantic import BaseModel, ConfigDict

View file

@ -1,6 +1,6 @@
"""Per-version method maps and parse/serialize functions for MCP traffic.
This module is supported public API; the `mcp_types.v*` packages it draws on
This module is supported public API; the `mcp_types._v*` packages it draws on
are internal validators and not for direct import.
Surface maps key `(method, version)` to per-version wire types (key absence is
@ -18,8 +18,8 @@ from typing import Any, Final, Literal, TypeGuard, TypeVar, cast, get_args
from pydantic import BaseModel, TypeAdapter
import mcp_types as types
import mcp_types.v2025_11_25 as v2025
import mcp_types.v2026_07_28 as v2026
import mcp_types._v2025_11_25 as v2025
import mcp_types._v2026_07_28 as v2026
from mcp_types.version import KNOWN_PROTOCOL_VERSIONS
__all__ = [

View file

@ -7,7 +7,7 @@ from typing import Any, Generic, Literal, TypeVar
from mcp_types import RequestId
# Internal surface package; imported as the gate's source of truth for spec-valid property schemas.
from mcp_types.v2025_11_25 import PrimitiveSchemaDefinition
from mcp_types._v2025_11_25 import PrimitiveSchemaDefinition
from pydantic import BaseModel, ValidationError
from pydantic.json_schema import GenerateJsonSchema, JsonSchemaValue
from pydantic_core import core_schema