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ên | Mô tả | Bắt buộc |
|---|---|---|
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. | Không |
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. | Không |
GITLAB_JOB_TOKEN | Optional GitLab CI job token to use instead of a personal access token when running inside GitLab CI. | Không |
GITLAB_AUTH_COOKIE_PATH | Optional path to a GitLab authentication cookie file for cookie-based authentication. | Không |
GITLAB_USE_OAUTH | Set to true to start with GitLab OAuth instead of a personal access token, job token, or cookie file. | Không |
GITLAB_OAUTH_CLIENT_ID | GitLab OAuth application ID. When GITLAB_USE_OAUTH=true, set this or GITLAB_OAUTH_TOKEN_SCRIPT. | Không |
GITLAB_OAUTH_TOKEN_SCRIPT | Command that prints an OAuth access token. When GITLAB_USE_OAUTH=true, set this or GITLAB_OAUTH_CLIENT_ID. | Không |
GITLAB_API_URL | GitLab API base URL. Use https://gitlab.com/api/v4 for GitLab.com or your self-managed GitLab API URL. | Không |
GITLAB_ALLOWED_PROJECT_IDS | Optional comma-separated list of GitLab project IDs that this server is allowed to access. | Không |
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. | Không |
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). | Không |
GITLAB_TOOLS | Optional comma-separated list of individual tool names to add on top of enabled toolsets. | Không |
GITLAB_DENIED_TOOLS_REGEX | Optional regular expression used to hide matching tools from the server. | Không |
GITLAB_TOOL_POLICY_APPROVE | Optional comma-separated list of tool names that require explicit approval before execution. | Không |
GITLAB_TOOL_POLICY_HIDDEN | Optional comma-separated list of tool names to hide from tools/list. | Không |
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. | Không |
GITLAB_CA_CERT_PATH | Optional path to a custom CA certificate file for self-managed GitLab instances. | Không |
GITLAB_MASKING_ENABLED | Set to true to mask text tool results and returned errors using built-in or configured rules. | Không |
GITLAB_MASKING_CONFIG | Optional path to a response-masking JSON configuration file. | Không |
GITLAB_MASKING_POLICY_FILE | Optional protected server-owned JSON file containing managed masking policies. | Không |
GITLAB_MASKING_WORKSPACE_DIR | Directory 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_filesvàget_merge_request_file_diff: xem lại merge request theo hai bướcget_pipeline_job_output: đọc nhật ký job có phân trangdiscover_tools: bật thêm các nhóm công cụhelpexecute_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ì
npm install -g @zereight/mcp-gitlab, rồi dùng binary zereight-mcp-gitlab.Skill đi kèm tốt
MCP hay skill?
MCP cho agent đôi tay. Skill dạy cách dùng đôi tay đó đúng cách. Kết hợp lại, kết quả tốt hơn và tốn ít token hơn.
gitlab-automationCho phép agent của bạn tự động hóa quản lý dự án trên GitLab. Hỗ trợ kiểm soát issue, merge request và pipeline bằng lập trình.building-devsecops-pipeline-with-gitlab-ciGiúp agent của bạn đưa bảo mật vào quy trình phát triển. Công cụ kiểm tra mã và ứng dụng để tìm lỗi trước khi phát hành.github-gitlabCho agent quyền truy cập các dự án GitHub hoặc GitLab để kiểm tra issue, pull request và lịch sử, và thực hiện các thay đổi nhỏ đã được duyệt.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.