gitlab-agent-mcp
Enables AI assistants to understand GitLab repositories through on-demand source code discovery and analysis, including locating relevant code, explaining relationships, and summarizing architecture without requiring embeddings or vector databases.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gitlab-agent-mcpanalyze the login module in project 42"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
gitlab-agent-mcp
gitlab-agent-mcp is an MCP server that enables AI assistants to understand GitLab repositories through targeted source code discovery and analysis.
Table of contents:
Related MCP server: code-intel-mcp
Overview
The project was designed to answer repository-specific questions without requiring:
Model fine-tuning
RAG pipelines
Embedding generation
Vector databases
Repository indexing jobs
Instead, the system performs on-demand repository analysis using GitLab's native search capabilities combined with specialized AI agents.
Goals
Provide repository-aware answers using the latest source code directly from GitLab.
Reduce operational complexity by eliminating vector databases and embedding pipelines.
Avoid model fine-tuning for every repository or project.
Minimize token usage by retrieving only relevant files instead of loading the entire repository.
Enable AI assistants to understand implementation details, architecture, and code relationships.
Keep repository knowledge up to date without reindexing or retraining.
What It Can Do
Locate relevant source code from natural language questions.
Discover implementation examples.
Explain relationships between files and components.
Summarize repository architecture.
Identify important classes, functions, and modules.
Provide contextual information to MCP-compatible AI assistants.
Architecture
The repository analysis workflow is built using three specialized AI agents:
1. Repository Discovery Agent
Responsible for understanding the developer's question and generating relevant source code search keywords.
Input:
Developer question
Output:
Search keywords
Example:
Question/Instruction:
Implement JWT functionality and make the project with id = 6358 as a reference
Keywords:
JWT
login
tokenYou can find the Project ID on the main page of the project.
2. Code Relevance Agent
Responsible for analyzing GitLab search results and selecting the most relevant files for the given question.
Input:
Developer question
GitLab search results
Output:
Relevant file candidates
3. Repository Analysis Agent
Responsible for analyzing the selected source files and producing a technical summary, important findings, and code references.
Input:
Developer question
Source code context
Output:
Technical summary
Important files
Key findings
Relevant code examples
Getting Started
Requirements:
Python version 3.13+
Setup UV environment
uv venv
source .venv/bin/activate
uv syncConfiguration
The application is configured using environment variables.
Example:
GITLAB_URL=https://gitlab.com
GITLAB_TOKEN=glxx-NA-xxxxxxxxxxxxxxxxx
OPENAI_USE_TRANSPORT=true
OPENAI_BASE_URL=https://api.openai.com/v1
OPENAI_API_KEY=xxxxx
DISCOVERY_MODEL=gpt-5.5
RELEVANCE_MODEL=gpt-5.5
ANALYSIS_MODEL=gpt-5.5
MAX_SEARCH_RESULTS=20
MAX_FILES=5
MAX_FILE_CHARS=15000
PORT=8000GitLab
Variable | Description |
| GitLab server URL. |
| Personal Access Token used to access repositories and source code. |
LLM Provider
Variable | Description |
| Base URL of an OpenAI-compatible API endpoint. |
| API key used to authenticate requests. |
| Enables custom transport for providers that require non-standard authentication headers. |
The project is provider-agnostic and supports any LLM service that exposes an OpenAI-compatible API.
Examples include:
OpenAI
Azure OpenAI
Ollama
vLLM
LiteLLM
OpenRouter
Local inference gateways
Internal enterprise AI platforms
Example configurations:
OpenAI
OPENAI_BASE_URL=https://api.openai.com/v1
OPENAI_API_KEY=sk-xxxxxxxxOllama
OPENAI_BASE_URL=http://localhost:11434/v1
OPENAI_API_KEY=dummyInternal Gateway
OPENAI_BASE_URL=https://llm.company.com/v1
OPENAI_API_KEY=xxxxxxxxModels
Variable | Description |
| Model used by the Repository Discovery Agent. |
| Model used by the Code Relevance Agent. |
| Model used by the Repository Analysis Agent. |
Models can be different or identical depending on deployment requirements.
Repository Analysis Limits
Variable | Description |
| Maximum number of GitLab search results retrieved before reranking. |
| Maximum number of files selected for analysis. |
| Maximum number of characters loaded from each file. |
Server
Variable | Description |
| MCP server listening port. |
Running
Make sure all required environment variable are set.
python main.py Docker
Build image
docker build -t gitlab-agent-mcp .Running
docker run --rm --env-file .env -p 8000:8000 gitlab-agent-mcpTest with MCP Inspector:
npx -y @modelcontextprotocol/inspector
Claude Code Integration
Installing gitlab-agent-mcp to Claude Code
claude mcp add --transport http mcp_server_code_analyzer http://localhost:8000/mcpTest with Claude Code
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
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/telkomdev/gitlab-agent-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server