Logo de Git MCP 服务器

Git MCP 服务器

Comunidade
cyanheads

A Git MCP server for AI agents. STDIO & Streamable HTTP.

Publicado porcyanheads
Repositóriogit-mcp-server
IdiomaTypeScript
Forks
57
Estrelas
241
Ferramentas disponíveis
28
Tipo de transportestdio
Categorias
LicençaApache-2.0
Links
  • Conecte ferramentas a fluxos de trabalho de IA

    Git MCP 服务器 disponibiliza recursos MCP que podem ser usados por clientes e agentes de IA compatíveis.

  • 28 ferramentas disponíveis

    Confira abaixo as ações que podem ser chamadas, incluindo nomes e descrições quando fornecidos pelo servidor.

  • Configuração pronta para copiar

    Use os exemplos de instalação para configurar este servidor no seu cliente MCP preferido.

  • Indicadores da comunidade de código aberto

    241 estrelas e 57 forks no repositório vinculado.

Version MCP Spec MCP SDK License Status TypeScript Bun


Tools

28 git operations organized into seven categories:

CategoryToolsDescription
Repository Managementgit_init, git_clone, git_status, git_cleanInitialize repos, clone from remotes, check status, clean untracked files
Staging & Commitsgit_add, git_commit, git_diffStage changes, create commits, compare changes
History & Inspectiongit_log, git_show, git_blame, git_reflogView commit history, inspect objects, trace authorship, view ref logs
Analysisgit_changelog_analyzeGather git context and instructions for LLM-driven changelog analysis
Branching & Merginggit_branch, git_checkout, git_merge, git_rebase, git_cherry_pickManage branches, switch contexts, integrate changes, apply specific commits
Remote Operationsgit_remote, git_fetch, git_pull, git_pushConfigure remotes, fetch updates, synchronize repositories, publish changes
Advanced Workflowsgit_tag, git_stash, git_reset, git_worktree, git_set_working_dir, git_clear_working_dir, git_wrapup_instructionsTag releases (list/create/delete/verify), stash changes, reset state, manage worktrees, set/clear session directory

Resources

ResourceURIDescription
Git Working Directorygit://working-directoryThe current session working directory, set via git_set_working_dir.

Prompts

PromptDescriptionParameters
Git Wrap-upWorkflow protocol for completing git sessions: review, document, commit, and tag changes.changelogPath, createTag.

Getting started

Runtime

Works with both Bun and Node.js. Runtime is auto-detected.

RuntimeCommandMinimum Version
Node.jsnpx @cyanheads/git-mcp-server@latest>= 20.0.0
Bunbunx @cyanheads/git-mcp-server@latest>= 1.2.0

MCP client configuration

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.

