git-readonly-mcp
Provides read-only access to Git repositories, enabling inspection of history, diffs, refs, file contents, and repository status.
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-readonly-mcpShow me the diff between develop and main"
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 Readonly MCP
Gitの履歴、差分、参照、ファイル内容をAIセルフレビューへ渡すためのread-only MCPサーバーです。Kiro、Claude Code、Claude Desktop、VS Codeから、同じローカルstdioサーバーを利用できます。
任意のGitコマンド実行機能は公開しません。起動時に許可したworkspace folder、またはrepository root配下に対し、用途別の型付きツールだけを提供します。
Requirements
Node.js 20以上
Git 2.43以上を推奨
信頼できるローカルGitリポジトリ
Related MCP server: CodeAudit MCP
Build
npm ci
npm run check
npm run test:integration成果物は依存関係を含む単一ファイルです。
dist/git-readonly-mcp.mjs直接起動する場合:
node /path/to/git-readonly-mcp/dist/git-readonly-mcp.mjs \
--workspace-folder /path/to/frontend \
--workspace-folder /path/to/backend \
--repository-root /path/to/projects--workspace-folderを省略した場合は、プロセスの現在ディレクトリだけを候補にします。指定したfolder自体がGit worktreeのルートでなければ利用不可として一覧へ表示し、親や子のリポジトリは自動探索しません。
--repository-rootは、AIがgit_register_repositoryで後から登録できる親ディレクトリです。指定した親そのものと配下だけを許可し、symlinkを解決した実体が範囲外なら拒否します。任意パスを無制限に許可するoptionはありません。
Placement
個人で複数プロジェクトから利用する場合は、bundleをユーザーディレクトリへ1つだけ置く構成を推奨します。
~/.mcp/git-readonly/git-readonly-mcp.mjsMCP設定ではこのbundleを絶対パスで指定し、repositoryの許可範囲だけをclient側の--workspace-folderまたは--repository-rootで渡します。bundleの配置場所とGitへのアクセス許可は分離されています。プロジェクト内への配置は、teamで同じversionを固定し、設定もrepositoryで共有したい場合に適しています。
Client configuration
VS Code
単一root用の設定は .vscode/mcp.json に含まれています。multi-root workspaceでは、workspace folder名を明示します。
{
"servers": {
"git-readonly": {
"type": "stdio",
"command": "node",
"args": [
"/absolute/path/to/git-readonly-mcp.mjs",
"--workspace-folder",
"${workspaceFolder:Frontend}",
"--workspace-folder",
"${workspaceFolder:Backend}",
"--repository-root",
"${workspaceFolder}"
]
}
}
}Kiro
このリポジトリを直接開く場合の設定は .kiro/settings/mcp.json に含まれています。別プロジェクトから利用する場合はbundleとrepositoryを絶対パスで指定します。
提供する15ツールのうち、14個のGit参照ツールはread-onlyとしてautoApproveへ明示的に列挙しています。git_register_repositoryはserverが読める範囲を広げるため、自動承認から除外しています。
{
"mcpServers": {
"git-readonly": {
"command": "node",
"args": [
"/absolute/path/to/git-readonly-mcp.mjs",
"--repository-root",
"/absolute/path/to/projects"
],
"disabled": false,
"autoApprove": [
"git_list_repositories",
"git_status",
"git_log",
"git_show_commit",
"git_diff",
"git_range_diff",
"git_blame",
"git_grep",
"git_list_refs",
"git_list_tree",
"git_read_file",
"git_compare_refs",
"git_list_remotes",
"git_list_remote_refs"
]
}
}
}Claude Code
claude mcp add --transport stdio --scope project git-readonly -- \
node /absolute/path/to/git-readonly-mcp.mjs \
--workspace-folder /absolute/path/to/repositoryまたはproject rootの .mcp.json に設定します。
{
"mcpServers": {
"git-readonly": {
"type": "stdio",
"command": "node",
"args": [
"/absolute/path/to/git-readonly-mcp.mjs",
"--workspace-folder",
"/absolute/path/to/repository"
]
}
}
}Claude Desktop
Developer settingsの claude_desktop_config.json に同じstdio起動設定を追加します。
{
"mcpServers": {
"git-readonly": {
"type": "stdio",
"command": "node",
"args": [
"/absolute/path/to/git-readonly-mcp.mjs",
"--workspace-folder",
"/absolute/path/to/repository"
]
}
}
}Claude Desktop向けのワンクリック配布用 .mcpb は現在の成果物には含まれません。
Tools
Tool | Purpose |
| 設定済みfolderと |
| 許可されたroot配下のworktreeを登録 |
| branch、staged、unstaged、untracked状態を取得 |
| revision、期間、author、message、pathで履歴を検索 |
| commit metadata、stat、任意のpatchを取得 |
| working tree、index、2 revisionを比較 |
| 2つのcommit rangeを比較 |
| fileの行単位attributionを取得 |
| working tree、index、revisionの内容を検索 |
| branch、tag、remote-tracking refを一覧化 |
| revision時点のtreeを一覧化 |
| revision時点のbounded blobを取得 |
| merge baseとahead/behind件数を取得 |
| URLを開示せずremote名を一覧化 |
| 設定済みpublic anonymous HTTPS remoteのrefを取得 |
最初にgit_list_repositoriesを呼びます。対象が未登録ならgit_register_repositoryへpathを渡し、返されたrepositoryIdを以後のツールへ渡します。ツール結果はstructuredContentとJSON textの両方で返されます。
Security model
Gitはshellを介さず
spawnします。pager、external diff、textconv、credential helper、interactive prompt、optional lock、lazy fetchを抑止します。
revision rangeは個別parameterからサーバー側で構築します。
file pathはrepository-relative literalだけを許可します。
動的repository登録は、起動時の
--repository-rootをcanonical pathで検証した配下だけに制限します。local queryは既定15秒、blameとrange-diffは30秒、remote queryは10秒で停止します。
stdoutは1 MiB、stderrは64 KiBを上限とします。
remote問い合わせは設定済みremote名だけを受け取り、資格情報のないHTTPS URLかつpublic IPへ解決される場合だけ
ls-remoteを実行します。SSH、HTTP、file URL、private/local address、fetch、pull、push、cloneは許可しません。
このサーバーはsandboxではありません。Git自体が読むrepository metadataを含め、信頼できるworkspaceだけを登録してください。
Development
npm run dev -- --workspace-folder /path/to/repository
npm run lint
npm run typecheck
npm test
npm run build
npm run test:integration
npm run pack:dry-runMCP Inspectorで確認する場合:
npx @modelcontextprotocol/inspector node dist/git-readonly-mcp.mjs \
--workspace-folder /path/to/repositoryログはstderrへ出力してください。stdio MCPのstdoutへ診断メッセージを出すとJSON-RPC通信が壊れます。
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 Servers
- Alicense-qualityDmaintenanceSecure multi-source MCP server for reading local, GitHub, GitLab, Bitbucket, and network source code with read-only-by-default access, enabling AI assistants to inspect repositories safely.Last updated1MIT
- Alicense-qualityCmaintenanceA read-only MCP server for AI coding agents to inspect repositories, audit code quality, route engineering skills, and plan safe issue/PR workflows.Last updated1MIT
- Alicense-qualityDmaintenanceA lightweight MCP server that handles git operations on behalf of AI coding assistants, running as a local HTTP service without external network exposure by default.Last updatedMIT
- Alicense-qualityBmaintenanceA read-only MCP server that gives coding agents structured, read-only access to sibling repositories, ensuring security by design with zero write tools.Last updatedMIT
Related MCP Connectors
An MCP server that gives your AI access to the source code and docs of all public github repos
A MCP server built for developers enabling Git based project management with project and personal…
Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.
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/kazuki0529/git-readonly-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server