git: the string "null" for base_branch, contains or not_contains arrives as None (python-sdk#3055)

Open
#5,176 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
github, typescript

Research direction

Start in src/git and inspect its SDK lockfile and protocol tests for git_create_branch and git_branch. Check the Python SDK release that fixes python-sdk#3055, then add protocol coverage for base_branch, contains, and not_contains. Done means the fixed SDK release is locked and each test confirms the literal "null" reaches the tool as a string.

Written by the indexing model from the issue text.

Description

bug server-git v2 waiting-on-sdk

Since #5174 (#5175), the git server is built on MCPServer. Before validating arguments, the SDK's FuncMetadata.pre_parse_json JSON-decodes every string argument whose annotation is not exactly str. For the git server's three str | None parameters, that turns the literal string "null" into None:

Tool Parameter Effect of "null"
git_create_branch base_branch Branches from the current branch, not from a branch named null
git_branch contains The filter is silently dropped
git_branch not_contains The filter is silently dropped

All three advertise anyOf: [string, null], so "null" is a valid string value. Before #5175, the server received it unchanged.

Upstream: modelcontextprotocol/python-sdk#3055 (open), with the fix in python-sdk#3056. A comment there already reproduces this "null" → None case.

Done when

The SDK release that fixes python-sdk#3055 is locked in src/git, with a protocol test for each parameter showing that "null" reaches the tool as the string "null". Before then, a workaround in the server (declaring the parameters as str with a custom validator and a hand-written schema) is not wanted: these servers are meant to show the plain high-level API. Found in the Copilot review of #5175.

Dominant language
TypeScript
Stars
91.7k
Forks
11.9k
Avg merge
3h 30m
Merged PRs (30d)
204

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from modelcontextprotocol/servers

All issues in modelcontextprotocol/servers

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.