
gitlab-mcp-server
GitLab MCP 服务器(具有活动跟踪和群组项目列表功能) 此服务器基于原始 GitLab MCP 服务器,并增强了群组项目列表和活动跟踪功能。
Tools
get_project_wiki_page
Get a specific wiki page for a GitLab project
get_group_wiki_page
Get a specific wiki page for a GitLab group
create_project_wiki_page
Create a new wiki page for a GitLab project
create_group_wiki_page
Create a new wiki page for a GitLab group
edit_group_wiki_page
Edit an existing wiki page for a GitLab group
delete_group_wiki_page
Delete a wiki page from a GitLab group
upload_group_wiki_attachment
Upload an attachment to a GitLab group wiki
list_project_members
List all members of a GitLab project (including inherited members)
list_group_members
List all members of a GitLab group (including inherited members)
upload_project_wiki_attachment
Upload an attachment to a GitLab project wiki
list_group_wiki_pages
List all wiki pages for a GitLab group
create_or_update_file
Create or update a single file in a GitLab project
search_repositories
Search for GitLab projects
create_repository
Create a new GitLab project
get_file_contents
Get the contents of a file or directory from a GitLab project
push_files
Push multiple files to a GitLab project in a single commit
create_issue
Create a new issue in a GitLab project
create_merge_request
Create a new merge request in a GitLab project
fork_repository
Fork a GitLab project to your account or specified namespace
create_branch
Create a new branch in a GitLab project
list_group_projects
List all projects (repositories) within a specific GitLab group
get_project_events
Get recent events/activities for a GitLab project
list_commits
Get commit history for a GitLab project
list_issues
Get issues for a GitLab project
list_merge_requests
Get merge requests for a GitLab project
list_project_wiki_pages
List all wiki pages for a GitLab project
edit_project_wiki_page
Edit an existing wiki page for a GitLab project
delete_project_wiki_page
Delete a wiki page from a GitLab project
README
GitLab MCP 服务器
<p align="center"> <img src="./assets/repo-logo.png" alt="GitLab MCP Server Logo" width="200"> </p>
<p align="center"> <a href="https://www.npmjs.com/package/@yoda.digital/gitlab-mcp-server"> <img alt="npm" src="https://img.shields.io/npm/v/@yoda.digital/gitlab-mcp-server?color=blue"> </a> <a href="https://github.com/yoda-digital/mcp-gitlab-server/blob/main/LICENSE"> <img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg"> </a> <a href="https://github.com/yoda-digital/mcp-gitlab-server/actions"> <img alt="CI Status" src="https://github.com/yoda-digital/mcp-gitlab-server/actions/workflows/ci.yml/badge.svg"> </a> <a href="https://github.com/yoda-digital/mcp-gitlab-server/issues"> <img alt="GitHub issues" src="https://img.shields.io/github/issues/yoda-digital/mcp-gitlab-server"> </a> <a href="https://github.com/yoda-digital/mcp-gitlab-server/stargazers"> <img alt="GitHub stars" src="https://img.shields.io/github/stars/yoda-digital/mcp-gitlab-server"> </a> </p>
<p align="center"> <b>一个强大的 Model Context Protocol (MCP) 服务器,用于 GitLab 集成,使 AI 助手能够与您的 GitLab 资源进行交互。</b> </p>
✨ 特性
- 全面的 GitLab API 集成 - 访问存储库、问题、合并请求、Wiki 等
- 支持两种传输方式 - 可与 stdio 或 Server-Sent Events (SSE) 一起使用
- 一致的响应格式 - 标准化的分页和响应结构
- 强大的 TypeScript 类型 - 使用 MCP SDK 构建,保证类型安全
- 完整的文档 - 所有可用工具的示例
🔍 支持的操作
- 存储库管理 - 搜索、创建、Fork 存储库
- 文件处理 - 读取、创建、更新文件
- 分支操作 - 创建和管理分支
- 问题跟踪 - 创建、列出、过滤问题
- 合并请求 - 创建、列出、审查合并请求
- 群组管理 - 列出群组项目和成员
- 项目活动 - 跟踪事件和提交历史
- Wiki 管理 - 完全支持项目和群组 Wiki,包括附件
- 成员管理 - 列出和管理项目/群组成员
🚀 快速开始
安装
从 npm 安装 (推荐)
npm install @yoda.digital/gitlab-mcp-server
从源码安装
# 克隆存储库
git clone https://github.com/yoda-digital/mcp-gitlab-server.git
cd mcp-gitlab-server
# 安装依赖
npm install
# 构建项目
npm run build
配置
环境变量
服务器需要以下环境变量:
变量 | 是否必需 | 默认值 | 描述 |
---|---|---|---|
GITLAB_PERSONAL_ACCESS_TOKEN |
是 | - | 您的 GitLab 个人访问令牌 |
GITLAB_API_URL |
否 | https://gitlab.com/api/v4 |
GitLab API URL |
PORT |
否 | 3000 |
SSE 传输的端口 |
USE_SSE |
否 | false |
设置为 'true' 以使用 SSE 传输 |
GITLAB_READ_ONLY_MODE |
否 | false |
设置为 'true' 以启用只读模式 (见下文) |
只读模式
当 GITLAB_READ_ONLY_MODE
设置为 true
时,服务器将仅公开读取操作。 这对于不应具有对您的 GitLab 资源写入权限的客户端应用程序非常有用。 在只读模式下,以下工具可用:
search_repositories
get_file_contents
list_group_projects
get_project_events
list_commits
list_issues
list_merge_requests
list_project_wiki_pages
get_project_wiki_page
list_group_wiki_pages
get_group_wiki_page
list_project_members
list_group_members
在只读模式下,任何使用写入操作(创建、更新、删除)的尝试都将导致错误。
MCP 设置配置
将 GitLab MCP 服务器添加到您的 MCP 设置文件中:
{
"mcpServers": {
"gitlab": {
"command": "npx",
"args": ["-y", "@yoda.digital/gitlab-mcp-server"],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "your_token_here",
"GITLAB_API_URL": "https://gitlab.com/api/v4"
},
"alwaysAllow": [],
"disabled": false
}
}
}
对于只读模式,添加 GITLAB_READ_ONLY_MODE
环境变量:
{
"mcpServers": {
"gitlab-readonly": {
"command": "npx",
"args": ["-y", "@yoda.digital/gitlab-mcp-server"],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "your_token_here",
"GITLAB_API_URL": "https://gitlab.com/api/v4",
"GITLAB_READ_ONLY_MODE": "true"
},
"alwaysAllow": [],
"disabled": false
}
}
}
用法
使用 stdio 传输 (默认)
# 设置您的 GitLab 个人访问令牌
export GITLAB_PERSONAL_ACCESS_TOKEN=your_token_here
# 运行服务器
npm start
使用 SSE 传输
# 设置您的 GitLab 个人访问令牌并启用 SSE
export GITLAB_PERSONAL_ACCESS_TOKEN=your_token_here
export GITLAB_READ_ONLY_MODE=false
export USE_SSE=true
export PORT=3000 # 可选,默认为 3000
# 运行服务器
npm start
使用 npx
# 直接使用 npx 运行
GITLAB_PERSONAL_ACCESS_TOKEN=your_token_here npx @yoda.digital/gitlab-mcp-server
🛠️ 可用工具
存储库操作
<details> <summary><b>search_repositories</b>: 搜索 GitLab 项目</summary>
{
"search": "project-name",
"page": 1,
"per_page": 20
}
</details>
<details> <summary><b>create_repository</b>: 创建一个新的 GitLab 项目</summary>
{
"name": "new-project",
"description": "A new project",
"visibility": "private",
"initialize_with_readme": true
}
</details>
<details> <summary><b>fork_repository</b>: Fork 一个 GitLab 项目</summary>
{
"project_id": "username/project",
"namespace": "target-namespace"
}
</details>
<details> <summary><b>list_group_projects</b>: 列出特定 GitLab 群组中的所有项目</summary>
{
"group_id": "group-name",
"archived": false,
"visibility": "public",
"include_subgroups": true,
"page": 1,
"per_page": 20
}
</details>
文件操作
<details> <summary><b>get_file_contents</b>: 获取 GitLab 项目中文件的内容</summary>
{
"project_id": "username/project",
"file_path": "path/to/file.txt",
"ref": "main"
}
</details>
<details> <summary><b>create_or_update_file</b>: 在 GitLab 项目中创建或更新单个文件</summary>
{
"project_id": "username/project",
"file_path": "path/to/file.txt",
"content": "File content here",
"commit_message": "Add/update file",
"branch": "main",
"previous_path": "old/path/to/file.txt"
}
</details>
<details> <summary><b>push_files</b>: 在单个提交中将多个文件推送到 GitLab 项目</summary>
{
"project_id": "username/project",
"files": [
{
"path": "file1.txt",
"content": "Content for file 1"
},
{
"path": "file2.txt",
"content": "Content for file 2"
}
],
"commit_message": "Add multiple files",
"branch": "main"
}
</details>
分支操作
<details> <summary><b>create_branch</b>: 在 GitLab 项目中创建一个新分支</summary>
{
"project_id": "username/project",
"branch": "new-branch",
"ref": "main"
}
</details>
问题操作
<details> <summary><b>create_issue</b>: 在 GitLab 项目中创建一个新问题</summary>
{
"project_id": "username/project",
"title": "Issue title",
"description": "Issue description",
"assignee_ids": [1, 2],
"milestone_id": 1,
"labels": ["bug", "critical"]
}
</details>
<details> <summary><b>list_issues</b>: 获取 GitLab 项目的问题并进行过滤</summary>
{
"project_id": "username/project",
"state": "opened",
"labels": "bug,critical",
"milestone": "v1.0",
"author_id": 1,
"assignee_id": 2,
"search": "keyword",
"created_after": "2023-01-01T00:00:00Z",
"created_before": "2023-12-31T23:59:59Z",
"updated_after": "2023-06-01T00:00:00Z",
"updated_before": "2023-06-30T23:59:59Z",
"page": 1,
"per_page": 20
}
</details>
合并请求操作
<details> <summary><b>create_merge_request</b>: 在 GitLab 项目中创建一个新的合并请求</summary>
{
"project_id": "username/project",
"title": "Merge request title",
"description": "Merge request description",
"source_branch": "feature-branch",
"target_branch": "main",
"allow_collaboration": true,
"draft": false
}
</details>
<details> <summary><b>list_merge_requests</b>: 获取 GitLab 项目的合并请求并进行过滤</summary>
{
"project_id": "username/project",
"state": "opened",
"order_by": "created_at",
"sort": "desc",
"milestone": "v1.0",
"labels": "feature,enhancement",
"created_after": "2023-01-01T00:00:00Z",
"created_before": "2023-12-31T23:59:59Z",
"updated_after": "2023-06-01T00:00:00Z",
"updated_before": "2023-06-30T23:59:59Z",
"author_id": 1,
"assignee_id": 2,
"search": "keyword",
"source_branch": "feature-branch",
"target_branch": "main",
"page": 1,
"per_page": 20
}
</details>
项目活动
<details> <summary><b>get_project_events</b>: 获取 GitLab 项目的最新事件/活动</summary>
{
"project_id": "username/project",
"action": "pushed",
"target_type": "issue",
"before": "2023-12-31T23:59:59Z",
"after": "2023-01-01T00:00:00Z",
"sort": "desc",
"page": 1,
"per_page": 20
}
</details>
<details> <summary><b>list_commits</b>: 获取 GitLab 项目的提交历史</summary>
{
"project_id": "username/project",
"sha": "branch-or-commit-sha",
"path": "path/to/file",
"since": "2023-01-01T00:00:00Z",
"until": "2023-12-31T23:59:59Z",
"all": true,
"with_stats": true,
"first_parent": true,
"page": 1,
"per_page": 20
}
</details>
成员操作
<details> <summary><b>list_project_members</b>: 列出 GitLab 项目的所有成员(包括继承的成员)</summary>
{
"project_id": "username/project",
"query": "search term",
"page": 1,
"per_page": 20
}
响应格式:
{
"count": 3,
"items": [
{
"id": 123,
"username": "username",
"name": "User Name",
"state": "active",
"avatar_url": "https://gitlab.com/avatar.png",
"web_url": "https://gitlab.com/username",
"access_level": 50,
"access_level_description": "Owner"
}
// ... 其他成员
]
}
</details>
<details> <summary><b>list_group_members</b>: 列出 GitLab 群组的所有成员(包括继承的成员)</summary>
{
"group_id": "group-name",
"query": "search term",
"page": 1,
"per_page": 20
}
响应格式:
{
"count": 5,
"items": [
{
"id": 456,
"username": "username",
"name": "User Name",
"state": "active",
"avatar_url": "https://gitlab.com/avatar.png",
"web_url": "https://gitlab.com/username",
"access_level": 30,
"access_level_description": "Developer"
}
// ... 其他成员
]
}
</details>
项目 Wiki 操作
<details> <summary><b>list_project_wiki_pages</b>: 列出 GitLab 项目的所有 Wiki 页面</summary>
{
"project_id": "username/project",
"with_content": false
}
</details>
<details> <summary><b>get_project_wiki_page</b>: 获取 GitLab 项目的特定 Wiki 页面</summary>
{
"project_id": "username/project",
"slug": "page-slug",
"render_html": false,
"version": "commit-sha"
}
</details>
<details> <summary><b>create_project_wiki_page</b>: 为 GitLab 项目创建一个新的 Wiki 页面</summary>
{
"project_id": "username/project",
"title": "Page Title",
"content": "Wiki page content",
"format": "markdown"
}
</details>
<details> <summary><b>edit_project_wiki_page</b>: 编辑 GitLab 项目的现有 Wiki 页面</summary>
{
"project_id": "username/project",
"slug": "page-slug",
"title": "New Page Title",
"content": "Updated wiki page content",
"format": "markdown"
}
</details>
<details> <summary><b>delete_project_wiki_page</b>: 从 GitLab 项目中删除一个 Wiki 页面</summary>
{
"project_id": "username/project",
"slug": "page-slug"
}
</details>
<details> <summary><b>upload_project_wiki_attachment</b>: 将附件上传到 GitLab 项目 Wiki</summary>
{
"project_id": "username/project",
"file_path": "path/to/attachment.png",
"content": "base64-encoded-content",
"branch": "main"
}
</details>
群组 Wiki 操作
<details> <summary><b>list_group_wiki_pages</b>: 列出 GitLab 群组的所有 Wiki 页面</summary>
{
"group_id": "group-name",
"with_content": false
}
</details>
<details> <summary><b>get_group_wiki_page</b>: 获取 GitLab 群组的特定 Wiki 页面</summary>
{
"group_id": "group-name",
"slug": "page-slug",
"render_html": false,
"version": "commit-sha"
}
</details>
<details> <summary><b>create_group_wiki_page</b>: 为 GitLab 群组创建一个新的 Wiki 页面</summary>
{
"group_id": "group-name",
"title": "Page Title",
"content": "Wiki page content",
"format": "markdown"
}
</details>
<details> <summary><b>edit_group_wiki_page</b>: 编辑 GitLab 群组的现有 Wiki 页面</summary>
{
"group_id": "group-name",
"slug": "page-slug",
"title": "New Page Title",
"content": "Updated wiki page content",
"format": "markdown"
}
</details>
<details> <summary><b>delete_group_wiki_page</b>: 从 GitLab 群组中删除一个 Wiki 页面</summary>
{
"group_id": "group-name",
"slug": "page-slug"
}
</details>
<details> <summary><b>upload_group_wiki_attachment</b>: 将附件上传到 GitLab 群组 Wiki</summary>
{
"group_id": "group-name",
"file_path": "path/to/attachment.png",
"content": "base64-encoded-content",
"branch": "main"
}
</details>
🔧 开发
要求
- Node.js 16+
- npm 7+
- 具有个人访问令牌的 GitLab 帐户
构建项目
npm run build
运行测试
npm test
代码风格和 Linting
npm run lint
发布流程
- 更新
package.json
中的版本 - 更新 CHANGELOG.md
- 在 GitHub 上创建一个新版本
- 使用
npm publish
发布到 npm
📖 文档
有关更详细的文档,请访问我们的 文档站点 或查看源代码中的 TypeScript 定义。
💼 使用场景
- AI 驱动的开发工作流程 - 使 AI 助手能够与您的 GitLab 存储库进行交互
- 自动化问题和 PR 管理 - 通过 AI 支持简化开发流程
- Wiki 管理 - 自动化文档更新和知识库管理
- 团队协作 - 将 AI 助手集成到您团队的 GitLab 工作流程中
📊 路线图
- [ ] GitLab CI/CD 集成
- [ ] 高级项目分析
- [ ] 综合测试套件
- [ ] 支持 GitLab GraphQL API
- [ ] 扩展的 Webhook 支持
🤝 贡献
欢迎并感谢您的贡献! 以下是您可以贡献的方式:
- Fork 存储库
- 创建您的功能分支 (
git checkout -b feature/amazing-feature
) - 提交您的更改 (
git commit -m 'Add some amazing feature'
) - 推送到分支 (
git push origin feature/amazing-feature
) - 打开一个 Pull Request
请确保适当地更新测试并遵循项目的代码风格。
📝 许可证
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。
👥 贡献者
感谢所有帮助改进此项目的贡献者:
<a href="https://github.com/yoda-digital/mcp-gitlab-server/graphs/contributors"> <img src="https://contrib.rocks/image?repo=yoda-digital/mcp-gitlab-server" /> </a>
特别感谢:
- thomasleveil - 实现了项目和群组的 GitLab 成员列表功能,并具有一致的响应格式
📦 NPM 包
此包可在 npm 上找到: https://www.npmjs.com/package/@yoda.digital/gitlab-mcp-server
推荐服务器

Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。