本文へスキップ
Skillpedia
● 無料・オープンソース💻 ローカル🔑 APIキーが必要プログラミング

GitLab MCP Server

AIエージェントが、GitLabのプロジェクト、マージリクエスト、Issue、パイプライン、Wiki、リリースを扱えるようにします。

2.1k GitHubのスター作者 zereightライセンス MIT更新 18 日前

導入方法

このMCPはローカル型です。あなたのパソコンで動きます。

パソコンに入れたアプリ(Claude Desktop、Claude Code、Cursor、VS Codeなど)で使えます。アプリを選んでください:

ターミナルに貼り付け:

claude mcp add gitlab -- npx -y @zereight/mcp-gitlab

入力するもの

名前内容必須
GITLAB_PERSONAL_ACCESS_TOKENGitLab personal access token for local stdio use. A non-empty value overrides GITLAB_PERSONAL_ACCESS_TOKEN_FILE. One of this token, GITLAB_PERSONAL_ACCESS_TOKEN_FILE, GITLAB_JOB_TOKEN, GITLAB_AUTH_COOKIE_PATH, or GITLAB_USE_OAUTH=true must be set. Create a token with the GitLab scopes the tools need, such as api or read_api.いいえ
GITLAB_PERSONAL_ACCESS_TOKEN_FILEPath to a file that contains the personal access token. Read once at startup and trimmed. Ignored when GITLAB_PERSONAL_ACCESS_TOKEN or --token is non-empty. A missing, unreadable, or empty file stops startup. Does not replace job token, OAuth, cookie, or remote authorization.いいえ
GITLAB_JOB_TOKENOptional GitLab CI job token to use instead of a personal access token when running inside GitLab CI.いいえ
GITLAB_AUTH_COOKIE_PATHOptional path to a GitLab authentication cookie file for cookie-based authentication.いいえ
GITLAB_USE_OAUTHSet to true to start with GitLab OAuth instead of a personal access token, job token, or cookie file.いいえ
GITLAB_OAUTH_CLIENT_IDGitLab OAuth application ID. When GITLAB_USE_OAUTH=true, set this or GITLAB_OAUTH_TOKEN_SCRIPT.いいえ
GITLAB_OAUTH_TOKEN_SCRIPTCommand that prints an OAuth access token. When GITLAB_USE_OAUTH=true, set this or GITLAB_OAUTH_CLIENT_ID.いいえ
GITLAB_API_URLGitLab API base URL. Use https://gitlab.com/api/v4 for GitLab.com or your self-managed GitLab API URL.いいえ
GITLAB_ALLOWED_PROJECT_IDSOptional comma-separated list of GitLab project IDs that this server is allowed to access.いいえ
GITLAB_PERMISSION_MODETool exposure. Allowed values are readonly, modify, and full. Unset uses full. readonly keeps read-only tools. modify blocks delete and teardown tools.いいえ
GITLAB_TOOLSETSOptional comma-separated toolset ids (projects, issues, merge_requests, …). Unset keeps the lean core default plus discover_tools. Do not set all unless you accept loading ~all schemas (~73k tokens).いいえ
GITLAB_TOOLSOptional comma-separated list of individual tool names to add on top of enabled toolsets.いいえ
GITLAB_DENIED_TOOLS_REGEXOptional regular expression used to hide matching tools from the server.いいえ
GITLAB_TOOL_POLICY_APPROVEOptional comma-separated list of tool names that require explicit approval before execution.いいえ
GITLAB_TOOL_POLICY_HIDDENOptional comma-separated list of tool names to hide from tools/list.いいえ
NODE_TLS_REJECT_UNAUTHORIZEDSet to 0 only when you intentionally need to connect to a GitLab instance with invalid or self-signed TLS certificates.いいえ
GITLAB_CA_CERT_PATHOptional path to a custom CA certificate file for self-managed GitLab instances.いいえ
GITLAB_MASKING_ENABLEDSet to true to mask text tool results and returned errors using built-in or configured rules.いいえ
GITLAB_MASKING_CONFIGOptional path to a response-masking JSON configuration file.いいえ
GITLAB_MASKING_POLICY_FILEOptional protected server-owned JSON file containing managed masking policies.いいえ
GITLAB_MASKING_WORKSPACE_DIRDirectory used to resolve response-masking configuration paths.いいえ

準備完了!試してみましょう

アプリを再起動して、次のどれかをチャットに貼ってください:

group/projectのマージリクエスト123で変更されたファイルを一覧にして。
失敗したパイプラインのジョブの出力を見せて。

概要

このサーバーは、REST APIとGraphQL APIを通じて、エージェントをGitLabにつなぎます。40のツールで起動し、カテゴリごとに追加で有効にして、合計288まで増やせます。gitlab.comとセルフホスト型のインスタンスの両方に対応し、読み取り専用モードもあります。

できること

  • list_merge_request_changed_files と get_merge_request_file_diff: マージリクエストを2段階で確認する
  • get_pipeline_job_output: ジョブのログをページ単位で読む
  • discover_tools: 追加のツールカテゴリを有効にする
  • help: ヘルプを表示する
  • execute_graphql: GraphQLを実行する
  • プロジェクト、Issue、Wiki、リリース、タグ、マイルストーン
  • jmespath オプション: 大きな結果を絞り込む

使う場面

  • ›エージェントに、マージリクエストのファイルを1つずつレビューさせたいとき。
  • ›パイプラインが失敗したときに、GitLabを開かずにジョブのログを見たいとき。
  • ›チャットからIssueやマイルストーンを管理したいとき。

必要なもの

GitLabのパーソナルアクセストークン(またはOAuth)と、Node.js 20以上。npm install -g @zereight/mcp-gitlab でインストールし、zereight-mcp-gitlab バイナリを使います。

相性のいいスキル

⭐ Skillpedia MCP · 無料エージェントが自分で最適なスキルを見つけます当サイトのMCPを入れると、必要なときにエージェントが15,000+件のスキルから探します。無料で導入 →

よくある質問

ツールはいくつ表示されますか?

既定では40です(コアの38に、discover_tools と help を加えたもの)。全体では288あります。

すべてのツールを読み込むべきですか?

いいえ。READMEでは GITLAB_TOOLSETS=all を設定しないよう勧めています。これには約73kのスキーマトークンがかかるためです。代わりに discover_tools を使ってください。

どうサインインしますか?

GITLAB_PERSONAL_ACCESS_TOKEN、ローカルのOAuth、Claude.ai向けのMCP OAuth、またはリクエストごとのリモート認可を使います。

セルフホスト型のGitLabでも使えますか?

はい。GITLAB_API_URL をご自身のインスタンスに設定してください。

MCPを使わずに使えますか?

はい。スキルとCLIの方法では、zereight-mcp-gitlab を使って、ターミナルで同じ作業ができます。

apiツールセットは安全ですか?

READMEでは、このツールセットが許可リストや安全確認を回避し、プロンプトインジェクションで操作される可能性があると警告しています。必要なときだけ、意図的に有効にしてください。

うまく動かないとき

  • ›トークンが設定されていること、そして GITLAB_API_URL が正しいことを確認してください。例:https://gitlab.com/api/v4
  • ›Node.jsのバージョンが20以上であることを確認してください。
  • ›project_id には、group%2Fproject のようにURLエンコードしたプロジェクトパスを使ってください。

毎週5つの新しいスキル。1分で読めます。