有官方的 GitLab MCP 服务器吗?
有。GitLab 在 GitLab.com、Self-Managed 和 Dedicated 上提供自己的 MCP 服务器,地址为 `/api/v4/mcp`。本页收录的 `@modelcontextprotocol/server-gitlab` 是已归档的参考实现,并非 GitLab 的产品。

@modelcontextprotocol
基本信息
Model Context Protocol 服务器
使用下面的配置,将此服务器添加到你的 MCP 客户端。
{
"mcpServers": {
"gitlab": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-gitlab"
],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>",
"GITLAB_API_URL": "https://gitlab.com/api/v4"
}
}
}
}Create or update a single file in a GitLab project
Search for GitLab projects
Create a new GitLab project
Get the contents of a file or directory from a GitLab project
Push multiple files to a GitLab project in a single commit
Create a new issue in a GitLab project
Create a new merge request in a GitLab project
Fork a GitLab project to your account or specified namespace
Create a new branch in a GitLab project
GitLab MCP Server 是一个 gitlab mcp 集成,让 AI 助手可以通过 GitLab API 搜索项目、读取文件、推送提交,并创建 issue、分支、fork 和合并请求。本页收录的是已归档的参考版本;GitLab 现在已提供官方维护的 MCP 服务器。
本页收录的软件包 @modelcontextprotocol/server-gitlab 是 Model Context Protocol 项目发布的参考服务器之一。它已迁移到 servers-archived 仓库,该仓库说明其中的服务器不再维护、也不提供任何安全保证,npm 上的该软件包也已标记为不再支持。新部署请使用官方 GitLab MCP 服务器,它是内置于 GitLab 的远程端点,地址为 /api/v4/mcp。下文同时介绍这两种方式。
前提条件:在 GitLab.com 上需为你的顶级群组允许访问 MCP 服务器;在 GitLab Self-Managed 和 GitLab Dedicated 上需为实例允许访问。认证使用 OAuth:首次连接时,客户端会自行注册(OAuth 2.0 Dynamic Client Registration),打开浏览器,由你批准请求。服务器也接受带有 MCP 工具权限的细粒度个人访问令牌,但不接受旧版个人访问令牌、项目访问令牌或群组访问令牌。
在下面的示例中,将 <gitlab.example.com> 替换为 gitlab.com 或你的自托管实例 URL。
claude mcp add -s user --transport http GitLab https://<gitlab.example.com>/api/v4/mcp
启动 claude,输入 /mcp,选择 GitLab 服务器,然后在浏览器中批准授权。
需要 Node.js 20 或更高版本。将以下内容添加到 claude_desktop_config.json,然后重启 Claude Desktop:
{
"mcpServers": {
"GitLab": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://<gitlab.example.com>/api/v4/mcp"]
}
}
}
在 Settings > Cursor Settings > Tools & MCP 中,向 mcp.json 添加一个新的 MCP 服务器:
{
"mcpServers": {
"GitLab": {
"type": "http",
"url": "https://<gitlab.example.com>/api/v4/mcp"
}
}
}
打开命令面板,运行 MCP: Add Server,选择 HTTP,输入 https://<gitlab.example.com>/api/v4/mcp,ID 填 GitLab,然后批准 OAuth 请求。
codex mcp add GitLab --url "https://<gitlab.example.com>/api/v4/mcp"
codex mcp login GitLab
GitLab 文档还要求在 ~/.codex/config.toml 的 [features] 中启用 rmcp_client。
创建一个带 api 权限范围的 GitLab 个人访问令牌(只读访问可用 read_api),然后通过 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"
}
}
}
}
GITLAB_API_URL 为可选项,仅自托管实例需要。README 还提供了 Docker 镜像 mcp/gitlab。
https://<instance>/api/v4/mcp 并用 OAuth 登录即可。core、merge_requests、work_items、repository、ci 等工具组(toolsets),可通过 X-Gitlab-Enabled-Mcp-Server-Toolsets 请求头选择。X-Gitlab-Mcp-Server-Tool-Name-Prefix 请求头为工具名添加前缀,便于同时连接多个 GitLab 实例。已归档的参考服务器提供本页列出的九个工具:
search_repositories、create_repository、fork_repository、create_branch、get_file_contents。create_or_update_file 写入单个文件,push_files 在一次提交中推送多个文件。create_issue 和 create_merge_request(支持草稿)。官方 GitLab MCP 服务器提供更丰富且持续维护的工具集,包括 get_merge_request_diffs、save_merge_request_review、list_pipelines、get_job、list_work_items、semantic_search,以及 Ultimate 版的漏洞相关工具。最新列表请参阅 GitLab 的 MCP 服务器工具文档。
403 Forbidden(GitLab 19.4 及更早版本为 404 Not Found):你的群组或实例未允许 MCP 服务器,或你使用了旧版个人、项目或群组访问令牌。请检查前提条件,并改用 OAuth 或细粒度令牌。429 Too Many Requests: 触发了 MCP 或 API 速率限制;在限制重置前请求都会失败。mcp-remote 时 OAuth 反复失败: 用 rm -rf ~/.mcp-auth/mcp-remote* 删除本地认证缓存后重新连接。GITLAB_PERSONAL_ACCESS_TOKEN 具有 api 权限范围;自托管 GitLab 的 GITLAB_API_URL 需以 /api/v4 结尾。有。GitLab 在 GitLab.com、Self-Managed 和 Dedicated 上提供自己的 MCP 服务器,地址为 `/api/v4/mcp`。本页收录的 `@modelcontextprotocol/server-gitlab` 是已归档的参考实现,并非 GitLab 的产品。
GitLab 文档列出官方服务器适用于 Free、Premium 和 Ultimate 版本。部分工具组需要付费功能,例如漏洞工具需要 Ultimate。归档软件包是 MIT 许可的开源项目。
不再维护。它现在位于 servers-archived 仓库,该仓库说明不再提供更新或安全修复,npm 也已将该软件包标记为不再支持。
官方服务器通过浏览器使用 OAuth,或使用带 MCP 工具权限的细粒度个人访问令牌。归档服务器需要在 `GITLAB_PERSONAL_ACCESS_TOKEN` 中填写个人访问令牌。
支持。GitLab 文档提供了 Claude Code、Claude Desktop、Cursor、VS Code 中的 GitHub Copilot、Codex、Gemini CLI、Kiro、OpenCode、Zed 和 Amazon Q Developer 的配置说明。
官方 gitlab mcp server 是基于 HTTP 的远程服务;不支持 HTTP 的客户端可通过 stdio 使用 `mcp-remote` 代理。归档服务器通过 `npx` 或 Docker 在本地以 stdio 方式运行。
支持。将官方服务器 URL 指向你的实例,或为归档服务器设置 `GITLAB_API_URL`。
工具以你的权限执行,因此代理只能访问你本人能访问的内容。GitLab 提醒你需自行防范提示注入,因此只应在可信的 GitLab 内容上使用这些工具。
MCP server that enables AI assistants to interact with Linear project management system through natural language, allowing users to retrieve, create, and update issues, projects, and teams.
Yuque mcp server
A server that integrates Linear's project management system with the Model Context Protocol (MCP) to allow LLMs to interact with Linear.
Put an end to code hallucinations! GitMCP is a free, open-source, remote MCP server for any GitHub project
评论