gitlab-mcp-server
A read-only MCP server for self-hosted GitLab, enabling listing projects, inspecting branches and commits, browsing file trees, and reading file contents.
README
gitlab-mcp-server
An MCP (Model Context Protocol) server for a self-hosted GitLab instance, focused on browsing projects and repositories. It exposes read-only tools so an MCP client (Claude desktop, Claude Code, etc.) can list projects, inspect branches and commits, browse the file tree, and read file contents.
Tools
| Tool | Purpose |
|---|---|
gitlab_list_projects |
List / search projects, filter by owned or membership |
gitlab_get_project |
Detailed info for one project (default branch, clone URLs, etc.) |
gitlab_list_branches |
List repository branches with their tip commit |
gitlab_list_commits |
List commits, filter by ref / path / date range |
gitlab_get_commit |
Full details and line-change stats for one commit |
gitlab_list_repository_tree |
Browse files & directories at a path (optionally recursive) |
gitlab_get_file |
Read decoded contents of a single file |
All tools are read-only and support pagination (page, per_page) and a response_format of markdown (default) or json.
Requirements
- Node.js 18+
- A GitLab Personal Access Token (PAT)
Setup
npm install
npm run build
Create a Personal Access Token
In GitLab: User Settings → Access Tokens. Create a token with these scopes:
read_api— required for listing projects, branches and commitsread_repository— required for the repository tree and file contents
Keep the token secret. It is read from an environment variable, never stored in code.
Configuration
| Variable | Required | Description |
|---|---|---|
GITLAB_BASE_URL |
yes | Base URL of your instance, e.g. https://gitlab.example.com (no /api/v4 suffix needed) |
GITLAB_TOKEN |
yes | Your Personal Access Token |
TRANSPORT |
no | stdio (default) or http |
PORT |
no | Port for http transport (default 3000) |
Running
# stdio (default — for local MCP clients)
GITLAB_BASE_URL=https://gitlab.example.com GITLAB_TOKEN=glpat-xxxx npm start
# HTTP transport (binds to 127.0.0.1)
TRANSPORT=http PORT=3000 GITLAB_BASE_URL=https://gitlab.example.com GITLAB_TOKEN=glpat-xxxx npm start
Connecting to an MCP client
Most desktop clients use a JSON config block. Point it at the built entry point and supply the environment variables:
{
"mcpServers": {
"gitlab": {
"command": "node",
"args": ["/absolute/path/to/gitlab-mcp-server/dist/index.js"],
"env": {
"GITLAB_BASE_URL": "https://gitlab.example.com",
"GITLAB_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx"
}
}
}
}
Replace the path with the absolute path to dist/index.js on your machine, and fill in your instance URL and token. Restart the client to pick up the new server.
Project structure
gitlab-mcp-server/
├── package.json
├── tsconfig.json
├── README.md
└── src/
├── index.ts # Entry point, transport selection, env validation
├── constants.ts # Config readers and limits
├── types.ts # GitLab resource interfaces
├── schemas/common.ts # Shared Zod schema fragments
├── services/client.ts # Authenticated API client, pagination, errors
└── tools/projects.ts # Tool definitions and registration
Identifying projects
Wherever a project_id is required, you can pass either:
- the numeric project ID, e.g.
42, or - the namespace path, e.g.
mygroup/myrepo(the server URL-encodes it for you).
Notes
- This server only performs read operations. It never creates, edits, or deletes anything in GitLab.
- Large file or list responses are truncated at 25,000 characters; use pagination or narrower filters to retrieve more.
- For development with auto-reload:
npm run dev.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。