git-mcp
This server lets an AI agent inspect and modify a local Git repository and its files through MCP tools.
Git inspection:
get_status(current branch and working-tree changes),get_log(recent commit history),get_branches(local/remote branches)Git modifications:
create_commit(stage specified paths or all changes, then commit with a message)File inspection:
list_dir(list directory entries),read_file(read file content, optionally truncated),file_info(size, type, modification metadata)File modification:
write_file(write content to a file)Flexible repository targeting: most Git tools accept an optional
repo_path; file tools operate relative to the workspace by default
Provides tools for inspecting and interacting with a local Git repository, including status, log, branches, and creating commits.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@git-mcpshow me the current git status and recent commits"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
git-mcp
An MCP server that lets an AI agent inspect and interact with a local Git repository.
Features
Git tools: status, log, branches, create commits (via GitPython)
File tools: list, read, write, inspect files in the workspace
Agent-ready: exposes everything as MCP tools that an LLM agent (LangGraph) can call
Related MCP server: Git MCP Server
Install
uv syncInstalls the server plus its LangGraph client dependencies.
Run the server
uv run project-mcpOr as a stdio MCP server (what MCP clients spawn):
uv run python -m project_mcp.serverYou can attach any MCP client — e.g. MCP Inspector (npx @modelcontextprotocol/inspector) with command uv run python -m project_mcp.server.
Tools
Git
get_status— current branch and working-tree changesget_log— recent commit historyget_branches— local and remote branchesgit_diff— working-tree / staged / between-commit diffsgit_add— stage changes (explicit paths or all)git_commit— commit staged changesgit_push— push the current branch to a remotecreate_commit— stage-and-commit shortcut
Files
list_dir— list directory entriesread_file— read file content (optional truncation)write_file— write content to a filefile_info— size, type, and modification metadata
Example: LangGraph agent with an LLM (v2)
examples/langgraph_client.py is a LangGraph agent that spawns the MCP server over stdio, exposes its tools to a model, and answers your questions by calling them.
It talks to OpenRouter by default (no OpenAI key needed) and works with any OpenAI-compatible /v1/chat/completions endpoint.
Configure
cp .env.example .env
# edit .env -> set API_TOKEN (required).env is loaded from the project root (gitignored). Settings:
API_TOKEN— your OpenRouter API key (https://openrouter.ai/keys), or a bearer token for another endpoint.MODEL_URL— OpenAI-compatible base URL. Defaults tohttps://openrouter.ai/api/v1; override for HF endpoints, llama.cpp (http://localhost:8080/v1), vLLM (http://localhost:8000/v1), LiteLLM, etc.MODEL_NAME— model id. Defaultopenrouter/free(route to a free model). Others:openai/gpt-4o-mini,z-ai/glm-5.2:free, etc.
Run
Ask via CLI arg:
uv run python examples/langgraph_client.py "What is the current git status?"
uv run python examples/langgraph_client.py "Show me the last 3 commits"Or interactively (no arg → prompts you):
uv run python examples/langgraph_client.py
Ask about the repo:The client uses langchain-mcp-adapters, which pins the MCP SDK to v1 (mcp<2).
Example: guarded agent with an LLM intent classifier + safety gate (v3)
examples/langgraph_client_v3.py is the v3 agent. It sits between the LLM and the tools and runs every tool call through an intent classifier and a permission/safety gate:
Intent
|
v
Permission/Safety Gate
|-- read -> automatic
|-- modify file -> approval (interactive y/N)
|-- git add -> approval (interactive y/N)
|-- commit -> approval (interactive y/N)
`-- push -> BLOCKED (only --allow-push unlocks it)How it works:
LLM intent classifier (
project_mcp.safety.IntentClassifier) classifies each tool call (name+args) into one ofread/modify_file/git_add/commit/push. It asks the configured model first and falls back to a deterministic rule map when no model is configured or the answer is unparseable.Safety gate (
project_mcp.safety.PermissionGate) enforces the policy:read→ allowed automatically.modify_file/git_add/commit→ prompts[y/N]in an interactive terminal. Denied in non-interactive runs unless--yesis passed.push→ blocked by default; only--allow-pushexplicitly lifts the block.unknown intent → treated like an approval-gated write.
The agent can only reach the MCP server if the gate returns allow; otherwise it gets a
PERMISSION DENIEDtool message to explain itself.
Run
# read-only: no prompt (auto-allowed)
uv run python examples/langgraph_client_v3.py "What is the current git status?"
# write path: interactive y/N approval (or --yes to auto-approve)
uv run python examples/langgraph_client_v3.py "Add notes.txt and commit it"
uv run python examples/langgraph_client_v3.py "Add notes.txt and commit it" --yes
# push: blocked unless explicitly unlocked
uv run python examples/langgraph_client_v3.py "Push to origin" # BLOCKED
uv run python examples/langgraph_client_v3.py "Push to origin" --allow-push # allowedThe gate lives in the client (the standard-official place for interactive
approval). The same IntentClassifier / PermissionGate classes are reusable:
wire them into any agent loop, or point --yes at a non-interactive CI run.
Observability (Opik)
Set OPIK_API_KEY in .env (or OPIK_URL for a self-hosted Opik server) and
the v3 agent auto-instruments Comet Opik:
Every LangGraph run is a trace tagged
main-llm— agent reasoning + MCP tool inputs/outputs.Every gate decision is a
guardrail-typed span taggedsecuritywith{tool, args}as input and{intent, permission, allowed, reason}as output.
uv add opik # dependency already in pyproject.toml
cp .env.example .env # already done? set OPIK_API_KEY
uv run python examples/langgraph_client_v3.py "What changed?" # -> logged to OpikDisable tracing per-run with --no-trace. If neither OPIK_API_KEY nor
OPIK_URL is set, every observability helper is a no-op and the agent runs
identically (zero added latency/calls).
Development
uv run pytestLayout:
src/project_mcp/ package source (server, git_tools, file_tools, safety)
tests/ pytest tests (unit + stdio MCP integration)
examples/ LangGraph agent clients (v2 plain, v3 guarded)
.env.example model endpoint config templateSummary: v1 vs v2 vs v3
This project shows three ways to consume the same MCP server.
v1 — MCP Inspector
A lightweight GUI/debugging client that inspects a server interactively.
Lets you browse tools, see schemas, and fire individual calls by hand.
Good for validating a server's surface before wiring an agent.
Connection: stdio spawn of
project_mcp.servervia inspector config.
v2 — LangGraph + OpenRouter
A programmatic agent that connects to the server, grabs its tools, and lets an LLM decide which to call to answer a user question.
Adds an actual model (OpenRouter
openrouter/freeby default) on top of the MCP tool surface.Reusable pattern: MCP server → LangChain tools → LangGraph ReAct agent with any open-source/OpenAI-compatible model.
Uses
langchain-mcp-adapters, hencemcp<2.
v3 — LLM intent classifier + permission/safety gate
Same agent loop as v2, plus a guard layer between the model and the tools.
Every tool call is classified into an intent (
read/modify_file/git_add/commit/push) by a dedicated LLM pass, then checked against the safety policy: reads run automatically, writes/adds/commits need approval, and pushes are blocked unless explicitly unlocked (--allow-push).The classification + gating logic lives in
project_mcp.safetyand is fully unit-tested, so another client or UI can reuse the same gate.
Note:
langchain-mcp-adapterscurrently only supports MCP SDK v1, which is why the project stays onmcp<2. If you need the newer MCP SDK v2 (MCPServerAPI), the LangChain adapter has no stable release for it yet.
Available Tools
8 toolscreate_commitD
| Name | Required | Description | Default |
|---|---|---|---|
| paths | No | ||
| add_all | No | ||
| message | No | ||
| repo_path | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Tool has no description.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Tool has no description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Tool has no description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Tool has no description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Tool has no description.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Tool has no description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
file_infoD
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Tool has no description.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Tool has no description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Tool has no description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Tool has no description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Tool has no description.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Tool has no description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_branchesD
| Name | Required | Description | Default |
|---|---|---|---|
| repo_path | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Tool has no description.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Tool has no description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Tool has no description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Tool has no description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Tool has no description.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Tool has no description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_logD
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | ||
| repo_path | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Tool has no description.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Tool has no description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Tool has no description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Tool has no description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Tool has no description.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Tool has no description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_statusD
| Name | Required | Description | Default |
|---|---|---|---|
| repo_path | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Tool has no description.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Tool has no description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Tool has no description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Tool has no description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Tool has no description.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Tool has no description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_dirD
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | . |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Tool has no description.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Tool has no description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Tool has no description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Tool has no description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Tool has no description.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Tool has no description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
read_fileD
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| max_chars | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Tool has no description.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Tool has no description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Tool has no description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Tool has no description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Tool has no description.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Tool has no description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
write_fileD
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| content | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Tool has no description.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Tool has no description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Tool has no description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Tool has no description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Tool has no description.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Tool has no description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
The tools fall into two clear groups—Git operations (get_status, get_log, get_branches, create_commit) and file operations (list_dir, read_file, write_file, file_info)—with no meaningful overlap. Each name points to a distinct resource and action, so an agent should rarely misselect.
Most tools follow a consistent verb_noun pattern (get_status, get_log, get_branches, create_commit, list_dir, read_file, write_file). file_info is the one outlier because it uses noun_info rather than a verb, but the rest of the set remains predictable.
Eight tools is a well-scoped size for a lightweight Git and file manipulation server. Each tool covers a distinct, useful operation without redundancy or bloat.
The set supports a coherent workflow: inspect repository state, browse/edit files, and create commits. It lacks branch creation/checkout and diff/staging operations, but the core status/log/branches/commit/file surface is functional for basic Git workflows.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
A MCP server built for developers enabling Git based project management with project and personal…
An MCP server that gives your AI access to the source code and docs of all public github repos
AI-native git hosting — repos, PRs, issues, CI gates, and AI code review over MCP (60 tools).
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceA lightweight MCP server that enables AI assistants to manage local Git repositories by executing commands like status, add, and commit. It streamlines development workflows by providing repository context and diffs directly to the assistant.
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides tools for interacting with Git repositories, enabling AI assistants to manage repositories, branches, commits, and files through a standardized interface.7,3891Apache 2.0
- AlicenseNot gradedqualityCmaintenanceAn MCP server that gives AI agents git repository access: status, log, diff, branch, commit, push, pull, tag, stash, remotes — 24 tools, zero dependencies, pure Python stdlib (subprocess).MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that gives AI assistants deep understanding of your local Git repositories, providing instant repo overviews, change summaries, blame analysis, changelogs, branch health checks, and history search.62MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/prashant-ai-lab/git-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server