Skip to main content
Glama

GitLab MCP Server

Official

GitLab MCP サーバー

GitLab API 用の MCP サーバー。プロジェクト管理、ファイル操作などが可能になります。

特徴

  • 自動ブランチ作成: ファイルを作成/更新したり変更をプッシュしたりするときに、ブランチが存在しない場合は自動的に作成されます。
  • 包括的なエラー処理: 一般的な問題に対する明確なエラーメッセージ
  • Git 履歴の保存: 強制プッシュなしで適切な Git 履歴を維持する操作
  • バッチ操作: 単一ファイルと複数ファイルの操作の両方をサポート

ツール

  1. create_or_update_file
    • プロジェクト内の単一のファイルを作成または更新する
    • 入力:
      • project_id (文字列): プロジェクトIDまたはURLエンコードされたパス
      • file_path (文字列): ファイルを作成/更新するパス
      • content (文字列): ファイルの内容
      • commit_message (文字列): コミットメッセージ
      • branch (文字列): ファイルを作成/更新するブランチ
      • previous_path (オプションの文字列): 移動/名前変更するファイルのパス
    • 戻り値: ファイルの内容とコミットの詳細
  2. push_files
    • 1回のコミットで複数のファイルをプッシュする
    • 入力:
      • project_id (文字列): プロジェクトIDまたはURLエンコードされたパス
      • branch (文字列): プッシュ先のブランチ
      • files (配列): プッシュするファイル。それぞれfile_pathcontentを持つ。
      • commit_message (文字列): コミットメッセージ
    • 戻り値: 更新されたブランチ参照
  3. search_repositories
    • GitLabプロジェクトを検索
    • 入力:
      • search (文字列): 検索クエリ
      • page (オプションの数値):ページ番号
      • per_page (オプションの数値):1ページあたりの結果数(デフォルトは20)
    • 返されるもの: プロジェクト検索結果
  4. create_repository
    • 新しいGitLabプロジェクトを作成する
    • 入力:
      • name (文字列): プロジェクト名
      • description (オプションの文字列): プロジェクトの説明
      • visibility (オプションの文字列): 'private'、'internal'、または 'public'
      • initialize_with_readme (オプションのブール値): README で初期化する
    • 戻り値: 作成されたプロジェクトの詳細
  5. get_file_contents
    • ファイルまたはディレクトリの内容を取得する
    • 入力:
      • project_id (文字列): プロジェクトIDまたはURL��ンコードされたパス
      • file_path (文字列): ファイル/ディレクトリへのパス
      • ref (オプションの文字列): コンテンツを取得するブランチ/タグ/コミット
    • 戻り値: ファイル/ディレクトリの内容
  6. create_issue
    • 新しい問題を作成する
    • 入力:
      • project_id (文字列): プロジェクトIDまたはURLエンコードされたパス
      • title (文字列): 問題のタイトル
      • description (オプションの文字列): 問題の説明
      • assignee_ids (オプションの数値[]): 割り当てるユーザーID
      • labels (オプションの文字列[]):追加するラベル
      • milestone_id (オプションの数値): マイルストーンID
    • 返品: 作成された問題の詳細
  7. create_merge_request
    • 新しいマージリクエストを作成する
    • 入力:
      • project_id (文字列): プロジェクトIDまたはURLエンコードされたパス
      • title (文字列): MRタイトル
      • description (オプションの文字列):MRの説明
      • source_branch (文字列): 変更を含むブランチ
      • target_branch (文字列): マージ先のブランチ
      • draft (オプションのブール値):���ラフトMRとして作成
      • allow_collaboration (オプションのブール値):上流メンバーからのコミットを許可する
    • 戻り値: 作成されたマージリクエストの詳細
  8. fork_repository
    • プロジェクトをフォークする
    • 入力:
      • project_id (文字列): プロジェクトIDまたはURLエンコードされたパス
      • namespace (オプションの文字列): フォークする名前空間
    • 戻り値: フォークされたプロジェクトの詳細
  9. create_branch
    • 新しいブランチを作成する
    • 入力:
      • project_id (文字列): プロジェクトIDまたはURLエンコードされたパス
      • branch (文字列): 新しいブランチの名前
      • ref (オプションの文字列): 新しいブランチのソースブランチ/コミット
    • 戻り値: 作成されたブランチ参照

設定

個人アクセストークン

適切な権限を持つGitLab 個人アクセス トークンを作成します

  • GitLabのユーザー設定 > アクセストークンに移動します
  • 必要なスコープを選択します。
    • 完全なAPIアクセスのためのapi
    • 読み取り専用アクセス用のread_api
    • リポジトリ操作用のread_repositorywrite_repository
  • トークンを作成し、安全に保存する

