Skip to content

refactor(git): migrate lowlevel server to MCP Python SDK v2 - #4564

Open
Jiafi wants to merge 1 commit into
modelcontextprotocol:mainfrom
Jiafi:jiafi/migrate-mcp-python-sdk-v2-git-server
Open

refactor(git): migrate lowlevel server to MCP Python SDK v2#4564
Jiafi wants to merge 1 commit into
modelcontextprotocol:mainfrom
Jiafi:jiafi/migrate-mcp-python-sdk-v2-git-server

Conversation

@Jiafi

@Jiafi Jiafi commented Jul 28, 2026

Copy link
Copy Markdown

Description

  • migrate src/git from MCP Python SDK v1 to v2 for the low-level server API
  • replace decorator-based handlers with Server(..., on_list_tools=..., on_call_tool=...)
  • update low-level return types to v2 objects (ListToolsResult, CallToolResult)
  • migrate MCP type field names to snake_case (input_schema, read_only_hint, etc.)
  • keep existing tool behavior flow in on_call_tool aligned with prior implementation
  • bump mcp dependency to >=2,<3 and refresh uv.lock
  • document the SDK v2 requirement in the git server README

Publishing Your Server

Note: We are no longer accepting PRs to add servers to the README. Instead, please publish your server to the MCP Server Registry to make it discoverable to the MCP ecosystem.

To publish your server, follow the quickstart guide. You can browse published servers at https://registry.modelcontextprotocol.io/.

Server Details

  • Server: git
  • Changes to: tools

Motivation and Context

The Python SDK v2 removes low-level server decorators and requires explicit handler registration and result types. This updates the git server to stay compatible with current MCP Python SDK versions while preserving existing tool behavior.

How Has This Been Tested?

  • uv run pytest (43 passed)
  • uv run pyright (0 errors)
  • uv run ruff check . (all checks passed)
  • semgrep preflight scan on changed server file (src/git/src/mcp_server_git/server.py): clean (no findings)
  • manual validation by running the server entrypoint (uv run mcp-server-git --help)

Breaking Changes

Yes for integrators pinned to MCP Python SDK v1 in this package environment (mcp>=2,<3 required).

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follows MCP security best practices
  • I have updated the server's README accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

  • uv.lock was regenerated with the public PyPI default index to avoid private registry URLs in lock metadata.
  • LLM client testing note: exercised server behavior through the MCP tool-calling flow in this coding session.

@Jiafi
Jiafi marked this pull request as draft July 28, 2026 20:43
@Jiafi
Jiafi force-pushed the jiafi/migrate-mcp-python-sdk-v2-git-server branch from 2f33d25 to e929084 Compare July 28, 2026 20:51
@Jiafi
Jiafi marked this pull request as ready for review July 28, 2026 21:02
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