tmustafiz/mcp-server-gitlab
3.2
If you are the rightful owner of mcp-server-gitlab and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
MCP GitLab Repository Analysis Server is a Model Context Protocol server designed for analyzing GitLab repositories, providing tools for LLM coding agents to interact with and analyze these repositories.
Tools
7
Resources
0
Prompts
0
MCP GitLab Repository Analysis Server
A Model Context Protocol (MCP) server for analyzing GitLab repositories. This server provides tools for LLM coding agents to interact with and analyze GitLab repositories.
Features
- MCP-compliant: Implements the MCP spec using
@modelcontextprotocol/sdk
- GitLab Integration: Uses
@gitlab/sdk
for GitLab operations - Git Operations: Uses
simple-git
for repository operations - Modular Tools: All tools are organized in separate modules for extensibility
- Transports: Supports both HTTP (Streamable HTTP) and STDIO
- TypeScript: Fully typed, strict, and documented
- .env Config: Uses
dotenv
for configuration - Docker Support: Easy deployment with Docker and docker-compose
- Extensible: Easy to add custom tools and extend functionality
Installation
npm install mcp-server-gitlab
Docker Installation
# Clone the repository
git clone https://github.com/yourusername/mcp-server-gitlab.git
cd mcp-server-gitlab
# Build and run with Docker
docker-compose up -d
Configuration
Create a .env
file in your project root:
# Server Configuration
PORT=8080
# GitLab Configuration
GITLAB_URL=https://gitlab.com
GITLAB_TOKEN=your_gitlab_token
GITLAB_PROJECT_ID=your_project_id
# Repository Configuration
REPO_BRANCH=main
REPO_PATH=.
# Analysis Configuration
MAX_FILE_SIZE=1048576 # 1MB default
EXCLUDED_PATHS=node_modules,dist,.git
INCLUDED_FILE_TYPES=ts,js,tsx,jsx,json,md
Usage
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { registerAllTools } from "mcp-server-gitlab/tools";
const server = new McpServer({
name: "My MCP Server",
version: "1.0.0"
});
registerAllTools(server);
Docker Usage
# Start the server
docker-compose up -d
# View logs
docker-compose logs -f
# Stop the server
docker-compose down
Built-in Tools
Repository Analysis
search_files
: Search for files in the repository matching the queryget_file_content
: Get the content of a specific fileget_project_info
: Get information about the GitLab projectget_merge_requests
: Get merge requests for the project
Repository Management
create_hotfix
: Create a new hotfix branch from the main branchcommit_changes
: Commit and push changes to the specified branchcreate_merge_request
: Create a merge request for the specified branch
Development
# Clone the repository
git clone https://github.com/yourusername/mcp-server-gitlab.git
cd mcp-server-gitlab
# Install dependencies
npm install
# Build
npm run build
# Start the server
npm start
Development Scripts
npm run build
- Build the TypeScript projectnpm start
- Run the built servernpm run dev
- Run the server in development mode using tsxnpm run release:beta
- Create and publish a beta releasenpm run release:patch
- Create and publish a patch releasenpm run release:minor
- Create and publish a minor releasenpm run release:major
- Create and publish a major releasenpm run docker:build
- Build the Docker imagenpm run docker:run
- Run the Docker container
Dependencies
@modelcontextprotocol/sdk
: ^1.12.1dotenv
: ^16.4.5simple-git
: ^3.22.0@gitlab/sdk
: ^38.1.0glob
: ^10.3.10chalk
: ^5.3.0express
: ^4.18.2
License
MIT