mcp-gitlab-crunchtools
MCP GitLab CrunchTools
一个安全的 MCP(模型上下文协议)服务器,用于 GitLab 项目、合并请求、问题、流水线和搜索。适用于任何 GitLab 实例(gitlab.com、自托管或企业版)。
概述
此 MCP 服务器设计为:
默认安全 - 全面的威胁建模、输入验证和令牌保护
无第三方服务 - 通过 stdio 在本地运行,您的 API 令牌永远不会离开您的机器
多实例 - 通过可配置的 URL 支持 gitlab.com、自托管 GitLab 或企业实例
跨平台 - 支持 Linux、macOS 和 Windows
自动更新 - GitHub Actions 监控 CVE 并更新依赖
容器化 - 可在
quay.io/crunchtools/mcp-gitlab获取,基于 Hummingbird Python 基础镜像构建
Related MCP server: gitlab-mcp-server
命名约定
组件 | 名称 |
GitHub 仓库 | |
容器 |
|
Python 包(PyPI) |
|
CLI 命令 |
|
模块导入 |
|
为什么选择 Hummingbird?
容器镜像基于 Project Hummingbird 的 Hummingbird Python 基础镜像 构建,该镜像提供:
最小的 CVE 暴露 - 使用最小的软件包集构建,大幅减少攻击面
定期更新 - 及时应用安全补丁
针对 Python 优化 - 预配置的 Python 环境,使用 uv 包管理器
生产就绪 - 正确的信号处理和非 root 用户默认设置
功能
项目管理(5 个工具)
list_projects- 列出项目,支持过滤和搜索get_project- 按 ID 或路径获取项目详情list_project_branches- 列出仓库分支get_project_branch- 获取单个分支list_project_commits- 列出提交,支持日期/路径过滤
组管理(3 个工具)
list_groups- 列出组,支持过滤get_group- 按 ID 或路径获取组详情list_group_projects- 列出组中的项目(支持子组)
合并请求(7 个工具)
list_merge_requests- 按状态、标签、里程碑列出 MRget_merge_request- 获取 MR 详情create_merge_request- 创建新的 MRupdate_merge_request- 更新 MR 标题、描述、状态、指派人员list_mr_notes- 列出 MR 上的评论create_mr_note- 向 MR 添加评论get_mr_changes- 获取 MR 的差异
问题(6 个工具)
list_issues- 按状态、标签、里程碑、指派人员列出问题get_issue- 获取问题详情create_issue- 创建新问题update_issue- 更新问题标题、描述、状态、标签list_issue_notes- 列出问题上的评论create_issue_note- 向问题添加评论
流水线(4 个工具)
list_pipelines- 列出 CI/CD 流水线,支持状态过滤get_pipeline- 获取流水线详情list_pipeline_jobs- 列出流水线中的作业get_job_log- 获取作业日志输出
搜索(2 个工具)
search_global- 在所有可访问的 GitLab 资源中搜索search_project- 在特定项目中搜索
安装
使用 uvx(推荐)
uvx mcp-gitlab-crunchtools使用 pip
pip install mcp-gitlab-crunchtools使用容器
podman run -e GITLAB_TOKEN=your_token \
quay.io/crunchtools/mcp-gitlab配置
环境变量
变量 | 必需 | 默认值 | 描述 |
| 是 | — | 个人访问令牌 |
| 否 |
| GitLab 实例 URL |
创建 GitLab 个人访问令牌
导航到访问令牌
前往 https://gitlab.com/-/user_settings/personal_access_tokens
或:头像 > 偏好设置 > 访问令牌
创建自定义令牌
名称:
mcp-gitlab-crunchtools过期时间:设置适当的日期(建议 90 天)
范围:根据您的需求选择范围
范围选择
范围
访问级别
功能
read_api只读
列出/查看项目、问题、MR、流水线
api完全访问
所有功能,包括创建/更新
复制并存储令牌
立即复制令牌(以
glpat-开头)安全存储在密码管理器中
添加到 Claude Code
claude mcp add mcp-gitlab-crunchtools \
--env GITLAB_TOKEN=your_token_here \
-- uvx mcp-gitlab-crunchtools对于自托管 GitLab:
claude mcp add mcp-gitlab-crunchtools \
--env GITLAB_TOKEN=your_token_here \
--env GITLAB_URL=https://gitlab.example.com \
-- uvx mcp-gitlab-crunchtools对于容器版本:
claude mcp add mcp-gitlab-crunchtools \
--env GITLAB_TOKEN=your_token_here \
-- podman run -i --rm -e GITLAB_TOKEN quay.io/crunchtools/mcp-gitlab使用示例
列出您的项目
User: List my GitLab projects
Assistant: [calls list_projects with membership=true]查看合并请求
User: Show open merge requests for my-org/backend
Assistant: [calls list_merge_requests with project_id="my-org/backend"]创建问题
User: Create an issue in my-org/backend titled "Fix login timeout"
Assistant: [calls create_issue with title="Fix login timeout"]检查流水线状态
User: Show failed pipelines for my-org/api
Assistant: [calls list_pipelines with status="failed"]搜索代码
User: Search for "authentication" in my-org/backend
Assistant: [calls search_project with scope="blobs"]安全
此服务器将安全作为首要关注点。请参阅 SECURITY.md 了解:
威胁模型和攻击向量
纵深防御架构
令牌处理最佳实践
输入验证规则
审计日志
关键安全功能
令牌保护
存储为 SecretStr(永远不会被意外记录)
仅通过环境变量(绝不存储在文件或参数中)
从所有错误消息中清理
输入验证
所有输入使用 Pydantic 模型
项目和组 ID 的允许列表字符验证
路径遍历防护
API 加固
强制 HTTPS(localhost 除外)
TLS 证书验证
请求超时(30 秒)
响应大小限制(10MB)
自动化 CVE 扫描
GitHub Actions 每周扫描依赖
使用 Trivy 进行容器安全扫描
Python 的 CodeQL 分析
开发
设置
git clone https://github.com/crunchtools/mcp-gitlab.git
cd mcp-gitlab
uv sync运行测试
uv run pytest代码检查与类型检查
uv run ruff check src tests
uv run mypy src构建容器
podman build -t mcp-gitlab .许可证
AGPL-3.0-or-later
贡献
欢迎贡献!在提交与安全相关的更改之前,请阅读 SECURITY.md。
链接
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceMCP server for interacting with GitLab API, supporting both self-hosted instances and gitlab.com. Provides tools for managing issues, merge requests, code review, pipelines, milestones, releases, search, and file access.514MIT
- AlicenseAqualityCmaintenanceEnables interacting with GitLab repositories, merge requests, and code through natural language using MCP. Supports authentication with personal access tokens or OAuth2, and provides tools for listing projects, reading repository code, and analyzing merge request lifetimes.104MIT
- Flicense-qualityCmaintenanceExposes the GitLab REST API to MCP clients for managing projects, issues, merge requests, repositories, and CI/CD pipelines. It is multi-tenant, allowing each user to authenticate with their own token and instance URL.
- FlicenseAqualityDmaintenanceEnables LLMs to interact with GitLab via MCP, providing access to issues, merge requests, pipelines, and repository files for browsing, searching, and reading details.19
Related MCP Connectors
GitLab Public MCP — wraps the GitLab REST API v4 (public endpoints, no auth)
Go MCP server for GitLab: 2 dynamic tools reach 1000+ REST/GraphQL actions. Free/CE, no paid tier.
A MCP server built for developers enabling Git based project management with project and personal…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/crunchtools/mcp-gitlab'
If you have feedback or need assistance with the MCP directory API, please join our Discord server