Skip to content

Conversation

@hesreallyhim
Copy link
Contributor

@hesreallyhim hesreallyhim commented May 13, 2025

Description

This PR fixes some minor typing issues identified by mypy/pylance. It updates a deprecated pydantic function with its equivalent replacement, fixes some typing issues around strings, and adds a py.typed marker.

Server Details

  • Server: git
  • Changes to: typing and pydantic fixes (Tools, etc.)

Motivation and Context

The list of Tools uses the pydantic method schema which is deprecated, as indicated by pylance:

The method "schema" in class "BaseModel" is deprecated
  The `schema` method is deprecated; use `model_json_schema` instead.

In fact, schema now just points to model_json_schema, so there should be no functional effect.

Additionally, two places were showing warnings due to f-strings where the value could be a binary, so this was tweaked to use the !r syntax.

Additionally, git.Repo was being used as .refs[base_branch] which was causing pylance to complain. refs is an alias for references, as you can see in the source code, but I guess this is confusing for pylance. So I just changed it to references. Again, should be no effect.

Additionally, added py.typed for type-checkers.

How Has This Been Tested?

Tested various cases with Inspector, everything working fine. Automated tests are passing.

Breaking Changes

No.

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

@hesreallyhim
Copy link
Contributor Author

this server has been archived

@olaservo olaservo reopened this Jun 25, 2025
@olaservo olaservo added the server-git Reference implementation for the Git MCP server - src/git label Jun 25, 2025
Copy link
Member

@olaservo olaservo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! This server was reverted from being archived so I reopened this.

@olaservo olaservo merged commit 9898e5a into modelcontextprotocol:main Jun 25, 2025
15 checks passed
@hesreallyhim
Copy link
Contributor Author

@olaservo oh sweet thanks, much appreciated 🙏

PazerOP referenced this pull request in PazerOP/mcp-template Jul 15, 2025
…es-with-typing-and-strings

[FIX] `mcp_server_git`: replace deprecated pydantic functions and small fixes to typing issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

server-git Reference implementation for the Git MCP server - src/git

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants