Sponsored by Deepsite.site

@zephyr-mcp/gitlab-gql

Created By
ZephyrDeng10 months ago
Content

@zephyr-mcp/gitlab-gql

A GitLab integration server built on the Model Context Protocol (MCP) framework, providing powerful integration capabilities with GitLab instances. This service can function as a plugin for large language models like Claude, enabling models to securely access GitLab resources through a GraphQL API.

Key Features

  • GitLab GraphQL API Integration: Seamless access to any GitLab instance's GraphQL API with robust query capabilities
  • Project Data Masking: Automatic handling of sensitive data based on project visibility, supporting multiple masking modes to protect private project information
  • Smart URL Processing: Automatic recognition and preservation of GitLab URLs while masking non-GitLab sensitive URLs
  • Cache Management: Efficient caching of project visibility states to reduce unnecessary API requests and improve performance
  • Diverse Query Support: Flexible queries for various GitLab resources including projects, users, groups, and merge requests

Quick Start

# Install dependencies
npm install

# Build the project
npm run build

# Start the service
npm run start

Environment Variables Configuration

The service requires the following environment variables:

GITLAB_API_URL=https://your-gitlab-instance.com  # GitLab instance URL
GITLAB_TOKEN=your_access_token                   # GitLab access token
GITLAB_MASK_MODE=simple                          # Masking mode (options: simple or content, default: simple)

Tool Documentation

GitlabGqlTool

The GitLab GraphQL query tool allows LLMs to execute GraphQL queries to access GitLab data and functionality. The tool supports two masking modes to protect sensitive information while intelligently recognizing GitLab URLs to ensure query result usability.

Masking Modes

The tool supports two masking modes controlled by the GITLAB_MASK_MODE environment variable:

  1. simple (default): Private projects only return id, name, webUrl and visibility fields, with all other information completely hidden
  2. content: Private projects return all fields but sensitive content (such as paths, descriptions, usernames) is masked with "***"

URL Recognition Optimization

The tool features smart URL processing:

  • Automatically recognizes and preserves GitLab domain URLs (based on GITLAB_API_URL environment variable)
  • Masks non-GitLab URLs, preserving only the protocol and domain while hiding paths

Usage Examples

// Search for projects
await mcp.runTool("gitlab_gql", {
  query: "{projects(search: \"project name\") { nodes { id name webUrl visibility } }}",
  queryType: "projects"
});

// Get a specific project
await mcp.runTool("gitlab_gql", {
  query: "{project(fullPath: \"namespace/project\") { id name webUrl visibility }}",
  queryType: "project",
  projectPath: "namespace/project"
});

// User query
await mcp.runTool("gitlab_gql", {
  query: "{user(username: \"username\") { id name username avatarUrl }}",
  queryType: "user",
  requiresVisibility: false
});

// Query projects a user contributes to
await mcp.runTool("gitlab_gql", {
  query: "{user(username: \"username\") { projects(first: 5) { nodes { id name webUrl } } }}",
  queryType: "user",
  requiresVisibility: false
});

// Query a project's merge requests
await mcp.runTool("gitlab_gql", {
  query: "{project(fullPath: \"namespace/project\") { mergeRequests(assigneeUsername: \"username\", first: 5) { nodes { id title state } } }}",
  queryType: "project",
  projectPath: "namespace/project"
});

GitlabGqlResource

Provides access to cached project information, supporting the file:// protocol to allow LLMs to reference previously retrieved GitLab data, improving conversation continuity.

Project Structure

gitlab-gql/
├── src/
│   ├── tools/
│   │   ├── GitlabGqlTool.ts        # GitLab GraphQL query tool
│   │   └── GitlabGqlResource.ts    # GitLab cached resource access
│   └── index.ts                    # Server entry point
├── package.json
└── tsconfig.json

Usage in Claude Desktop Client

NPM Installation

After installation, add the following configuration to the Claude desktop client configuration file:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json

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

Learn More

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Tavily Mcp
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
ChatWiseThe second fastest AI chatbot™
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Serper MCP ServerA Serper MCP Server
CursorThe AI Code Editor
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
DeepChatYour AI Partner on Desktop
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Amap Maps高德地图官方 MCP Server
WindsurfThe new purpose-built IDE to harness magic
Playwright McpPlaywright MCP server