MCP cover image
See in Github
2025-04-14

2

Github Watches

0

Github Forks

2

Github Stars

English Version

Build Status Node Version License

Downloads npm version smithery badge

mcp-server-gitlab image

基于 Model Context Protocol (MCP) 框架构建的 GitLab 集成服务器,提供多种 GitLab RESTful API 工具,支持 Claude、Smithery 等平台集成。

功能概览

  • GitlabSearchUserProjectsTool:根据用户名搜索用户及其活跃项目
  • GitlabGetUserTasksTool:获取当前用户的待办任务
  • GitlabSearchProjectDetailsTool:搜索项目及详细信息
  • GitlabCreateMRCommentTool:为合并请求添加评论
  • GitlabAcceptMRTool:接受并合并合并请求
  • GitlabUpdateMRTool:更新 Merge Request 的指派人、评审人、标题、描述、标签
  • GitlabCreateMRTool:创建新的 Merge Request,支持指派 assignee 和 reviewers
  • GitlabRawApiTool:自定义调用任意 GitLab API

快速开始

# 安装依赖
bun install

# 构建项目
bun run build

# 启动服务
bun run start

环境变量配置

GITLAB_API_URL=https://your-gitlab-instance.com
GITLAB_TOKEN=your_access_token

# 可选:提供用户名到用户 ID 的映射(JSON 字符串)
# 这可以减少 API 调用次数,尤其是在频繁引用相同用户时
# 示例:'{"username1": 123, "username2": 456}'
GITLAB_USER_MAPPING={"username1": 123, "username2": 456}

# 可选:提供项目名称到项目 ID 的映射(JSON 字符串)
# 项目 ID 可以是数字或字符串(如 'group/project')
# 这可以减少 API 调用次数,并确保使用正确的项目
# 示例:'{"project-name-a": 1001, "group/project-b": "group/project-b"}'
GITLAB_PROJECT_MAPPING={"project-name-a": 1001, "group/project-b": "group/project-b"}

工具示例

详见 USAGE.md,包括每个工具的参数示例。

项目结构

src/
├── server/
│   └── GitlabMCPServer.ts          # MCP 服务器入口
├── tools/
│   ├── GitlabAcceptMRTool.ts
│   ├── GitlabCreateMRCommentTool.ts
│   ├── GitlabGetUserTasksTool.ts
│   ├── GitlabRawApiTool.ts
│   ├── GitlabSearchProjectDetailsTool.ts
│   ├── GitlabSearchUserProjectsTool.ts
│   └── gitlab/
│       ├── FieldFilterUtils.ts
│       ├── GitlabApiClient.ts
│       └── GitlabApiTypes.ts
├── utils/
│   ├── is.ts
│   └── sensitive.ts
smithery.json                      # Smithery 配置
USAGE.md                          # 使用示例
package.json
tsconfig.json

集成方式

Claude 桌面客户端

在配置文件中添加:

{
  "mcpServers": {
    "@zephyr-mcp/gitlab": {
      "command": "npx",
      "args": ["-y", "@zephyr-mcp/gitlab@0.1.0"]
    }
  }
}

配置参数:

  • GITLAB_API_URL: GitLab API 的基础 URL
  • GITLAB_TOKEN: 用于验证 GitLab API 请求的访问令牌

相关链接

相关推荐

  • WangRongsheng
  • 🧑‍🚀 全世界最好的LLM资料总结(Agent框架、辅助编程、数据处理、模型训练、模型推理、o1 模型、MCP、小语言模型、视觉语言模型) | Summary of the world's best LLM resources.

  • langgenius
  • Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.

  • av
  • Effortlessly run LLM backends, APIs, frontends, and services with one command.

  • alibaba
  • an easy-to-use dynamic service discovery, configuration and service management platform for building AI cloud native applications.

  • 1Panel-dev
  • 🔥 1Panel provides an intuitive web interface and MCP Server to manage websites, files, containers, databases, and LLMs on a Linux server.

  • microsoft
  • Python tool for converting files and office documents to Markdown.

  • rulego
  • ⛓️RuleGo is a lightweight, high-performance, embedded, next-generation component orchestration rule engine framework for Go.

  • mindsdb
  • AI's query engine - Platform for building AI that can answer questions over large scale federated data. - The only MCP Server you'll ever need

  • hkr04
  • Lightweight C++ MCP (Model Context Protocol) SDK

  • nbonamy
  • Witsy: desktop AI assistant / universal MCP client

  • WangRongsheng
  • 🧑‍🚀 全世界最好的LLM资料总结(视频生成、Agent、辅助编程、数据处理、模型训练、模型推理、o1 模型、MCP、小语言模型、视觉语言模型) | Summary of the world's best LLM resources.

  • labring
  • FastGPT is a knowledge-based platform built on the LLMs, offers a comprehensive suite of out-of-the-box capabilities such as data processing, RAG retrieval, and visual AI workflow orchestration, letting you easily develop and deploy complex question-answering systems without the need for extensive setup or configuration.

    Reviews

    5 (0)