Add mcp.types as a permanent alias for mcp_types (#3190)

This commit is contained in:
Max 2026-07-27 23:47:04 +01:00 • committed by GitHub
commit b7c9a916d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
67 changed files with 467 additions and 364 deletions

View file

@ -19,13 +19,13 @@ from urllib.parse import urlsplit
import anyio
import httpx2
from mcp_types.version import LATEST_MODERN_VERSION
from mcp import StdioServerParameters, stdio_client
from mcp.client import Transport
from mcp.client.streamable_http import streamable_http_client
from mcp.server import Server
from mcp.server.mcpserver import MCPServer
from mcp.types.version import LATEST_MODERN_VERSION
if sys.version_info >= (3, 11):
import tomllib

View file

@ -1,9 +1,8 @@
"""Negotiate MCP Apps, discover a tool's `ui://` UI, fetch it, and call the tool."""
from mcp_types import TextContent, TextResourceContents
from mcp.client import Client, advertise
from mcp.server.apps import APP_MIME_TYPE, EXTENSION_ID
from mcp.types import TextContent, TextResourceContents
from stories._harness import Target, run_client

View file

@ -2,10 +2,10 @@
from typing import Any
import mcp_types as types
from pydantic import AnyHttpUrl
from starlette.applications import Starlette
import mcp.types as types
from mcp.server.auth.middleware.auth_context import get_access_token
from mcp.server.auth.settings import AuthSettings
from mcp.server.context import ServerRequestContext

View file

@ -2,8 +2,7 @@
from typing import Literal
import mcp_types as types
import mcp.types as types
from mcp.client import Client
from stories._harness import Target, run_client

View file

@ -6,8 +6,7 @@ story's `server.py` is lowlevel-native (no `server_lowlevel.py` sibling).
from typing import Any
import mcp_types as types
import mcp.types as types
from mcp.server.context import ServerRequestContext
from mcp.server.lowlevel import Server
from stories._hosting import run_server_from_args

View file

@ -1,9 +1,8 @@
"""Connect to the same server factory twice — once per era, so `main` takes `targets` — and assert both are served."""
import mcp_types as types
from mcp_types.version import LATEST_HANDSHAKE_VERSION, LATEST_MODERN_VERSION
import mcp.types as types
from mcp.client import Client
from mcp.types.version import LATEST_HANDSHAKE_VERSION, LATEST_MODERN_VERSION
from stories._harness import TargetFactory, run_client

View file

@ -1,8 +1,7 @@
"""One MCPServer factory that serves both the 2025 handshake era and the 2026 stateless era."""
from mcp_types.version import MODERN_PROTOCOL_VERSIONS
from mcp.server.mcpserver import Context, MCPServer
from mcp.types.version import MODERN_PROTOCOL_VERSIONS
from stories._hosting import run_server_from_args

View file

@ -2,11 +2,10 @@
from typing import Any
import mcp_types as types
from mcp_types.version import MODERN_PROTOCOL_VERSIONS
import mcp.types as types
from mcp.server.context import ServerRequestContext
from mcp.server.lowlevel import Server
from mcp.types.version import MODERN_PROTOCOL_VERSIONS
from stories._hosting import run_server_from_args
GREET_INPUT_SCHEMA: dict[str, Any] = {

View file

@ -1,9 +1,8 @@
"""Prove the two error channels: is_error results return; MCPError raises."""
from mcp_types import INVALID_PARAMS, TextContent
from mcp import MCPError
from mcp.client import Client
from mcp.types import INVALID_PARAMS, TextContent
from stories._harness import Target, run_client

View file

@ -1,10 +1,9 @@
"""Two error channels: ToolError -> is_error result; MCPError -> JSON-RPC protocol error."""
from mcp_types import INVALID_PARAMS
from mcp.server.mcpserver import MCPServer
from mcp.server.mcpserver.exceptions import ToolError
from mcp.shared.exceptions import MCPError
from mcp.types import INVALID_PARAMS
from stories._hosting import run_server_from_args

View file

@ -2,8 +2,7 @@
from typing import Any
import mcp_types as types
import mcp.types as types
from mcp.server.context import ServerRequestContext
from mcp.server.lowlevel import Server
from mcp.shared.exceptions import MCPError

View file

@ -2,10 +2,9 @@
from typing import Literal
import mcp_types as types
from mcp_types import TextContent
import mcp.types as types
from mcp.client import Client, advertise
from mcp.types import TextContent
from stories._harness import Target, run_client
EXTENSION_ID = "com.example/catalog"

View file

@ -9,9 +9,9 @@ the vendor method.
from collections.abc import Sequence
from typing import Any
import mcp_types as types
from pydantic import Field
import mcp.types as types
from mcp.server.context import ServerRequestContext
from mcp.server.extension import Extension, MethodBinding, ToolBinding
from mcp.server.mcpserver import MCPServer, require_client_extension

View file

@ -3,9 +3,9 @@
import json
from typing import Any
import mcp_types as types
from starlette.applications import Starlette
import mcp.types as types
from mcp.server.auth.middleware.auth_context import get_access_token
from mcp.server.auth.provider import ProviderTokenVerifier
from mcp.server.context import ServerRequestContext

View file

@ -6,15 +6,15 @@ asserts the response is a single ``application/json`` body with no session id.
"""
import httpx2
from mcp_types import TextContent
from mcp_types.version import LATEST_MODERN_VERSION
from mcp.client import Client
from mcp.types import TextContent
from mcp.types.version import LATEST_MODERN_VERSION
from stories._harness import Target, run_client
# The raw 2026-07-28 POST envelope: per-request `_meta` replaces the initialize handshake.
# The key/header strings are spelled out on purpose — this is the raw-wire story. In code
# use the named constants instead: `mcp_types.PROTOCOL_VERSION_META_KEY` /
# use the named constants instead: `mcp.types.PROTOCOL_VERSION_META_KEY` /
# `CLIENT_INFO_META_KEY` / `CLIENT_CAPABILITIES_META_KEY` and
# `mcp.shared.inbound.MCP_PROTOCOL_VERSION_HEADER` (`legacy_routing/` shows that form).
RAW_ENVELOPE_BODY: dict[str, object] = {

View file

@ -2,9 +2,9 @@
from typing import Any
import mcp_types as types
from starlette.applications import Starlette
import mcp.types as types
from mcp.server.context import ServerRequestContext
from mcp.server.lowlevel import Server
from stories._hosting import NO_DNS_REBIND, run_app_from_args

View file

@ -1,7 +1,6 @@
"""Auto-answer form and URL elicitations and assert the tool result reflects them."""
import mcp_types as types
import mcp.types as types
from mcp.client import Client, ClientRequestContext
from stories._harness import Target, run_client

View file

@ -2,8 +2,7 @@
from typing import Any
import mcp_types as types
import mcp.types as types
from mcp.server.context import ServerRequestContext
from mcp.server.lowlevel import Server
from stories._hosting import run_server_from_args

View file

@ -2,12 +2,11 @@
from typing import Any
import mcp_types as types
from mcp_types import CLIENT_CAPABILITIES_META_KEY, CLIENT_INFO_META_KEY, PROTOCOL_VERSION_META_KEY
from mcp_types.version import LATEST_HANDSHAKE_VERSION, LATEST_MODERN_VERSION
import mcp.types as types
from mcp.client import Client
from mcp.shared.inbound import MCP_METHOD_HEADER, MCP_PROTOCOL_VERSION_HEADER, InboundLadderRejection
from mcp.types import CLIENT_CAPABILITIES_META_KEY, CLIENT_INFO_META_KEY, PROTOCOL_VERSION_META_KEY
from mcp.types.version import LATEST_HANDSHAKE_VERSION, LATEST_MODERN_VERSION
from stories._harness import TargetFactory, run_client
from .server import classify_era

View file

@ -3,13 +3,13 @@
from collections.abc import Mapping
from typing import Any, Literal
from mcp_types import INVALID_PARAMS
from mcp_types.version import MODERN_PROTOCOL_VERSIONS
from starlette.applications import Starlette
from starlette.middleware.cors import CORSMiddleware
from mcp.server.mcpserver import Context, MCPServer
from mcp.shared.inbound import InboundLadderRejection, InboundModernRoute, classify_inbound_request
from mcp.types import INVALID_PARAMS
from mcp.types.version import MODERN_PROTOCOL_VERSIONS
from stories._hosting import NO_DNS_REBIND, run_app_from_args
#: Response headers a browser-based MCP client must be able to read.

Some files were not shown because too many files have changed in this diff Show more