@redserenity/mcp-gitlab-server
v1.1.0
Published
Token-efficient GitLab MCP server with modular features
Maintainers
Readme
GitLab MCP Server
A token-efficient GitLab MCP server with modular features, supporting both STDIO and StreamableHTTP transports.
Features
- Token-efficient design - Consolidated tools with command parameters to minimize token usage
- Dual transport support - Both STDIO and StreamableHTTP via CLI arguments or environment variables
- Modular features - Enable/disable tool groups via CLI flags
- Innovative IssueTasks tool - Efficiently manage GitLab issue markdown checklists without regenerating entire descriptions
- Caching support - Optional intelligent caching with configurable TTL
- Syntax resource - Dynamic parameter documentation for token-efficient usage
Installation
Method 1: From Source
# Clone the repository
git clone https://gitlab.com/RedSerenity/McpServers/GitLab.git
cd GitLab
# Install dependencies
yarn install
# Build the project
yarn buildMethod 2: Using NPX
# Run directly with npx (no installation required)
npx @redserenity/gitlab-mcp-server --projects --issues --wiki --labelsMethod 3: Using Docker
# Pull and run the Docker image
docker run -e GITLAB_TOKEN=your_token_here \
-e GITLAB_URL=https://gitlab.com \
redserenity/gitlab-mcp-server:latest \
--projects --issues --wiki --labelsConfiguration
Environment Variables
Create a .env file based on .env.example:
# GitLab Configuration
GITLAB_TOKEN=your_gitlab_token_here
GITLAB_URL=https://gitlab.com
# MCP Server Configuration
MCP_TRANSPORT=stdio
MCP_PORT=3000
LOG_LEVEL=info
# Feature Configuration (optional)
ENABLE_PROJECTS=true
ENABLE_ISSUES=true
ENABLE_WIKI=true
ENABLE_LABELS=true
# Resource Configuration (optional)
ENABLE_RESOURCES=true
DISABLE_PROJECT_RESOURCES=false
DISABLE_ISSUE_RESOURCES=false
DISABLE_WIKI_RESOURCES=false
DISABLE_LABELS_RESOURCES=false
# Cache Configuration (optional)
ENABLE_CACHE=true
CACHE_TTL_LIST=300
CACHE_TTL_GET=60
CACHE_MAX_SIZE=1000GitLab Token
You need a GitLab personal access token with appropriate scopes:
api- Full API accessread_user- Read user profileread_repository- Read repository content
Usage
Basic Usage
# STDIO transport (default) with all features
yarn start --projects --issues --wiki --labels
# HTTP transport on port 3000
yarn start --transport=http --port=3000 --projects --issues --wiki --labels
# Enable only specific features
yarn start --projects --issues --labels
# With caching enabled
yarn start --cache --projects --issues --labelsCommand Line Options
--transport <type>- Transport type:stdioorhttp(default:stdio)--port <number>- Port for HTTP transport (default:3000)--projects- Enable Projects and Groups tools--issues- Enable Issues and IssueTasks tools--wiki- Enable Wiki tool--labels- Enable Labels tool--cache- Enable intelligent caching (default: true)--cache-ttl-list <seconds>- List cache TTL in seconds (default: 300)--cache-ttl-get <seconds>- Get cache TTL in seconds (default: 60)--cache-max-size <entries>- Maximum cache entries (default: 1000)--log-level <level>- Log level:debug,info,warn,error(default:info)
Environment Variable Override
You can also use environment variables:
MCP_TRANSPORT=http MCP_PORT=8080 yarn start --projects --issuesTool Architecture
Each tool uses a consolidated command-based architecture to minimize token usage:
Projects Tool (enabled by --projects)
{
"command": "list|get|create|update",
"projectId": "optional-project-id",
"data": { "optional-data-object" },
"bypassCache": "optional-boolean"
}Note: Check the gitlab://syntax resource for detailed parameter documentation.
Commands:
list- List projectsget- Get specific project (requiresprojectId)create- Create new project (requiresdata.name)update- Update existing project (requiresprojectIdanddata)
Groups Tool (enabled by --projects)
{
"command": "list|get|create",
"groupId": "optional-group-id",
"data": { "optional-data-object" }
}Commands:
list- List groupsget- Get specific group (requiresgroupId)create- Create new group (requiresdata.nameanddata.path)
Issues Tool (enabled by --issues)
{
"command": "list|get|create|update|close|reopen",
"projectId": "optional-project-id",
"issueId": "optional-issue-id",
"data": { "optional-data-object" }
}Commands:
list- List issues (optionally filtered byprojectId)get- Get specific issue (requiresprojectIdandissueId)create- Create new issue (requiresprojectIdanddata.title)update- Update existing issue (requiresprojectId,issueId, anddata)close- Close issue (requiresprojectIdandissueId)reopen- Reopen issue (requiresprojectIdandissueId)
IssueTasks Tool (enabled by --issues) - INNOVATION
{
"command": "list|completed|not-completed|update|delete",
"issueId": "required-issue-id",
"projectId": "optional-project-id",
"task": "task-text-or-identifier",
"data": { "optional-data-object" }
}This innovative tool efficiently manages GitLab issue markdown checklists without regenerating entire issue descriptions:
Commands:
list- List all tasks in an issuecompleted- Mark a task as completed (requirestask)not-completed- Mark a task as not completed (requirestask)update- Update task text (requirestaskanddata.newText)delete- Delete a task (requirestask)
Benefits:
- Avoids fetching and regenerating entire issue content
- More token-efficient than traditional approaches
- Precise task management with partial text matching
- Maintains issue formatting and other content
Wiki Tool (enabled by --wiki)
{
"command": "list|get|create|update|delete",
"projectId": "optional-project-id",
"slug": "optional-page-slug",
"data": { "optional-data-object" }
}Commands:
list- List wiki pages (requiresprojectId)get- Get specific wiki page (requiresprojectIdandslug)create- Create new wiki page (requiresprojectId,data.title, anddata.content)update- Update existing wiki page (requiresprojectId,slug, anddata)delete- Delete wiki page (requiresprojectIdandslug)
Labels Tool (enabled by --labels)
{
"command": "list|get|create|update|delete|promote",
"scope": "project|group",
"projectId": "optional-project-id",
"groupId": "optional-group-id",
"labelId": "optional-label-id",
"data": { "optional-data-object" }
}Commands:
list- List labels (requiresprojectIdfor project scope orgroupIdfor group scope)get- Get specific label (requireslabelIdand appropriate scope ID)create- Create new label (requiresdata.name,data.color, and appropriate scope ID)update- Update existing label (requireslabelId, appropriate scope ID, anddata)delete- Delete label (requireslabelIdand appropriate scope ID)promote- Promote project label to group label (requireslabelIdand bothprojectIdandgroupId)
Scopes:
project- Manage labels at project level (default)group- Manage labels at group level
Transport Modes
STDIO Transport (Default)
Best for command-line tools and direct integrations:
yarn start --projects --issues --labelsStreamableHTTP Transport
Best for remote clients and web integrations:
yarn start --transport=http --port=3000 --projects --issues --wiki --labelsAccess via:
- MCP endpoint:
http://localhost:3000/mcp - Health check:
http://localhost:3000/health
Token Efficiency Features
This server is designed to minimize token usage:
- Consolidated Tools - Single tool per domain instead of multiple tools
- Command Parameters - All operations via
commandparameter - Selective Features - Only load requested tool groups
- Efficient IssueTasks - Avoid regenerating entire issue content
- Minimal Schemas - Concise tool descriptions and validation
- Syntax Resource - Dynamic parameter documentation at
gitlab://syntax - Intelligent Caching - Optional caching with configurable TTL to reduce API calls
Development
# Development with auto-rebuild
yarn dev
# Type checking
yarn typecheck
# Clean build artifacts
yarn cleanError Handling
The server includes comprehensive error handling:
- GitLab API errors are properly mapped and returned
- Rate limiting with automatic retry
- Schema validation for all inputs
- Graceful transport disconnection
MCP Server Configuration Examples
STDIO Configuration
Add to your MCP client's mcpServers configuration:
{
"mcpServers": {
"gitlab": {
"command": "node",
"args": [
"/path/to/GitLab/dist/index.js",
"--projects",
"--issues",
"--wiki"
],
"env": {
"GITLAB_TOKEN": "your_gitlab_token_here",
"GITLAB_URL": "https://gitlab.com"
}
}
}
}HTTP Configuration
{
"mcpServers": {
"gitlab": {
"command": "node",
"args": [
"/path/to/GitLab/dist/index.js",
"--transport=http",
"--port=3000",
"--projects",
"--issues",
"--wiki"
],
"env": {
"GITLAB_TOKEN": "your_gitlab_token_here",
"GITLAB_URL": "https://gitlab.com"
}
}
}
}NPX Configuration
{
"mcpServers": {
"gitlab": {
"command": "npx",
"args": [
"@redserenity/gitlab-mcp-server",
"--projects",
"--issues",
"--wiki"
],
"env": {
"GITLAB_TOKEN": "your_gitlab_token_here",
"GITLAB_URL": "https://gitlab.com"
}
}
}
}Docker Configuration
{
"mcpServers": {
"gitlab": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e", "GITLAB_TOKEN=your_gitlab_token_here",
"-e", "GITLAB_URL=https://gitlab.com",
"redserenity/gitlab-mcp-server:latest",
"--projects",
"--issues",
"--wiki"
]
}
}
}Configuration with Caching
For better performance with caching enabled:
{
"mcpServers": {
"gitlab": {
"command": "node",
"args": [
"/path/to/GitLab/dist/index.js",
"--projects",
"--issues",
"--wiki",
"--cache",
"--cache-ttl-list=600",
"--cache-ttl-get=120"
],
"env": {
"GITLAB_TOKEN": "your_gitlab_token_here",
"GITLAB_URL": "https://gitlab.com",
"LOG_LEVEL": "info"
}
}
}
}License
MIT
