io.github.Ray0907/git-mcp-server

Official registry Developer tools

MCP server for GitLab and GitHub

What can you do with 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

Install

Add this to your client's MCP configuration (Claude Desktop: claude_desktop_config.json; Cursor: .cursor/mcp.json; VS Code and others use the same "mcpServers" shape).

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
JSON configuration (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>"
            }
        }
    }
}

Environment variables

  • GIT_PROVIDER Provider type: gitlab or github
  • GIT_TOKEN required 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

From the project's README on GitHub, refreshed weekly. Links open on GitHub.

Contents
  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

Frequently asked questions

What is io.github.Ray0907/git-mcp-server?

MCP server for GitLab and GitHub

How do I install io.github.Ray0907/git-mcp-server?

It runs on your machine. In 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. For other clients, paste the JSON configuration from this page into their MCP settings.

Does io.github.Ray0907/git-mcp-server need an API key?

Yes. It expects GIT_TOKEN, which you set in its configuration.

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

Yes. Its code is on GitHub under the MIT license.

Who maintains io.github.Ray0907/git-mcp-server?

It is published by Ray0907. AI.tn lists it but does not maintain or endorse it.

From the official MCP Registry. Listing is not an endorsement: review a server's code and permissions before giving it access to your data.