Git MCP — Version Control Server for AI Agents
MCP server that gives AI agents full Git capabilities. Git MCP enables Claude Code and Cursor to manage repositories, branches, commits, diffs, and history via tool calls.
这个资产会安全暂存
这个资产会先安全暂存。复制的指令会要求 Agent 读取暂存文件,并在激活脚本、MCP 配置或全局配置前先确认。
npx -y tokrepo@latest install 85eacf96-3b2b-43f5-ad6f-fd4413ad0b69 --target codex先暂存文件;激活前需要读取暂存 README 和安装计划。
What it is
Git MCP is a Model Context Protocol server that gives AI agents full Git capabilities. It enables Claude Code, Cursor, and other MCP-compatible tools to manage repositories, branches, commits, diffs, and history through structured tool calls rather than raw shell commands.
Developers who use AI coding agents for automated development workflows benefit from Git MCP. It provides a safe, structured interface for version control operations that agents can invoke without parsing command-line output.
How it saves time or tokens
Without Git MCP, agents must execute raw git commands via shell and parse text output. Git MCP provides structured JSON responses, eliminating parsing errors and reducing the token overhead of interpreting unstructured terminal output. The workflow estimates approximately 3,600 tokens per session.
How to use
- Install the Git MCP server in your MCP configuration.
- Point it at a local repository path.
- Your AI agent can now call Git tools like
git_status,git_commit,git_diff, andgit_log.
{
"mcpServers": {
"git": {
"command": "uvx",
"args": ["mcp-server-git", "--repository", "/path/to/repo"]
}
}
}
Example
Once configured, an AI agent can check the repository status and create a commit:
Tool call: git_status
Result: { 'modified': ['src/main.py'], 'untracked': ['tests/test_new.py'] }
Tool call: git_add, files: ['src/main.py', 'tests/test_new.py']
Tool call: git_commit, message: 'Add new test file for main module'
Related on TokRepo
- MCP GitHub integration — GitHub-specific MCP server for issues, PRs, and more
- AI coding tools — Tools that enhance AI-assisted development
Common pitfalls
- Git MCP operates on local repositories. Remote operations like push and fetch may require SSH key or credential configuration.
- Agents may create excessive commits without guidance. Set clear commit policies in your agent instructions.
- Ensure the MCP server has appropriate file system permissions for the target repository.
常见问题
Any MCP-compatible AI tool can use Git MCP. This includes Claude Code, Cursor, Cline, and other editors or agents that implement the Model Context Protocol for tool use.
Git MCP focuses on local Git operations (commits, branches, diffs, log). For GitHub-specific features like pull requests, issues, and code review, use the separate GitHub MCP server.
Git MCP exposes the conflict state through status and diff tools. The AI agent can read conflicted files and resolve them, but the resolution logic depends on the agent's capabilities rather than Git MCP itself.
Git MCP performs real Git operations. It is as safe as giving any tool write access to your repository. Use it on development branches and ensure your agent instructions include safeguards against force pushes or destructive operations.
Install via uvx (Python) or npx (Node.js) depending on the implementation. Add the server configuration to your MCP settings file with the repository path as an argument.
引用来源 (3)
- MCP Servers Repository— Git MCP enables AI agents to manage repositories via tool calls
- MCP Specification— Model Context Protocol provides structured tool interfaces for AI agents
- Anthropic Claude Code Docs— Claude Code supports MCP servers for extended tool capabilities
来源与感谢
modelcontextprotocol/servers — Official MCP servers
讨论
相关资产
WhatsApp MCP Server — Chat with WhatsApp via AI Agents
MCP server connecting Claude and AI agents to your personal WhatsApp. Search contacts, read messages, send replies and media via natural language.
Apify MCP Server — 8,000+ Web Scrapers for Agents
Apify MCP Server connects agents to Apify Actors via a hosted endpoint (mcp.apify.com) or local run, turning thousands of web scrapers into callable tools.
WinRemote MCP — Remote Windows Control Server
WinRemote MCP is a Windows MCP server you run on the target machine, exposing desktop automation, process control, and file operations to MCP clients.
GitHub MCP — Repository Management for AI Agents
Official GitHub MCP server that gives AI agents access to repos, issues, PRs, code search, and Actions. Create branches, review PRs, and manage projects via natural language. 5,000+ stars.