by cyanheads
An MCP (Model Context Protocol) server enabling LLMs and AI agents to interact with Git repositories. Provides tools for comprehensive Git operations including clone, commit, branch, diff, log, status, push, pull, merge, rebase, worktree, tag management, and more, via the MCP standard. STDIO & HTTP.
# Add to your Claude Code skills
git clone https://github.com/cyanheads/git-mcp-server28 git operations organized into seven categories:
| Category | Tools | Description |
| :------------------------ | :----------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------- |
| Repository Management | git_init, git_clone, git_status, git_clean | Initialize repos, clone from remotes, check status, clean untracked files |
| Staging & Commits | , , | Stage changes, create commits, compare changes |
| | , , , | View commit history, inspect objects, trace authorship, view ref logs |
| | | Gather git context and instructions for LLM-driven changelog analysis |
| | , , , , | Manage branches, switch contexts, integrate changes, apply specific commits |
| | , , , | Configure remotes, fetch updates, synchronize repositories, publish changes |
| | , , , , , , | Tag releases, stash changes, reset state, manage worktrees, set/clear session directory |
No comments yet. Be the first to share your thoughts!
git_addgit_commitgit_diffgit_loggit_showgit_blamegit_refloggit_changelog_analyzegit_branchgit_checkoutgit_mergegit_rebasegit_cherry_pickgit_remotegit_fetchgit_pullgit_pushgit_taggit_stashgit_resetgit_worktreegit_set_working_dirgit_clear_working_dirgit_wrapup_instructions| Resource | URI | Description |
| :------------------------ | :------------------------ | :-------------------------------------------------------------------- |
| Git Working Directory | git://working-directory | The current session working directory, set via git_set_working_dir. |
| Prompt | Description | Parameters |
| :-------------- | :---------------------------------------------------------------------------------------- | :--------------------------------------------------------------------- |
| Git Wrap-up | Workflow protocol for completing git sessions: review, document, commit, and tag changes. | changelogPath, skipDocumentation, createTag, updateAgentFiles. |
Works with both Bun and Node.js. Runtime is auto-detected.
| Runtime | Command | Minimum Version |
| ----------- | --------------------------------------- | --------------- |
| Node.js | npx @cyanheads/git-mcp-server@latest | >= 20.0.0 |
| Bun | bunx @cyanheads/git-mcp-server@latest | >= 1.2.0 |
Add the following to your MCP client config (e.g., cline_mcp_settings.json). Update the environment variables to match your setup — especially the git identity fields.
{
"mcpServers": {
"git-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["@cyanheads/git-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info",
"GIT_BASE_DIR": "~/Developer/",
"LOGS_DIR": "~/Developer/logs/git-mcp-server/",
"GIT_USERNAME": "cyanheads",
"GIT_EMAIL": "casey@caseyjhand.com",
"GIT_SIGN_COMMITS": "true"
}
}
}
}
Bun users: replace "command": "npx" with "command": "bunx".
For Streamable HTTP, set MCP_TRANSPORT_TYPE=http and MCP_HTTP_PORT=3015.
Built on mcp-ts-template.
| Feature | Details |
| :--------------------------- | :------------------------------------------------------------------------------------------------------------------ |
| Declarative tools | Define capabilities in single, self-contained files. The framework handles registration, validation, and execution. |
| Error handling | Unified McpError system for consistent, structured error responses. |
| Authentication | Supports none, jwt, and oauth modes. |
| Pluggable storage | Swap backends (in-memory, filesystem, Supabase, Cloudflare KV/R2) without changing business logic. |
| Observability | Structured logging (Pino) and optional auto-instrumented OpenTelemetry for traces and metrics. |
| Dependency injection | Built with tsyringe for decoupled, testable architecture. |
| Cross-runtime | Auto-detects Bun or Node.js and uses the appropriate process spawning method. |
| Provider architecture | Pluggable git provider system. Current: CLI. Planned: isomorphic-git for edge deployment. |
| Working directory management | Session-specific directory context for multi-repo workflows. |
| Configurable git identity | Override author/committer info via environment variables, with fallback to global git config. |
| Commit signing | Optional GPG/SSH signing for commits, merges, rebases, cherry-picks, and tags. |
| Safety | Destructive operations (git clean, git reset --hard) require explicit confirmation flags. |
GIT_BASE_DIR restricts operations to a specific directory tree for multi-tenant sandboxing.RateLimiter service.All configuration is validated at startup in src/config/index.ts. Key environment variables:
| Variable | Description | Default |
| :----------------------------- | :----------------------------------------------------------------------------------------- | :---------- |
| MCP_TRANSPORT_TYPE | Transport: stdio or http. | stdio |
| MCP_SESSION_MODE | HTTP session mode: stateless, stateful, or auto. | auto |
| MCP_RESPONSE_FORMAT | Response format: json (LLM-optimized), markdown (human-readable), or auto. | json |
| MCP_RESPONSE_VERBOSITY | Detail level: minimal, standard, or full. | standard |
| MCP_HTTP_PORT | HTTP server port. | 3015 |
| MCP_HTTP_HOST | HTTP server hostname. | 127.0.0.1 |
| MCP_HTTP_ENDPOINT_PATH | MCP request endpoint path. | /mcp |
| MCP_AUTH_MODE | Authentication mode: none, jwt, or oauth. | none |
| STORAGE_PROVIDER_TYPE | Storage backend: in-memory, filesystem, supabase, cloudflare-kv, r2. | in-memory |
| OTEL_ENABLED