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_TOKEN | GitLab 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_FILE | Path 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_TOKEN | Optional GitLab CI job token to use instead of a personal access token when running inside GitLab CI. | いいえ |
GITLAB_AUTH_COOKIE_PATH | Optional path to a GitLab authentication cookie file for cookie-based authentication. | いいえ |
GITLAB_USE_OAUTH | Set to true to start with GitLab OAuth instead of a personal access token, job token, or cookie file. | いいえ |
GITLAB_OAUTH_CLIENT_ID | GitLab OAuth application ID. When GITLAB_USE_OAUTH=true, set this or GITLAB_OAUTH_TOKEN_SCRIPT. | いいえ |
GITLAB_OAUTH_TOKEN_SCRIPT | Command that prints an OAuth access token. When GITLAB_USE_OAUTH=true, set this or GITLAB_OAUTH_CLIENT_ID. | いいえ |
GITLAB_API_URL | GitLab API base URL. Use https://gitlab.com/api/v4 for GitLab.com or your self-managed GitLab API URL. | いいえ |
GITLAB_ALLOWED_PROJECT_IDS | Optional comma-separated list of GitLab project IDs that this server is allowed to access. | いいえ |
GITLAB_PERMISSION_MODE | Tool exposure. Allowed values are readonly, modify, and full. Unset uses full. readonly keeps read-only tools. modify blocks delete and teardown tools. | いいえ |
GITLAB_TOOLSETS | Optional 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_TOOLS | Optional comma-separated list of individual tool names to add on top of enabled toolsets. | いいえ |
GITLAB_DENIED_TOOLS_REGEX | Optional regular expression used to hide matching tools from the server. | いいえ |
GITLAB_TOOL_POLICY_APPROVE | Optional comma-separated list of tool names that require explicit approval before execution. | いいえ |
GITLAB_TOOL_POLICY_HIDDEN | Optional comma-separated list of tool names to hide from tools/list. | いいえ |
NODE_TLS_REJECT_UNAUTHORIZED | Set to 0 only when you intentionally need to connect to a GitLab instance with invalid or self-signed TLS certificates. | いいえ |
GITLAB_CA_CERT_PATH | Optional path to a custom CA certificate file for self-managed GitLab instances. | いいえ |
GITLAB_MASKING_ENABLED | Set to true to mask text tool results and returned errors using built-in or configured rules. | いいえ |
GITLAB_MASKING_CONFIG | Optional path to a response-masking JSON configuration file. | いいえ |
GITLAB_MASKING_POLICY_FILE | Optional protected server-owned JSON file containing managed masking policies. | いいえ |
GITLAB_MASKING_WORKSPACE_DIR | Directory 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やマイルストーンを管理したいとき。
必要なもの
npm install -g @zereight/mcp-gitlab でインストールし、zereight-mcp-gitlab バイナリを使います。相性のいいスキル
MCPかスキルか
MCPはエージェントに手を与え、スキルはその正しい使い方を教えます。組み合わせると、結果が良くなりトークンも節約できます。
よくある質問
ツールはいくつ表示されますか?
既定では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分で読めます。