Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: modelcontextprotocol/python-sdk
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: modelcontextprotocol/python-sdk
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2-design-sketches
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 8 commits
  • 23 files changed
  • 2 contributors

Commits on Jan 24, 2026

  1. wip: add v2 lowlevel server design sketch

    Initial sketch exploring a simplified lowlevel server API:
    - Method-string based handler registration
    - Context object for bidirectional communication
    - Separate request/notification handlers
    - Transport abstraction with GET stream handler
    
    Also excludes v2_scratch and scratch folders from linting.
    
    This is exploratory design work for SDK v2.
    maxisbey committed Jan 24, 2026
    Configuration menu
    Copy the full SHA
    c149884 View commit details
    Browse the repository at this point in the history
  2. wip: refine v2 lowlevel server types and handlers

    - Add type-safe method registration with Literal unions (RequestMethod,
      ClientNotificationMethod, ServerNotificationMethod)
    - Switch notification params from TypedDicts to BaseModels for
      consistency and proxy support
    - Add Context dataclass with send_notification and send_request for
      bidirectional communication
    - Result types inherit from JSONRPCResponse with id from request
    - Clean up handler examples to use new types
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    maxisbey and claude committed Jan 24, 2026
    Configuration menu
    Copy the full SHA
    d618612 View commit details
    Browse the repository at this point in the history
  3. wip: reorganize v2 sketch into transport subpackage

    - Extract Transport protocol, Context, and StreamableHTTPTransport
      into v2_scratch/transport/ subpackage
    - Rename JSONRPCResponse -> JSONRPCResultResponse for clarity
    - Add JSONRPCErrorResponse with structured ErrorData
    - Make JSONRPCResponse a type alias (Result | Error) per spec
    - Remove v2_scratch from ruff exclude (enable linting)
    - Add py.typed marker and __init__.py files
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    maxisbey and claude committed Jan 24, 2026
    Configuration menu
    Copy the full SHA
    8385638 View commit details
    Browse the repository at this point in the history
  4. wip: checkpoint - mcp_v2 types with generic bases and TypeAdapter

    - Add json_rpc.py with generic bases (RequestBase, NotificationBase,
      ResultResponseBase) for typed message subclasses
    - Add JSONRPCMessageAdapter for automatic message type discrimination
    - Update types.py to use generic bases for typed requests/notifications
    - Add parametrized tests for TypeAdapter discrimination
    - Reorganize v2_scratch -> src/mcp_v2
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    maxisbey and claude committed Jan 24, 2026
    Configuration menu
    Copy the full SHA
    0b00503 View commit details
    Browse the repository at this point in the history
  5. wip: add extra="allow" to all protocol types via base classes

    - Add model_config with extra="allow" to JSONRPCBase and ErrorData
    - Create MCPModel base class with extra="allow" for MCP domain types
    - Update inheritance: params inherit from RequestParams, results from Result
    - Add snake_case aliases for camelCase fields (protocol_version, etc.)
    - Add Meta, Icon, Annotations, ToolAnnotations, ToolExecution, JsonSchema types
    - Expand Tool model with all spec fields
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    maxisbey and claude committed Jan 24, 2026
    Configuration menu
    Copy the full SHA
    c90b6f0 View commit details
    Browse the repository at this point in the history
  6. wip: restructure mcp_v2 types into separate modules

    - Split types.py into base.py, common.py, content.py, initialize.py,
      tools.py, and resources.py
    - Fix transport imports to use specific module paths
    - Update Context.send_notification to take method as separate param
    - Use X | None instead of Optional[X] (with PyCharm noinspection comments)
    - All ruff and pyright checks pass
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    maxisbey and claude committed Jan 24, 2026
    Configuration menu
    Copy the full SHA
    8d2ce8a View commit details
    Browse the repository at this point in the history
  7. checkpoint

    maxisbey committed Jan 24, 2026
    Configuration menu
    Copy the full SHA
    5e67625 View commit details
    Browse the repository at this point in the history
  8. wip: add Starlette-style lifespan to v2 LowLevelServer

    - Lifespan is now an async context manager that receives the server
    - Lifespan runs ONCE for the server lifetime, not per-session
    - Add separate session_lifespan for per-session state
    - Runner pattern: run() enters lifespan, handle_session() reuses it
    - Matches Starlette/FastAPI lifespan semantics
    
    Claude-Generated-By: Claude Code (cli/claude-opus-4-5=100%)
    Claude-Steers: 12
    Claude-Permission-Prompts: 8
    Claude-Escapes: 1
    maxisbey committed Jan 24, 2026
    Configuration menu
    Copy the full SHA
    b8c29d2 View commit details
    Browse the repository at this point in the history
Loading