A lightweight MCP (Model Context Protocol) server that exposes GitLab merge request data, commit diffs, and discussions to AI tools like Claude.
Contextify wraps the GitLab API and exposes these MCP tools:
| Tool | Description |
|---|---|
get_authenticated_user |
Get the authenticated GitLab user's info |
get_merge_request_changes |
Full diff and metadata for a merge request |
get_merge_request_commits |
Per-commit diffs for a merge request |
get_merge_request_discussions |
Threaded comments and discussions on a merge request |
get_commit_diff |
Diff for a specific commit |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txtCreate a Personal Access Token with api, read_user, and read_repository scopes.
echo "GITLAB_PRIVATE_TOKEN=glpat-xxxxxxxxxxxxxxxxxxxx" > .envAdd this to your .claude/settings.json (project or user-level):
{
"mcpServers": {
"gitlab-mcp": {
"type": "stdio",
"command": "python",
"args": ["server.py"],
"cwd": "/absolute/path/to/contextify"
}
}
}Claude Code will automatically start and manage the server process.
app/
├── api/gitlab.py # API endpoint definitions
├── client/gitlab_client.py # GitLab HTTP client
├── core/config.py # Settings & env vars
├── responses/ # Pydantic response models
├── utils/formatters.py # Diff parsing & formatting
└── main.py # FastAPI app
server.py # MCP server entry point
pytestpre-commit installRuns Ruff (lint + format), syntax checks, and pytest before each commit.