Claude Desktopでの使用

claude_desktop_config.jsonに以下を追加します。

ドッカー
{ "mcpServers": { "gitlab": { "command": "docker", "args": [ "run", "--rm", "-i", "-e", "GITLAB_PERSONAL_ACCESS_TOKEN", "-e", "GITLAB_API_URL", "mcp/gitlab" ], "env": { "GITLAB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>", "GITLAB_API_URL": "https://gitlab.com/api/v4" // Optional, for self-hosted instances } } } }
NPX
{ "mcpServers": { "gitlab": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-gitlab" ], "env": { "GITLAB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>", "GITLAB_API_URL": "https://gitlab.com/api/v4" // Optional, for self-hosted instances } } } }

VS Codeでの使用

素早くインストールするには、以下のワンクリック インストール ボタンのいずれかを使用します...

手動でインストールする場合は、VS Code のユーザー設定 (JSON) ファイルに次の JSON ブロックを追加します。Ctrl Ctrl + Shift + Pを押してPreferences: Open User Settings (JSON)と入力すると、このブロックを追加できます。

オプションとして、ワークスペース内の.vscode/mcp.jsonというファイルに追加することもできます。これにより、他のユーザーと設定を共有できるようになります。

.vscode/mcp.jsonファイルではmcpキーは必要ないことに注意してください。

ドッカー
{ "mcp": { "inputs": [ { "type": "promptString", "id": "gitlab_token", "description": "GitLab Personal Access Token", "password": true }, { "type": "promptString", "id": "gitlab_url", "description": "GitLab API URL (optional)", "default": "https://gitlab.com/api/v4" } ], "servers": { "gitlab": { "command": "docker", "args": [ "run", "--rm", "-i", "mcp/gitlab" ], "env": { "GITLAB_PERSONAL_ACCESS_TOKEN": "${input:gitlab_token}", "GITLAB_API_URL": "${input:gitlab_url}" } } } } }
NPX
{ "mcp": { "inputs": [ { "type": "promptString", "id": "gitlab_token", "description": "GitLab Personal Access Token", "password": true }, { "type": "promptString", "id": "gitlab_url", "description": "GitLab API URL (optional)", "default": "https://gitlab.com/api/v4" } ], "servers": { "gitlab": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-gitlab" ], "env": { "GITLAB_PERSONAL_ACCESS_TOKEN": "${input:gitlab_token}", "GITLAB_API_URL": "${input:gitlab_url}" } } } } }

建てる

Dockerビルド:

docker build -t vonwig/gitlab:mcp -f src/gitlab/Dockerfile .

環境変数

  • GITLAB_PERSONAL_ACCESS_TOKEN : GitLab個人アクセストークン(必須)
  • GITLAB_API_URL : GitLab API のベース URL (オプション、デフォルトはhttps://gitlab.com/api/v4 )

ライセンス

このMCPサーバーはMITライセンスに基づいてライセンスされています。つまり、MITライセンスの条件に従って、ソフトウェアを自由に使用、改変、配布することができます。詳細については、プロジェクトリポジトリのLICENSEファイルをご覧ください。

Deploy Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

GitLab API 用の MCP サーバー。プロジェクト管理、ファイル操作などが可能になります。

  1. 特徴
    1. ツール
      1. 設定
        1. 個人アクセストークン
        2. Claude Desktopでの使用
        3. VS Codeでの使用
      2. 建てる
        1. 環境変数
          1. ライセンス

            Related MCP Servers

            • A
              security
              A
              license
              A
              quality
              MCP Server for the GitHub API, enabling file operations, repository management, search functionality, and more.
              Last updated -
              22,573
              68,255
              MIT License
            • A
              security
              F
              license
              A
              quality
              MCP Server for the GitHub API, providing features for file operations, repository management, and advanced search, with automatic branch creation and comprehensive error handling.
              Last updated -
              18
              0
              4
              • Linux
              • Apple
            • A
              security
              A
              license
              A
              quality
              GitLab MCP Server (with activity tracking and group projects listing features) This server is based on the original GitLab MCP server with Group Projects Listing and Activity Tracking enhancements
              Last updated -
              28
              86
              27
              MIT License
            • -
              security
              A
              license
              -
              quality
              An MCP server that enables communication with GitLab repositories, allowing interaction with GitLab's API to manage projects, issues, and repositories through natural language.
              Last updated -
              7,512
              1
              MIT License

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/modelcontextprotocol/gitlab'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server