Git MCP Server

Git MCP Server

A secure and scalable Git MCP server giving AI agents powerful version control for local and (soon) serverless environments.

Category
访问服务器

README

<div align="center"> <h1>mcp-server-git</h1> <p><b>A secure and scalable Git MCP server giving AI agents powerful version control for local and (soon) serverless environments. STDIO & Streamable HTTP</b> <div>27 Tools • 1 Resource • 1 Prompt</div> </p> </div>

<div align="center">

Version MCP Spec MCP SDK License Status TypeScript Bun

</div>


🛠️ Tools Overview

This server provides 27 comprehensive Git operations organized into six functional categories:

Category Tools Description
Repository Management git_init, git_clone, git_status, git_clean Initialize repos, clone from remotes, check status, and clean untracked files
Staging & Commits git_add, git_commit, git_diff Stage changes, create commits, and compare changes
History & Inspection git_log, git_show, git_blame, git_reflog View commit history, inspect objects, trace line-by-line authorship, and view ref logs
Branching & Merging git_branch, git_checkout, git_merge, git_rebase, git_cherry_pick Manage branches, switch contexts, integrate changes, and apply specific commits
Remote Operations git_remote, git_fetch, git_pull, git_push Configure remotes, download updates, synchronize repositories, and publish changes
Advanced Workflows git_tag, git_stash, git_reset, git_worktree, git_set_working_dir, git_clear_working_dir, git_wrapup_instructions Tag releases, stash changes, reset state, manage worktrees, set/clear session directory, and access workflow guidance

📦 Resources Overview

The server provides resources that offer contextual information about the Git environment:

Resource URI Description
Git Working Directory git://working-directory Provides the current session working directory for git operations. This is the directory set via git_set_working_dir and used as the default.

🎯 Prompts Overview

The server provides structured prompt templates that guide AI agents through complex workflows:

Prompt Description Parameters
Git Wrap-up A systematic workflow protocol for completing git sessions. Guides agents through reviewing, documenting, committing, and tagging changes. changelogPath, skipDocumentation, createTag, and updateAgentFiles.

🚀 Getting Started

Runtime Compatibility

This server works with both Bun and Node.js runtimes:

Runtime Command Minimum Version Notes
Bun bunx git-mcp-server@latest ≥ 1.2.0 Native Bun runtime (optimal performance)
Node.js npx git-mcp-server@latest ≥ 20.0.0 Via npx/bunx (universal compatibility)

The server automatically detects the runtime and uses the appropriate process spawning method for git operations.

MCP Client Settings/Configuration

Add the following to your MCP Client configuration file (e.g., cline_mcp_settings.json). Clients have different ways to configure servers, so refer to your client's documentation for specifics.

Be sure to update environment variables as needed (especially your Git information!)

Using Bun (bunx)

{
  "mcpServers": {
    "git-mcp-server": {
      "type": "stdio",
      "command": "bunx",
      "args": ["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": "your-username",
        "GIT_EMAIL": "your-email@example.com",
        "GIT_SIGN_COMMITS": "false"
      }
    }
  }
}

Using Node.js (npx)

{
  "mcpServers": {
    "git-mcp-server": {
      "type": "stdio",
      "command": "npx",
      "args": ["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": "your-username",
        "GIT_EMAIL": "your-email@example.com",
        "GIT_SIGN_COMMITS": "false"
      }
    }
  }
}

Streamable HTTP Configuration

MCP_TRANSPORT_TYPE=http
MCP_HTTP_PORT=3015

Important: when running in STDIO mode (or HTTP mode launched without a TTY), the server disables ANSI color output by setting NO_COLOR=1 and FORCE_COLOR=0 to ensure clean MCP client streams. You generally do not need to set these manually.

✨ Server Features

This server provides a comprehensive feature set:

  • Declarative Tools: Define agent capabilities in single, self-contained files. The framework handles registration, validation, and execution.
  • Robust Error Handling: A unified McpError system ensures consistent, structured error responses.
  • Pluggable Authentication: Secure your server with zero-fuss support for none, jwt, or oauth modes.
  • Abstracted Storage: Swap storage backends (in-memory, filesystem, Supabase, Cloudflare KV/R2) without changing business logic.
  • Full-Stack Observability: Deep insights with structured logging (Pino) and optional, auto-instrumented OpenTelemetry for traces and metrics.
  • Dependency Injection: Built with tsyringe for a clean, decoupled, and testable architecture.
  • Edge-Ready Architecture: Built on an edge-compatible framework that runs seamlessly on local machines or Cloudflare Workers. Note: Current git operations use the CLI provider which requires local git installation. Edge deployment support is planned through the isomorphic-git provider integration.

Plus, specialized features for Git integration:

  • Cross-Runtime Compatibility: Works seamlessly with both Bun and Node.js runtimes. Automatically detects the runtime and uses optimal process spawning (Bun.spawn in Bun, child_process.spawn in Node.js).
  • Provider-Based Architecture: Pluggable git provider system with current CLI implementation and planned isomorphic-git provider for edge deployment.
  • Optimized Git Execution: Direct git CLI interaction with cross-runtime support for high-performance process management, streaming I/O, and timeout handling (current CLI provider).
  • Comprehensive Coverage: 27 tools covering all essential Git operations from init to push.
  • Working Directory Management: Session-specific directory context for multi-repo workflows.
  • Configurable Git Identity: Override author/committer information via environment variables with automatic fallback to global git config.
  • Safety Features: Explicit confirmations for destructive operations like git clean and git_reset --hard.
  • Commit Signing & Identity: Support for controlling commit signing and identity via environment variables (e.g., GIT_USERNAME, GIT_EMAIL, GIT_SIGN_COMMITS) with sensible fallbacks.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选