GitLab

GitLab MCP Server

✨ Features

  • Comprehensive GitLab API Integration - Access repositories, issues, merge requests, wikis, and more
  • Both Transports Supported - Use with stdio or Server-Sent Events (SSE)
  • Consistent Response Formatting - Standardized pagination and response structures
  • Strong TypeScript Typing - Built with the MCP SDK for type safety
  • Complete Documentation - Examples for all available tools

πŸ” Supported Operations

  • Repository Management - Search, create, fork repositories
  • File Handling - Read, create, update files
  • Branch Operations - Create and manage branches
  • Issue Tracking - Create, list, filter issues
  • Merge Requests - Create, list, review merge requests
  • Group Management - List group projects and members
  • Project Activity - Track events and commit history
  • Wiki Management - Full support for project and group wikis with attachments
  • Member Management - List and manage project/group members

πŸš€ Getting Started

Installation

npm install @yoda.digital/gitlab-mcp-server

From Source

# Clone the repository
git clone https://github.com/yoda-digital/mcp-gitlab-server.git
cd mcp-gitlab-server

# Install dependencies
npm install

# Build the project
npm run build

Configuration

Environment Variables

The server requires the following environment variables:

VariableRequiredDefaultDescription
GITLAB_PERSONAL_ACCESS_TOKENYes-Your GitLab personal access token
GITLAB_API_URLNohttps://gitlab.com/api/v4GitLab API URL
PORTNo3000Port for SSE transport
USE_SSENofalseSet to 'true' to use SSE transport
GITLAB_READ_ONLY_MODENofalseSet to 'true' to enable read-only mode (see below)

Read-Only Mode

When GITLAB_READ_ONLY_MODE is set to true, the server will only expose read operations. This is useful for client applications that shouldn't have write access to your GitLab resources. In read-only mode, the following tools will be available:

  • 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

Any attempt to use write operations (create, update, delete) will result in an error when in read-only mode.

MCP Settings Configuration

Add the GitLab MCP server to your MCP settings file:

{
  "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
    }
  }
}

For read-only mode, add the GITLAB_READ_ONLY_MODE environment variable:

{
  "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
    }
  }
}

Usage

With stdio transport (default)

# Set your GitLab personal access token
export GITLAB_PERSONAL_ACCESS_TOKEN=your_token_here

# Run the server
npm start

With SSE transport

# Set your GitLab personal access token and enable SSE
export GITLAB_PERSONAL_ACCESS_TOKEN=your_token_here
export GITLAB_READ_ONLY_MODE=false
export USE_SSE=true
export PORT=3000  # Optional, defaults to 3000

# Run the server
npm start

With npx

# Run directly with npx
GITLAB_PERSONAL_ACCESS_TOKEN=your_token_here npx @yoda.digital/gitlab-mcp-server

πŸ› οΈ Available Tools

Repository Operations

File Operations

Branch Operations

Issue Operations

Merge Request Operations

Project Activity

Member Operations

Project Wiki Operations

Group Wiki Operations

πŸ”§ Development

Requirements

  • Node.js 16+
  • npm 7+
  • A GitLab account with a personal access token

Building the Project

npm run build

Running Tests

npm test

Code Style and Linting

npm run lint

Release Process

  1. Update version in package.json
  2. Update CHANGELOG.md
  3. Create a new release on GitHub
  4. Publish to npm with npm publish

πŸ“– Documentation

For more detailed documentation, please visit our documentation site or check the TypeScript definitions in the source code.

πŸ’Ό Use Cases

  • AI-powered Development Workflows - Enable AI assistants to interact with your GitLab repositories
  • Automated Issue and PR Management - Streamline development processes with AI support
  • Wiki Management - Automate documentation updates and knowledge base management
  • Team Collaboration - Integrate AI assistants into your team's GitLab workflow

πŸ“Š Roadmap

  • GitLab CI/CD Integration
  • Advanced Project Analytics
  • Comprehensive Test Suite
  • Support for GitLab GraphQL API
  • Extended Webhook Support

🀝 Contributing

Contributions are welcome and appreciated! Here's how you can contribute:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Please make sure to update tests as appropriate and follow the code style of the project.

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘₯ Contributors

Thanks to all the contributors who have helped improve this project:

Special thanks to:

  • thomasleveil - Implemented GitLab member listing functionality for projects and groups with consistent response formatting

πŸ“¦ NPM Package

This package is available on npm:
https://www.npmjs.com/package/@yoda.digital/gitlab-mcp-server