Chuyển đến nội dung
Skillpedia
● Miễn phí và mã nguồn mở💻 Cục bộ🔑 Cần khóa APILập trình

GitLab MCP Server

Cho phép agent AI của bạn làm việc với dự án, merge request, issue, pipeline, wiki và bản phát hành trên GitLab.

2.1k sao trên GitHubbởi zereightGiấy phép MITCập nhật 18 ngày trước

Cách cài đặt

MCP này chạy cục bộ: nó chạy trên máy tính của bạn.

Nó hoạt động trong các ứng dụng cài trên máy (Claude Desktop, Claude Code, Cursor, VS Code…). Hãy chọn ứng dụng của bạn:

Dán vào terminal:

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

Những gì cần điền

TênMô tảBắt buộc
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.Không
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.Không
GITLAB_JOB_TOKENOptional GitLab CI job token to use instead of a personal access token when running inside GitLab CI.Không
GITLAB_AUTH_COOKIE_PATHOptional path to a GitLab authentication cookie file for cookie-based authentication.Không
GITLAB_USE_OAUTHSet to true to start with GitLab OAuth instead of a personal access token, job token, or cookie file.Không
GITLAB_OAUTH_CLIENT_IDGitLab OAuth application ID. When GITLAB_USE_OAUTH=true, set this or GITLAB_OAUTH_TOKEN_SCRIPT.Không
GITLAB_OAUTH_TOKEN_SCRIPTCommand that prints an OAuth access token. When GITLAB_USE_OAUTH=true, set this or GITLAB_OAUTH_CLIENT_ID.Không
GITLAB_API_URLGitLab API base URL. Use https://gitlab.com/api/v4 for GitLab.com or your self-managed GitLab API URL.Không
GITLAB_ALLOWED_PROJECT_IDSOptional comma-separated list of GitLab project IDs that this server is allowed to access.Không
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.Không
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).Không
GITLAB_TOOLSOptional comma-separated list of individual tool names to add on top of enabled toolsets.Không
GITLAB_DENIED_TOOLS_REGEXOptional regular expression used to hide matching tools from the server.Không
GITLAB_TOOL_POLICY_APPROVEOptional comma-separated list of tool names that require explicit approval before execution.Không
GITLAB_TOOL_POLICY_HIDDENOptional comma-separated list of tool names to hide from tools/list.Không
NODE_TLS_REJECT_UNAUTHORIZEDSet to 0 only when you intentionally need to connect to a GitLab instance with invalid or self-signed TLS certificates.Không
GITLAB_CA_CERT_PATHOptional path to a custom CA certificate file for self-managed GitLab instances.Không
GITLAB_MASKING_ENABLEDSet to true to mask text tool results and returned errors using built-in or configured rules.Không
GITLAB_MASKING_CONFIGOptional path to a response-masking JSON configuration file.Không
GITLAB_MASKING_POLICY_FILEOptional protected server-owned JSON file containing managed masking policies.Không
GITLAB_MASKING_WORKSPACE_DIRDirectory used to resolve response-masking configuration paths.Không

Xong rồi! Giờ hãy thử

Khởi động lại ứng dụng và dán một trong các yêu cầu này vào khung chat:

Liệt kê các file đã thay đổi trong merge request 123 của group/project.
Cho tôi xem kết quả của job pipeline bị lỗi.

Đây là gì

Máy chủ này kết nối agent của bạn với GitLab qua API REST và GraphQL. Nó khởi động với 40 công cụ và có thể bật thêm theo nhóm, tối đa 288 công cụ. Nó hỗ trợ gitlab.com, các bản tự host và chế độ chỉ đọc.

Nó làm được gì

  • list_merge_request_changed_files và get_merge_request_file_diff: xem lại merge request theo hai bước
  • get_pipeline_job_output: đọc nhật ký job có phân trang
  • discover_tools: bật thêm các nhóm công cụ
  • help
  • execute_graphql
  • Dự án, issue, wiki, bản phát hành, tag và milestone
  • Tùy chọn jmespath để thu gọn các kết quả lớn

Khi nào nên dùng

  • ›Khi bạn muốn agent xem lại merge request theo từng file.
  • ›Khi một pipeline thất bại và bạn muốn xem nhật ký job mà không phải mở GitLab.
  • ›Khi bạn muốn quản lý issue và milestone ngay trong chat.

Bạn cần gì

Một personal access token của GitLab (hoặc OAuth) và Node.js 20 trở lên. Cài bằng npm install -g @zereight/mcp-gitlab, rồi dùng binary zereight-mcp-gitlab.

Skill đi kèm tốt

⭐ MCP Skillpedia · miễn phíAgent của bạn tự tìm đúng skillCài MCP của chúng tôi và agent của bạn sẽ tìm trong 15.000+ skill mỗi khi cần.Cài miễn phí →

Câu hỏi thường gặp

Hiện có bao nhiêu công cụ?

Mặc định là 40 (38 công cụ cốt lõi cộng discover_tools và help). Tổng cộng có 288.

Tôi có nên tải tất cả công cụ không?

Không. README khuyên không đặt GITLAB_TOOLSETS=all vì tốn khoảng 73k token schema. Hãy dùng discover_tools.

Tôi đăng nhập bằng cách nào?

Bằng GITLAB_PERSONAL_ACCESS_TOKEN, OAuth cục bộ, MCP OAuth cho Claude.ai, hoặc ủy quyền từ xa cho từng yêu cầu.

Nó có hoạt động với GitLab tự host không?

Có, đặt GITLAB_API_URL thành địa chỉ instance của bạn.

Tôi có thể dùng nó mà không có MCP không?

Có. Một đường dẫn Skill và CLI thực hiện các quy trình tương tự trong terminal với zereight-mcp-gitlab.

Bộ công cụ api có an toàn không?

README cảnh báo nó vượt qua allowlist và các kiểm tra an toàn, đồng thời có thể bị điều khiển bằng prompt injection. Chỉ bật khi thật sự cần.

Nếu không hoạt động

  • ›Kiểm tra token đã được đặt và GITLAB_API_URL đúng, ví dụ https://gitlab.com/api/v4.
  • ›Kiểm tra phiên bản Node.js là 20 trở lên.
  • ›Dùng đường dẫn project đã mã hóa URL, như group%2Fproject, cho project_id.

5 skill mới mỗi tuần. Đọc chỉ 1 phút.