GitLab MCP Server
Enables AI agents to interact with GitLab repositories, monitor documentation changes, manage issues and merge requests, and search across projects with comprehensive file and commit operations.
README
GitLab MCP Server for AgenticLedger
A Model Context Protocol (MCP) server that enables AI agents to interact with GitLab repositories, monitor documentation changes, and manage issues and merge requests.
Overview
This MCP server provides comprehensive GitLab integration for the AgenticLedger platform, enabling AI agents to:
- Monitor Documentation Changes: Track commits, compare branches, and detect file modifications
- Read Repository Contents: Access files, directory structures, and wiki pages
- Manage Issues & MRs: Create and track issues, merge requests, and comments
- Search Across GitLab: Find projects, code, commits, and more
Authentication Pattern
- [x] API Key (Direct Personal Access Token)
Token Format
accessToken: "glpat-xxxxxxxxxxxxxxxxxxxx"
GitLab Personal Access Token (PAT) with appropriate scopes:
read_api- For read-only operationsread_repository- For file accessapi- For full access (issues, MRs, wikis)
Creating a Token
- Go to GitLab > Settings > Access Tokens
- Create a new token with required scopes
- Copy the token (starts with
glpat-)
Installation
# Clone the repository
git clone https://github.com/oregpt/Agenticledger_MCP_Gitlab.git
cd Agenticledger_MCP_Gitlab
# Install dependencies
npm install
# Build
npm run build
Configuration
For Claude Code / MCP Clients
Add to your MCP configuration:
{
"mcpServers": {
"gitlab": {
"command": "node",
"args": ["path/to/GitlabMCP/dist/index.js"],
"env": {
"GITLAB_API_URL": "https://gitlab.com/api/v4"
}
}
}
}
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
GITLAB_API_URL |
No | https://gitlab.com/api/v4 |
GitLab API base URL (for self-hosted instances) |
Available Tools
Project Operations
gitlab_search_projects
Description: Search for GitLab projects by name or description.
Parameters:
accessToken(string, required): GitLab Personal Access Tokensearch(string, required): Search querypage(number, optional): Page numberper_page(number, optional): Results per page (1-100)
Example:
{
"accessToken": "glpat-xxxx",
"search": "documentation",
"per_page": 10
}
gitlab_get_project
Description: Get detailed project information.
Parameters:
accessToken(string, required): GitLab PATproject_id(string, required): Project ID or URL-encoded path
gitlab_list_group_projects
Description: List all projects in a group.
Parameters:
accessToken(string, required): GitLab PATgroup_id(string, required): Group ID or pathinclude_subgroups(boolean, optional): Include subgroup projectssearch(string, optional): Filter by nameorder_by(string, optional): Sort fieldsort(string, optional): asc or desc
File Operations
gitlab_get_file_contents
Description: Read file contents from a repository. Essential for documentation monitoring.
Parameters:
accessToken(string, required): GitLab PATproject_id(string, required): Project IDfile_path(string, required): Path to file (e.g., "docs/README.md")ref(string, optional): Branch, tag, or commit SHA
Response:
{
"success": true,
"data": {
"file_name": "README.md",
"file_path": "docs/README.md",
"content": "# Documentation\n...",
"encoding": "base64",
"ref": "main"
}
}
gitlab_get_tree
Description: List files and directories in a repository path.
Parameters:
accessToken(string, required): GitLab PATproject_id(string, required): Project IDpath(string, optional): Directory pathref(string, optional): Branch/tag/SHArecursive(boolean, optional): List recursively
gitlab_create_or_update_file
Description: Create or update a file with a commit.
Parameters:
accessToken(string, required): GitLab PATproject_id(string, required): Project IDfile_path(string, required): Target file pathbranch(string, required): Target branchcontent(string, required): File contentcommit_message(string, required): Commit message
Commit Operations (Critical for Monitoring)
gitlab_list_commits
Description: List recent commits. Primary tool for detecting documentation changes.
Parameters:
accessToken(string, required): GitLab PATproject_id(string, required): Project IDref_name(string, optional): Branch or tagsince(string, optional): ISO 8601 dateuntil(string, optional): ISO 8601 datepath(string, optional): Filter by file pathauthor(string, optional): Filter by author emailwith_stats(boolean, optional): Include stats
Example - Monitor docs folder:
{
"accessToken": "glpat-xxxx",
"project_id": "12345",
"path": "docs/",
"since": "2024-01-01T00:00:00Z",
"with_stats": true
}
gitlab_get_commit_diff
Description: Get file changes for a specific commit.
Parameters:
accessToken(string, required): GitLab PATproject_id(string, required): Project IDsha(string, required): Commit SHA
gitlab_compare
Description: Compare two branches/tags/commits.
Parameters:
accessToken(string, required): GitLab PATproject_id(string, required): Project IDfrom(string, required): Source refto(string, required): Target ref
Activity Monitoring
gitlab_get_project_events
Description: Get recent project activity. Best tool for real-time monitoring.
Parameters:
accessToken(string, required): GitLab PATproject_id(string, required): Project IDaction(string, optional): Filter by action type (pushed, commented, etc.)target_type(string, optional): Filter by target (issue, merge_request, etc.)after(string, optional): Events after this date (ISO 8601)before(string, optional): Events before this date
Example - Monitor push events:
{
"accessToken": "glpat-xxxx",
"project_id": "12345",
"action": "pushed",
"after": "2024-12-01T00:00:00Z"
}
Issue Operations
gitlab_list_issues
List project issues with filtering.
gitlab_get_issue
Get specific issue details.
gitlab_create_issue
Create a new issue.
gitlab_list_issue_notes
List comments on an issue.
Merge Request Operations
gitlab_list_merge_requests
List MRs with filtering.
gitlab_get_merge_request
Get MR details.
gitlab_get_merge_request_changes
Get file changes in an MR.
gitlab_create_merge_request
Create a new MR.
Wiki Operations
gitlab_list_wiki_pages
List all wiki pages.
gitlab_get_wiki_page
Get wiki page content.
gitlab_create_wiki_page
Create a wiki page.
gitlab_update_wiki_page
Update a wiki page.
Search Operations
gitlab_search
Description: Search across GitLab.
Parameters:
accessToken(string, required): GitLab PATsearch(string, required): Search queryscope(string, optional): projects, issues, merge_requests, blobs, commits, etc.project_id(string, optional): Limit to projectgroup_id(string, optional): Limit to group
Response Format
All tools return a standardized response:
{
success: boolean;
data?: any; // Present on success
error?: string; // Present on failure
}
Success Example:
{
"success": true,
"data": {
"id": 12345,
"name": "my-project",
"description": "..."
}
}
Error Example:
{
"success": false,
"error": "Resource not found: /projects/99999"
}
Testing
# Run unit tests
npm test
# Run integration tests (requires GITLAB_TEST_TOKEN)
GITLAB_TEST_TOKEN=glpat-xxx npm run test:integration
Use Case: Documentation Monitoring
This is the primary use case for this MCP server. Here's how to monitor a customer's documentation repo:
Workflow
- Initial Scan: Use
gitlab_get_treeto discover documentation files - Monitor Changes: Periodically call
gitlab_get_project_eventsorgitlab_list_commits - Fetch Updates: When changes detected, use
gitlab_get_file_contentsto read updated files - Process: Feed updated content to your D7 data pipeline
Example Monitoring Script
// 1. Get recent commits affecting docs
const commits = await gitlab_list_commits({
accessToken: "glpat-xxx",
project_id: "customer/docs-repo",
path: "docs/",
since: lastCheckTime,
with_stats: true
});
// 2. For each new commit, get the changes
for (const commit of commits.data) {
const diff = await gitlab_get_commit_diff({
accessToken: "glpat-xxx",
project_id: "customer/docs-repo",
sha: commit.id
});
// 3. Process changed files
for (const file of diff.data) {
if (file.new_path.startsWith('docs/')) {
const content = await gitlab_get_file_contents({
accessToken: "glpat-xxx",
project_id: "customer/docs-repo",
file_path: file.new_path
});
// Update your knowledge base
}
}
}
Platform Integration Notes
Self-Hosted GitLab
Set GITLAB_API_URL to your instance:
{
"env": {
"GITLAB_API_URL": "https://gitlab.yourcompany.com/api/v4"
}
}
Rate Limits
GitLab has rate limits:
- Authenticated: 2000 requests/minute
- Consider pagination for large datasets
- Use
sincefilters to reduce response size
Token Scopes
Minimum required scopes:
| Operation | Required Scope |
|---|---|
| Read files | read_repository |
| Read issues/MRs | read_api |
| Create issues/MRs | api |
| Write files | api |
License
MIT
Contributing
- Fork the repository
- Create a feature branch
- Make changes
- Run tests
- Submit a pull request
Support
For issues, please file a GitHub issue at: https://github.com/oregpt/Agenticledger_MCP_Gitlab/issues
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.