mcp-server-git: git_status and the git_diff tools print non-ASCII paths as octal escapes, so git_add cannot take them back
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 57/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- git, python
- Lĩnh vực
- backend, developer-experience
Hướng nghiên cứu
Read src/git/src/mcp_server_git/server.py, especially the git_status and diff tool implementations around the reported line 155. Reproduce with the supplied Python script and a filename containing non-ASCII characters; the issue also points to PR #4879 and four tests as reference. Done when status and all three diff tools return paths that can be passed to git_add.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Which server?
git (mcp-server-git)
Server version
2026.10.10, from v2/main at 2f8dc42
How did you run the server?
From a clone of this repository
Transport
stdio
Protocol era
Not sure. The repro calls the tool functions in-process, so it does not depend on the era.
MCP client and version
n/a, the tool functions were called directly from Python
Operating system and runtime
Linux, Python 3.10.21, git 2.43.0, GitPython 3.2.0
Server configuration
None beyond uv sync --frozen --dev in src/git.
Steps to reproduce
- In a fresh repository, create an untracked file named
日本.txt. - Call
git_status, strip the surrounding double quotes from the name it prints, and pass that name togit_add. - Save the script below as
repro.pyinsrc/gitand run it.
repro.py
import pathlib, subprocess, tempfile
import git
import mcp_server_git.server as s
d = pathlib.Path(tempfile.mkdtemp())
subprocess.run(["git", "init", "-q", str(d)], check=True)
r = git.Repo(d)
(d / "日本.txt").write_text("a\n")
print("--- git_status")
st = s.git_status(r)
print("\n".join(l for l in st.splitlines() if "Untracked" in l or ".txt" in l))
name = [l.strip() for l in st.splitlines() if ".txt" in l][0].strip('"')
r.git.add("日本.txt")
print("--- git_diff_staged (headers)")
print("\n".join(l for l in s.git_diff_staged(r).splitlines() if l.startswith("diff --git")))
r.git.rm("--cached", "-q", "日本.txt")
print("--- git_add with the name git_status printed")
try:
s.git_add(r, [name])
except Exception as e:
print(type(e).__name__ + ":", str(e).split("stderr: ")[-1].strip().strip("'"))
print("--- the same status with -c core.quotepath=false")
print("\n".join(l.strip() for l in r.git(c="core.quotepath=false").status().splitlines() if ".txt" in l))
$ uv run python repro.py # src/git at 2f8dc42
--- git_status
Untracked files:
"\346\227\245\346\234\254.txt"
--- git_diff_staged (headers)
diff --git "a/\346\227\245\346\234\254.txt" "b/\346\227\245\346\234\254.txt"
--- git_add with the name git_status printed
GitCommandError: fatal: pathspec '\346\227\245\346\234\254.txt' did not match any files
--- the same status with -c core.quotepath=false
日本.txt
Expected behavior
git_status and the three diff tools print 日本.txt, a name a client can pass back to git_add.
Actual behavior
src/git/src/mcp_server_git/server.py:155 calls repo.git.status() with git's default core.quotepath=true, so every non-ASCII path comes back as quoted octal escapes. git_diff_unstaged, git_diff_staged and git_diff do the same.
Already prototyped a fix?
#4879 by @tsurutanmen has the change and four tests for it, written against main. It runs the four commands with -c core.quotepath=false.
Before you submit
- I searched existing issues and this is not a duplicate.
- This is not a security vulnerability report (those go through the private advisory form).
@cliffhall could this go on the board for the git server?
- Ngôn ngữ chính
- TypeScript
- Star
- 91.4k
- Fork
- 11.8k
- Merge trung bình
- 6 giờ 39 phút
- Pull request đã merge (30 ngày)
- 146
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của modelcontextprotocol/servers
-
Clear the four CodeQL alerts in the release scripts (replaceAll for %2F, comment-line check)Đang mởchore v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
modelcontextprotocol/servers#5261 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
docs(git): clarify unconfined default scope and repository confinement options in README and CLIĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
modelcontextprotocol/servers#5231 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
docs(git): clarify unconfined default scope and repository confinement options in README and CLIĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
modelcontextprotocol/servers#5230 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
git: README should state plainly that without --repository every reachable repository is in scopeĐang mởdocumentation server-git v2
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 84/100
modelcontextprotocol/servers#5225 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
chore v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
modelcontextprotocol/servers#5223 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của modelcontextprotocol/servers
Issue tương tự
-
freshness freshness:observed-only
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
thoroc/context-radar#282 ·
-
bug P2 rust
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area: web
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
gabe-santana/arkdraw#25 ·
-
bug require-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
expressjs/expressjs.com#2549 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug good first issue hacktoberfest
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
codercops/discord-bot#101 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày