io.github.Ray0907/git-mcp-server

Registre officiel Outils de développement

MCP server for GitLab and GitHub

Que pouvez-vous faire avec io.github.Ray0907/git-mcp-server ?

  • Create file: src/tools/{category}/{action}.ts
  • Export from category index: src/tools/{category}/index.ts
  • Add to allTools: src/tools/index.ts

Installation

Ajoutez ceci à la configuration MCP de votre client (Claude Desktop : claude_desktop_config.json ; Cursor : .cursor/mcp.json ; VS Code et les autres utilisent la même forme « mcpServers »).

NPM package @raytien/git-mcp-server
Claude Code
claude mcp add git-mcp-server -e 'GIT_PROVIDER=<GIT_PROVIDER>' -e 'GIT_TOKEN=<your git_token>' -e 'GIT_API_URL=<GIT_API_URL>' -e 'GIT_READ_ONLY=<GIT_READ_ONLY>' -- npx -y @raytien/git-mcp-server@0.2.3
Configuration JSON (Claude Desktop, Cursor, VS Code)
{
    "mcpServers": {
        "git-mcp-server": {
            "command": "npx",
            "args": [
                "-y",
                "@raytien/git-mcp-server@0.2.3"
            ],
            "env": {
                "GIT_PROVIDER": "<GIT_PROVIDER>",
                "GIT_TOKEN": "<your git_token>",
                "GIT_API_URL": "<GIT_API_URL>",
                "GIT_READ_ONLY": "<GIT_READ_ONLY>"
            }
        }
    }
}

Variables d'environnement

  • GIT_PROVIDER Provider type: gitlab or github
  • GIT_TOKEN obligatoire secret Personal Access Token for GitHub or GitLab
  • GIT_API_URL API URL for self-hosted instances
  • GIT_READ_ONLY Disable write operations (true/false)

Documentation

Tirée du README du projet sur GitHub, actualisée chaque semaine. Les liens ouvrent GitHub.

Sommaire
  1. Git MCP Server
  2. Quick Start
  3. Available Tools
  4. Configuration
  5. Architecture
  6. Development
  7. Adding a New Tool
  8. Inspired By
  9. License

Git MCP Server

A clean, modular Git MCP server supporting both GitHub and GitLab.

Quick Start

Claude Desktop Configuration

Add to your claude_desktop_config.json:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