json
{
  "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.

Features

Built on mcp-ts-template.

FeatureDetails
Declarative toolsDefine capabilities in single, self-contained files. The framework handles registration, validation, and execution.
Error handlingUnified McpError system for consistent, structured error responses.
AuthenticationSupports none, jwt, and oauth modes.
Pluggable storageSwap backends (in-memory, filesystem, Supabase, Cloudflare KV/R2) without changing business logic.
ObservabilityStructured logging (Pino) and optional auto-instrumented OpenTelemetry for traces and metrics.
Dependency injectionBuilt with tsyringe for decoupled, testable architecture.
Cross-runtimeAuto-detects Bun or Node.js and uses the appropriate process spawning method.
Provider architecturePluggable git provider system. Current: CLI. Planned: isomorphic-git for edge deployment.
Working directory managementSession-specific directory context for multi-repo workflows.
Configurable git identityOverride author/committer info via environment variables, with fallback to global git config.
Commit signingGPG/SSH signing (enabled by default) for commits, merges, rebases, cherry-picks, and tags. Silent fallback to unsigned on failure with signed/signingWarning fields in responses.
SafetyDestructive operations (git clean, git reset --hard) require explicit confirmation flags.

Security

  • All file paths are validated and sanitized to prevent directory traversal.
  • Optional GIT_BASE_DIR restricts operations to a specific directory tree for multi-tenant sandboxing.
  • Git commands use validated arguments via process spawning — no shell interpolation.
  • JWT and OAuth support for authenticated deployments.
  • Optional rate limiting via the DI-managed RateLimiter service.
  • All operations are logged with request context for auditing.

Configuration

All configuration is validated at startup in src/config/index.ts. Key environment variables:

VariableDescriptionDefault
MCP_TRANSPORT_TYPETransport: stdio or http.stdio
MCP_SESSION_MODEHTTP session mode: stateless, stateful, or auto.auto
MCP_RESPONSE_FORMATResponse format: json (LLM-optimized), markdown (human-readable), or auto.json
MCP_RESPONSE_VERBOSITYDetail level: minimal, standard, or full.standard
MCP_HTTP_PORTHTTP server port.3015
MCP_HTTP_HOSTHTTP server hostname.127.0.0.1
MCP_HTTP_ENDPOINT_PATHMCP request endpoint path./mcp
MCP_AUTH_MODEAuthentication mode: none, jwt, or oauth.none
STORAGE_PROVIDER_TYPEStorage backend: in-memory, filesystem, supabase, cloudflare-kv, r2.in-memory
OTEL_ENABLEDEnable OpenTelemetry.false
MCP_LOG_LEVELMinimum log level: debug, info, warn, error.info
GIT_SIGN_COMMITSGPG/SSH signing for commits, merges, rebases, cherry-picks, and tags. Falls back to unsigned on failure (see response signed/signingWarning).true
GIT_AUTHOR_NAMEGit author name. Aliases: GIT_USERNAME, GIT_USER. Falls back to global git config.(none)
GIT_AUTHOR_EMAILGit author email. Aliases: GIT_EMAIL, GIT_USER_EMAIL. Falls back to global git config.(none)
GIT_BASE_DIRAbsolute path to restrict all git operations to a specific directory tree.(none)
GIT_WRAPUP_INSTRUCTIONS_PATHPath to custom markdown file with workflow instructions.(none)
MCP_AUTH_SECRET_KEYRequired for jwt auth. 32+ character secret key.(none)
OAUTH_ISSUER_URLRequired for oauth auth. OIDC provider URL.(none)

Running the server

Via package manager (no install)

sh
npx @cyanheads/git-mcp-server@latest

Configure through environment variables or your MCP client config.

Local development

sh
# Build and run
npm run rebuild
npm run start:stdio   # or start:http

# Dev mode with hot reload
npm run dev:stdio     # or dev:http

# Checks and tests
npm run devcheck      # lint, format, typecheck
npm test

Cloudflare Workers

sh
npm run build:worker   # Build the worker bundle
npm run deploy:dev     # Run locally with Wrangler
npm run deploy:prod    # Deploy to Cloudflare

Project structure

DirectoryPurpose
src/mcp-server/toolsTool definitions (*.tool.ts). Git capabilities live here.
src/mcp-server/resourcesResource definitions (*.resource.ts). Git context data sources.
src/mcp-server/transportsHTTP and STDIO transport implementations, including auth.
src/storageStorageService abstraction and provider implementations.
src/servicesGit service provider (CLI-based git operations).
src/containerDI container registrations and tokens.
src/utilsLogging, error handling, performance, security utilities.
src/configEnvironment variable parsing and validation (Zod).
tests/Unit and integration tests, mirroring src/ structure.

Response format

Configure output format and verbosity via MCP_RESPONSE_FORMAT and MCP_RESPONSE_VERBOSITY.

JSON format (default, optimized for LLM consumption):

json
{
  "success": true,
  "branch": "main",
  "staged": ["src/index.ts", "README.md"],
  "unstaged": ["package.json"],
  "untracked": []
}

Markdown format (human-readable):

# Git Status: main

## Staged (2)
- src/index.ts
- README.md

## Unstaged (1)
- package.json

The LLM always receives the complete structured data via responseFormatter — full file lists, metadata, timestamps — regardless of what the client displays. Verbosity controls how much detail is included: minimal (core fields only), standard (balanced), or full (everything).

Development guide

See AGENTS.md for architecture, tool development patterns, and contribution rules.

Testing

Tests use Bun's test runner with Vitest compatibility.

sh
bun test              # Run all tests
bun test --coverage   # With coverage
bun run devcheck      # Lint, format, typecheck, audit

Roadmap

The server uses a provider-based architecture for git operations:

  • CLI provider (current) — Full 28-tool coverage via native git CLI. Requires local git installation.
  • Isomorphic git provider (planned) — Pure JS implementation for edge deployment (Cloudflare Workers, Vercel Edge, Deno Deploy). Uses isomorphic-git.
  • GitHub API provider (maybe) — Cloud-native operations via GitHub REST/GraphQL APIs, no local repo required.

Contributing

Issues and pull requests are welcome. Run checks before submitting:

sh
npm run devcheck
npm test

License

Apache 2.0. See LICENSE.


Instalação

TypingMind
Pré-requisitos:

Node.js 18+

{
  "mcpServers": {
    "cyanheads-git-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "@cyanheads/git-mcp-server"
      ]
    }
  }
}

Ferramentas disponíveis

  • git_add

    Stage files for commit. Add file contents to the staging area (index) to prepare for the next commit.

  • git_blame

    Show line-by-line authorship information for a file, displaying who last modified each line and when. For large files, use startLine/endLine to limit output.

  • git_branch

    Manage branches: list all branches, show current branch, create a new branch, delete a branch, or rename a branch.

  • git_changelog_analyze

    Gather git history context (commits, tags) and structured review instructions to support LLM-driven changelog analysis. Changelog file should be read separately; this tool provides the supporting git data and analysis framework. Pass one or more review types to control what kind of analysis to perform.

  • git_checkout

    Switch branches or restore working tree files. Can checkout an existing branch, create a new branch, or restore specific files.

  • git_cherry_pick

    Cherry-pick commits from other branches. Apply specific commits to the current branch without merging entire branches.

  • git_clean

    Remove untracked files from the working directory. Requires force flag for safety. Use dry-run to preview files that would be removed.

  • git_clear_working_dir

    Clear the session working directory setting. This resets the context without restarting the server. Subsequent git operations will require an explicit path parameter unless git_set_working_dir is called again.

  • git_clone

    Clone a repository from a remote URL to a local path. Supports HTTP/HTTPS and SSH URLs, with optional shallow cloning.

  • git_commit

    Create a new commit with staged changes in the repository. Records a snapshot of the staging area with a commit message.

    Commit Message Format: Pass commit messages as JSON string parameters. Multi-line messages are supported using standard JSON string escaping.

    Examples:

    • Single line: { "message": "feat: add user authentication" }
    • Multi-line: { "message": "feat: add user authentication\n\nImplemented OAuth2 flow with JWT tokens.\nAdded tests for login and logout." }

    Note: Do not use bash heredoc syntax. Literal escape sequences (\n, \t) in the message string are automatically normalized to their actual characters.

  • git_diff

    View differences between commits, branches, or working tree. Shows changes in unified diff format.

  • git_fetch

    Fetch updates from a remote repository. Downloads objects and refs without merging them.

  • git_init

    Initialize a new Git repository at the specified path. Creates a .git directory and sets up the initial branch.

  • git_log

    View commit history with optional filtering by author, date range, file path, or commit message pattern.

  • git_merge

    Merge branches together. Integrates changes from another branch into the current branch with optional merge strategies.

  • git_pull

    Pull changes from a remote repository. Fetches and integrates changes into the current branch.

  • git_push

    Push changes to a remote repository. Uploads local commits to the remote branch.

  • git_rebase

    Rebase commits onto another branch. Reapplies commits on top of another base tip for a cleaner history.

  • git_reflog

    View the reference logs (reflog) to track when branch tips and other references were updated. Useful for recovering lost commits.

  • git_remote

    Manage remote repositories: list remotes, add new remotes, remove remotes, rename remotes, or get/set remote URLs.

  • git_reset

    Reset current HEAD to specified state. Can be used to unstage files (soft), discard commits (mixed), or discard all changes (hard).

  • git_set_working_dir

    Set the session working directory for all git operations. This allows subsequent git commands to omit the path parameter and use this directory as the default.

  • git_show

    Show details of a git object (commit, tree, blob, or tag). Displays commit information and the diff of changes introduced.

  • git_stash

    Manage stashes: list stashes, save current changes (push), restore changes (pop/apply), or remove stashes (drop/clear).

  • git_status

    Show the working tree status including staged, unstaged, and untracked files.

  • git_tag

    Manage tags: list all tags, create a new tag, or delete a tag. Tags are used to mark specific points in history (releases, milestones).

  • git_worktree

    Manage multiple working trees: list worktrees, add new worktrees for parallel work, remove worktrees, or move worktrees to new locations.

  • git_wrapup_instructions

    Provides the user's desired Git wrap-up workflow and instructions. Returns custom workflow steps (if configured) or default best practices for reviewing, documenting, and committing changes. Includes current repository status to guide next actions.

Use o MCP de Git MCP 服务器 com vários modelos de IA

O TypingMind conecta as ferramentas MCP no nível do espaço de trabalho. Assim, após conectar Git MCP 服务器, é possível usá-lo com diferentes modelos de IA no TypingMind, em vez de configurá-lo separadamente para cada modelo. Este MCP é executado localmente no seu dispositivo por meio do conector MCP do TypingMind.

Guia de configuração para usar o conector local

Use esta opção quando o servidor MCP precisar acessar arquivos locais, aplicativos ou recursos privados no seu computador.

1

Abra as configurações de MCP

No TypingMind, vá até Configurações, Configurações avançadas e depois Model Context Protocol e selecione Configurar conector.

  1. Abra o TypingMind no navegador.
  2. Clique no ícone de Ajustes.
  3. Acesse Configurações avançadas.
  4. Abra a seção Model Context Protocol.
  5. Clique em Configurar conector e selecione Este dispositivo.
Tela de configuração do conector MCP do TypingMind com a opção Este dispositivo selecionada
2

Execute o comando do conector

Selecione Este dispositivo, copie o comando do TypingMind e execute-o no Terminal. Mantenha o processo em execução enquanto usa o MCP.

  1. Copie o comando de configuração exibido pelo TypingMind.
  2. Abra o Terminal no macOS ou o Windows Terminal no Windows.
  3. Cole e execute o comando.
  4. Autorize a instalação do pacote se o Terminal pedir confirmação para continuar.
  5. Mantenha o processo em execução na janela do Terminal enquanto usa as ferramentas MCP.
3

Adicione Git MCP 服务器 como servidor

Quando o status do conector for Pronto, clique em Editar e cole a configuração do servidor MCP.

  1. Aguarde até que o status do conector mostre Pronto.
  2. Clique em Editar.
  3. Cole a configuração do servidor MCP de Git MCP 服务器.
  4. Salve a lista de servidores.
  5. Atualize para confirmar se o conector ainda está pronto para uso.
Configurações de MCP do TypingMind mostrando um servidor ativo e o botão Editar
{
  "mcpServers": {
    "cyanheads-git-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "@cyanheads/git-mcp-server"
      ]
    }
  }
}
4

Use a conexão com diferentes modelos

Salve a lista de servidores, abra Plugins, ative as ferramentas MCP de Git MCP 服务器, selecione qualquer modelo de IA compatível no TypingMind e use as ferramentas no chat ou atribua-as a um agente de IA.

  1. Abra a página Plugins no TypingMind.
  2. Ative as ferramentas MCP de Git MCP 服务器.
  3. Inicie um chat e escolha o modelo de IA que deseja usar.
  4. Use as ferramentas MCP no chat ou atribua-as a um agente de IA.
  5. Mude para outro modelo de IA sempre que necessário, sem reconectar o MCP.
Chat do TypingMind usando ferramentas MCP ativadas com um modelo de IA selecionado
Pode usar Git MCP 服务器 para me ajudar nesta tarefa?
Git MCP 服务器
Claro. Já li.
Veja o que encontrei usando Git MCP 服务器.

Perguntas frequentes

Para que serve o servidor MCP Git MCP 服务器?

Git MCP 服务器 é um servidor MCP que permite que aplicativos de IA compatíveis se conectem a ferramentas externas e informações de contexto. No TypingMind, basta adicionar esse servidor MCP uma vez para disponibilizar suas ferramentas no seu espaço de trabalho com IA.

Posso usar o MCP Git MCP 服务器 com vários modelos de IA no TypingMind?

Sim. O TypingMind conecta as ferramentas MCP no nível do espaço de trabalho, permitindo usar Git MCP 服务器 com diferentes modelos de IA, como Claude, ChatGPT, Gemini ou outros modelos configurados no TypingMind, sem configurar o servidor MCP separadamente para cada modelo.

Por que usar o MCP Git MCP 服务器 com o TypingMind?

O TypingMind é uma das melhores interfaces de chat com LLMs porque reúne vários modelos de IA, prompts, plugins, agentes de IA, chaves de API e ferramentas MCP em um só espaço de trabalho. Com Git MCP 服务器 conectado, é possível usar suas ferramentas MCP nos seus modelos preferidos e manter seu fluxo de trabalho de chat organizado no TypingMind.

Como conecto o MCP Git MCP 服务器 ao TypingMind?

Git MCP 服务器 funciona por meio do conector MCP local do TypingMind. Essa é a melhor opção quando o servidor MCP precisa acessar arquivos locais, apps de desktop, ferramentas de linha de comando ou recursos privados no seu computador.

Quais ferramentas o MCP Git MCP 服务器 oferece no TypingMind?

Git MCP 服务器 disponibiliza 28 ferramentas MCP que podem ser ativadas na página Plugins do TypingMind e usadas no chat ou atribuídas a agentes de IA.

Preciso compartilhar minhas chaves de API com o TypingMind para usar o MCP Git MCP 服务器?

Não. O TypingMind prioriza o uso local e permite manter seus provedores de modelos, chaves de API, prompts e configuração MCP sob seu controle. Se Git MCP 服务器 exigir autenticação, adicione os cabeçalhos, as configurações OAuth ou a configuração local exigidos por esse servidor MCP ao criar a conexão.

Servidores MCP relacionados

Ver todos

Crie seu próprio espaço de IA agora

Inscreva-se na nossa newsletter para receber novidades sobre recursos e futuros sorteios 👇