Skip to main content
Glama

MCP Server Hero

by namnd00
GITLAB.md4.12 kB
# GitLab Code Review MCP Server A professional GitLab integration server built with the MCP Server Hero framework for code review operations. ## Features 🦊 **GitLab API Integration** - Fetch merge requests with full details (changes, commits, comments) - Get file diffs for merge requests and commits - Compare versions between commits/branches/tags - Add comments to merge requests (including line-specific comments) - Approve/unapprove merge requests - List project merge requests with filtering 🔐 **Security & Authentication** - GitLab token-based authentication - Rate limiting for API calls (30 requests/minute) - Request validation and sanitization - Comprehensive logging and metrics 🛠️ **Enterprise Features** - Built on MCP Server Hero framework - Middleware chain for request processing - Caching and performance monitoring - Professional error handling ## Setup 1. **Get GitLab Personal Access Token** - Go to https://gitlab.com/-/profile/personal_access_tokens - Create token with scopes: `api`, `read_repository` 2. **Configure Environment** ```bash cp .env.example .env # Edit .env and add your GitLab token ``` 3. **Run the Server** ```bash make run-gitlab ``` ## Available Tools ### `fetch_merge_request` Fetch a GitLab merge request with full details including changes, commits, and comments. **Parameters:** - `project_id`: GitLab project ID or URL-encoded path (e.g., "group/project" or "12345") - `merge_request_iid`: Merge request IID (project-specific ID) ### `fetch_merge_request_diff` Get diff for files in a merge request, optionally filtered by file path. **Parameters:** - `project_id`: GitLab project ID or URL-encoded path - `merge_request_iid`: Merge request IID - `file_path` (optional): Specific file path to get diff for ### `fetch_commit_diff` Get diff for a specific commit, optionally filtered by file path. **Parameters:** - `project_id`: GitLab project ID or URL-encoded path - `commit_sha`: Commit SHA - `file_path` (optional): Specific file path to get diff for ### `compare_versions` Compare two commits/branches/tags to see differences. **Parameters:** - `project_id`: GitLab project ID or URL-encoded path - `from_sha`: Source commit/branch/tag - `to_sha`: Target commit/branch/tag ### `add_merge_request_comment` Add a comment to a merge request, optionally at a specific line position. **Parameters:** - `project_id`: GitLab project ID or URL-encoded path - `merge_request_iid`: Merge request IID - `body`: Comment text - `position` (optional): Position data for line comments as JSON string ### `approve_merge_request` Approve a merge request and optionally set required approvals. **Parameters:** - `project_id`: GitLab project ID or URL-encoded path - `merge_request_iid`: Merge request IID - `approvals_required` (optional): Number of required approvals to set ### `get_project_merge_requests` Get all merge requests for a project with optional state filtering. **Parameters:** - `project_id`: GitLab project ID or URL-encoded path - `state` (optional): Filter by state (all, opened, closed, merged, locked) - `limit` (optional): Maximum number to return (1-100, default 20) ## Available Resources ### `gitlab://status` Get GitLab connection status and configuration information. ## Example Usage ```bash # Test the server make test-client-gitlab # Use with MCP Inspector make test-gitlab ``` ## Environment Variables - `GITLAB_TOKEN` (required): Your GitLab personal access token - `GITLAB_HOST` (optional): GitLab host (default: gitlab.com) ## Code Review Workflow 1. **List merge requests**: Use `get_project_merge_requests` to see open MRs 2. **Fetch MR details**: Use `fetch_merge_request` to get full MR information 3. **Review diffs**: Use `fetch_merge_request_diff` for specific file changes 4. **Add comments**: Use `add_merge_request_comment` for feedback 5. **Approve**: Use `approve_merge_request` when ready This server provides a complete GitLab code review workflow through the Model Context Protocol, enabling AI assistants to interact with GitLab repositories for code review tasks.

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/namnd00/mcp-server-hero'

If you have feedback or need assistance with the MCP directory API, please join our Discord server