GitHub
{
  "mcpServers": {
    "git": {
      "command": "npx",
      "args": ["-y", "@raytien/git-mcp-server"],
      "env": {
        "GIT_PROVIDER": "github",
        "GIT_TOKEN": "ghp_xxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}
GitHub Enterprise
{
  "mcpServers": {
    "git": {
      "command": "npx",
      "args": ["-y", "@raytien/git-mcp-server"],
      "env": {
        "GIT_PROVIDER": "github",
        "GIT_API_URL": "https://github.your-company.com/api/v3",
        "GIT_TOKEN": "ghp_xxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}
GitLab.com (SaaS)
{
  "mcpServers": {
    "git": {
      "command": "npx",
      "args": ["-y", "@raytien/git-mcp-server"],
      "env": {
        "GIT_PROVIDER": "gitlab",
        "GIT_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}
Self-Hosted GitLab
{
  "mcpServers": {
    "git": {
      "command": "npx",
      "args": ["-y", "@raytien/git-mcp-server"],
      "env": {
        "GIT_PROVIDER": "gitlab",
        "GIT_API_URL": "https://gitlab.your-company.com/api/v4",
        "GIT_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}
Read-Only Mode
{
  "mcpServers": {
    "git": {
      "command": "npx",
      "args": ["-y", "@raytien/git-mcp-server"],
      "env": {
        "GIT_PROVIDER": "github",
        "GIT_TOKEN": "ghp_xxxxxxxxxxxxxxxxxxxx",
        "GIT_READ_ONLY": "true"
      }
    }
  }
}
Get Your Token
GitHub
  1. Go to GitHub > Settings > Developer settings > Personal access tokens > Tokens (classic)
  2. Generate new token with scopes: repo, read:org, workflow
  3. Copy the token (starts with ghp_)
GitLab
  1. Go to GitLab > Settings > Access Tokens
  2. Create a new token with scopes: api, read_api, read_repository, write_repository
  3. Copy the token (starts with glpat-)

Available Tools

Repository
ToolDescription
get_file_contentsRead file content from repository
get_repository_treeList directory structure
push_filesPush file changes in a single commit
create_branchCreate a new branch
list_branchesList repository branches
list_commitsList commit history
search_codeSearch for code in repository
Issues
ToolDescription
get_issueGet a single issue
list_issuesList issues
create_issueCreate a new issue
update_issueUpdate an issue
Pull/Merge Requests
ToolDescription
get_pull_requestGet a merge request
list_pull_requestsList merge requests
create_pull_requestCreate a merge request
get_pull_request_diffsGet merge request changes
merge_pull_requestMerge a merge request
CI/CD (Pipelines / Workflow Runs)
ToolDescription
get_pipelineGet pipeline/workflow run status
list_pipelinesList pipelines/workflow runs
list_pipeline_jobsList pipeline jobs/workflow jobs
get_job_logGet job log output

Note: GitHub Actions workflow runs map to GitLab pipelines. The same tools work for both platforms.

Comments
ToolDescription
create_commentAdd comment to issue/MR
list_commentsList comments
Users
ToolDescription
get_meGet current authenticated user

Configuration

Environment VariableRequiredDefaultDescription
GIT_PROVIDERNogitlabProvider type: gitlab or github
GIT_TOKENYes-Personal Access Token
GIT_API_URLNoProvider defaultAPI URL (auto-detected from provider)
GIT_AUTH_TYPENobearerAuth type: bearer or private-token
GIT_READ_ONLYNofalseDisable write operations
LOG_LEVELNoinfoLog level: debug, info, warn, error

Architecture

src/
├── index.ts              # Entry point
├── server.ts             # MCP server (provider-agnostic)
├── config.ts             # Configuration (multi-provider)
├── providers/            # Platform abstraction
│   ├── interface.ts      # GitProvider interface
│   ├── types.ts          # Platform-agnostic types
│   ├── config.ts         # Provider configuration
│   ├── factory.ts        # Provider Factory (creates GitLab/GitHub)
│   ├── gitlab/           # GitLab implementation
│   └── github/           # GitHub implementation
├── tools/                # Tool definitions
│   ├── define.ts         # defineTool helper
│   ├── registry.ts       # Tool registry
│   ├── repository/       # Repository tools
│   ├── issues/           # Issue tools
│   ├── merge-requests/   # PR/MR tools
│   ├── pipelines/        # CI/CD tools
│   ├── notes/            # Comment tools
│   └── users/            # User tools
├── gitlab/               # GitLab API client
│   ├── client.ts         # HTTP client
│   └── types.ts          # GitLab API types
├── github/               # GitHub API client
│   ├── client.ts         # HTTP client
│   └── types.ts          # GitHub API types
├── auth/                 # Authentication
└── lib/                  # Utilities

Development

# Install dependencies
npm install

# Build
npm run build

# Run tests
npm test

# Run locally
npm start

# Development mode (watch)
npm run dev

Adding a New Tool

  1. Create file: src/tools/{category}/{action}.ts
import { z } from 'zod';
import { defineTool, repoParam } from '../define.js';

const schema = z.object({
    repo: repoParam,
    // ... your params
});

export const myTool = defineTool({
    name: 'my_tool',
    description: 'What this tool does',
    schema,
    category: 'my-category',
    read_only: true,
    handler: async (input, ctx) => {
        return ctx.provider.repository.someMethod(input.repo, ...);
    },
});
  1. Export from category index: src/tools/{category}/index.ts
  2. Add to allTools: src/tools/index.ts

Inspired By

License

MIT

Questions fréquentes

Qu'est-ce que io.github.Ray0907/git-mcp-server ?

MCP server for GitLab and GitHub

Comment installer io.github.Ray0907/git-mcp-server ?

Il s'exécute sur votre machine. Dans Claude Code : claude mcp add git-mcp-server -e 'GIT_PROVIDER=<GIT_PROVIDER>' -e 'GIT_TOKEN=<your git_token>' -e 'GIT_API_URL=<GIT_API_URL>' -e 'GIT_READ_ONLY=<GIT_READ_ONLY>' -- npx -y @raytien/git-mcp-server@0.2.3. Pour les autres clients, collez la configuration JSON de cette page dans leurs réglages MCP.

Faut-il une clé API pour io.github.Ray0907/git-mcp-server ?

Oui. Il attend GIT_TOKEN, à renseigner dans sa configuration.

io.github.Ray0907/git-mcp-server est-il open source ?

Oui. Son code est sur GitHub sous licence MIT.

Qui maintient io.github.Ray0907/git-mcp-server ?

Il est publié par Ray0907. AI.tn le référence sans le maintenir ni le recommander.

Issu du registre MCP officiel. Être listé n'est pas une recommandation : vérifiez le code et les permissions d'un serveur avant de lui donner accès à vos données.