git-mcp-server: Instructions file for Codex

AGENTS.md

git-mcp-server AGENTS.md is an instructions file for Codex, OpenCode from jesspig/git-mcp-server. It costs 1,480 tokens per session, scanned A, original, MIT.

Repository instructions for developing git-mcp-server, a local service that gives an AI agent 29 Git tools for working with code repositories.

In plain words
What is it for?
Use them when changing, testing, packaging, or validating the git-mcp-server project.
Why use it?
They document the project's tests, linting, architecture rules, path checks, and precautions for destructive Git actions.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions AGENTS.md; mentions OpenCode.

This is jesspig/git-mcp-server's own configuration. It tells Codex and OpenCode how to work on git-mcp-server itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything git-mcp-server configures →

Reuse

Borrowing it

Nothing to install: this file belongs to jesspig/git-mcp-server. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/jesspig/git-mcp-server/master/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/jesspig/git-mcp-server

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for git-mcp-server AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/jesspig/git-mcp-server/agents-md/github.svg)](https://agentmods.dev/instructions/jesspig/git-mcp-server/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/jesspig/git-mcp-server/agents-md"><img src="https://agentmods.dev/badge/instructions/jesspig/git-mcp-server/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for git-mcp-server AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/jesspig/git-mcp-server/agents-md"><img src="https://agentmods.dev/badge/instructions/jesspig/git-mcp-server/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,480 This file is loaded in full into every session.
When invoked 1,480 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01480 $0.01480
Opus 5.5 $0.00592 $0.00592
Sonnet 5.5 $0.00296 $0.00296
Haiku 4.5 $0.00148 $0.00148

Measured 2mo ago against content hash bcb7c7609ee6, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

git-mcp-server AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 66 lines

How it starts

The opening of the file, as written. The whole thing — 66 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md

项目定位

本地 Git MCP 服务器(stdio 传输):29 个 git 工具经 GitPython 暴露为 MCP 工具,返回文本结果。不发布 PyPI,入口 [project.scripts] git-mcp-server = "main:main"。工具清单见 schemas.TOOL_MODELS(用户已确认工具范围,勿增减)。

开发命令

  • 全量测试:uv run pytest tests -q(164 个,约 2.5 分钟)
  • 单模块:uv run pytest tests/test_branch.py -q
  • lint:uv run ruff check .(零告警为验收标准)
  • 启动验证:uvx --from . git-mcp-server(.opencode/opencode.json 已以此方式自举接入本仓库)

架构关键点(易踩坑)

  • 非包结构:所有模块为顶层 .py(setuptools py-modules)。新增 .py 必须同步 pyproject.toml 的 py-modules 列表,否则打包丢失
  • 注册表驱动:schemas.py 的 TOOL_MODELS 是工具权威清单,server.py 用 getattr(tools, name) 分发。新增/改名工具必须同步 3 处:TOOL_MODELS + tools.py 聚合 re-export + server.py 顶部 READONLY_TOOLS/DESTRUCTIVE_TOOLS 注解集合
  • docstring 第一段 = MCP 工具描述:server.py _tool_description 取 doc.strip().split("\n\n")[0]。工具 docstring 第一段必须自包含:摘要 + Best for: + Returns: + 提示,段内用换行不用空行;空行后的 Args 等不进 MCP 描述
  • 路径校验分流(server.py call_tool):git_init/git_clone 走 validate_target_path(目标可不存在);git_worktree(add/remove 且带 worktree_path)额外走 validate_target_path(worktree_path);其余含 repo_path 的工具走 validate_repo_path(要求存在)。GIT_MCP_ALLOWED_DIRS 未设置时回退服务器工作目录为隐式沙箱
  • repo_path 默认:所有工具 repo_path/local_path 默认 "."(服务器工作目录),agent 可省略
  • 破坏性工具 preview 两阶段:git_reset/git_checkout(force)/git_clean 支持 preview(或 dry_run)先行查看影响,confirmed=True 才执行;preview 优先于 confirmed(预览不执行、不要求 confirmed)
  • 错误约定:工具抛 ValueError(消息英文,四要素:事实·位置·期望);server 层统一转 is_error:ValueError/ValidationError 原样文本、GitError/OSError 加 Git operation failed: 前缀、兜底 Unexpected error: ...。禁止让未捕获异常击穿连接
  • 空目录校验:git_init/git_clone/git_worktree 统一走 security.prepare_dir(path_str, what, create)(create=True 时自动 mkdir,False 时缺失即通过)
  • detached HEAD:repo.head.ref 在 detached 时抛 TypeError,须用 repo.head.is_detached 判断(git_branch 已示范)

破坏性确认(confirmed 参数)

8 个工具带 confirmed 参数,未传 True 时抛 ValueError:

工具 条件
git_clean 必需(dry_run=True 预览可免;无 force 参数)
git_reset 必需
git_branch delete 时
git_tag delete 时
git_stash drop 时
git_worktree remove 时
git_push force=True 时
git_checkout force=True 时

Read the full file on GitHub · 66 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 66 lines · 1,480 tokens per session scan A bcb7c7609ee6

Subscribe to this mod's changes

git-mcp-server AGENTS.md is an instructions file published in the GitHub repository jesspig/git-mcp-server (0 stars, last pushed 3mo ago), licensed MIT. It adds 1,480 tokens to every session, about $0.0059 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

git-mcp-server AGENTS.md compared with instructions from other repositories

git-mcp-server AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
git-mcp-server AGENTS.mdjesspig/git-mcp-serverInstructions file03mo agoMITA1,480Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode