@archisbhoir/gitlabmcp
v1.1.3
Published
GitLab Merge Request Viewer via MCP
Downloads
549
Readme
GitLab Merge Request Viewer via MCP
A GitLab Merge Request viewer that fetches MR data (commits, pipelines, approvals, diffs, discussions) using GitLab GraphQL + REST APIs.
Quick Start
Using npx
# Stdio server (for MCP clients like Claude Desktop)
npx @archisbhoir/gitlabmcp@latest
# HTTP server (for REST API access)
npx -p @archisbhoir/gitlabmcp@latest node dist/server-http.jsSet environment variables:
export GITLAB_BASE_URL=https://gitlab.example.com
export GITLAB_TOKEN=your_token_hereInstall from npm
npm install -g @archisbhoir/gitlabmcp
# Run stdio server
gitlabmcp
# Run HTTP server
gitlabmcp-httpConfiguration
Create .env file or set environment variables:
GITLAB_BASE_URL=https://gitlab.example.com
GITLAB_TOKEN=your_token_hereNote: Token needs read_api or api scope to access merge requests.
MCP Client Configuration
Stdio (Claude Desktop)
{
"mcpServers": {
"gitlab-mcp": {
"command": "npx",
"args": ["@archisbhoir/gitlabmcp@latest"],
"env": {
"GITLAB_BASE_URL": "https://gitlab.example.com",
"GITLAB_TOKEN": "your_token_here"
}
}
}
}HTTP
{
"mcpServers": {
"gitlab-mcp": {
"url": "http://localhost:8080/mcp",
"transport": "http"
}
}
}MCP Tools
get_merge_request
Fetch a complete merge request with all data.
Parameters:
projectPath(required): Full project path (e.g.,"group/project")iid(required): Merge request IID (e.g.,"123")includeCommits(optional): Include commits (default:true)includeDiscussions(optional): Include discussions (default:true)includeDiffs(optional): Include diffs/changes (default:false)includeApprovals(optional): Include approval details (default:false)forceRefresh(optional): Bypass cache (default:false)
get_merge_request_commits
Fetch all commits for a merge request.
Parameters:
projectPath(required): Full project pathiid(required): Merge request IID
get_merge_request_discussions
Fetch all discussions for a merge request.
Parameters:
projectPath(required): Full project pathiid(required): Merge request IID
get_merge_request_diffs
Fetch diffs/changes for a merge request.
Parameters:
projectPath(required): Full project pathiid(required): Merge request IID
get_merge_request_approvals
Fetch approval details for a merge request.
Parameters:
projectPath(required): Full project pathiid(required): Merge request IID
get_merge_requests_by_user
Fetch all merge requests for a username.
Parameters:
username(required): GitLab usernameprojectPath(optional): Filter by project pathstate(optional): Filter by state ("opened","closed","locked","merged")
create_merge_request
Create a new merge request. Requires api scope in token.
Parameters:
projectPath(required): Full project pathsourceBranch(required): Source branchtargetBranch(required): Target branchtitle(required): Merge request titledescription(optional): DescriptionassigneeIds(optional): Array of user IDsreviewerIds(optional): Array of user IDslabels(optional): Array of label namesremoveSourceBranch(optional): Remove source branch when mergedsquash(optional): Squash commits when merging
health_check
Check GitLab connectivity and version.
HTTP Server Endpoints
When running the HTTP server (gitlabmcp-http):
GET /health- Health checkPOST /mcp- MCP protocol endpointGET /api/tools- List available toolsPOST /api/tools/:toolName- Call a tool via REST API
Library Usage
npm install @archisbhoir/gitlabmcpimport {
getMergeRequestView,
fetchAllCommits,
fetchAllDiscussions,
getMRChangesRest,
getMRApprovalsRest,
} from '@archisbhoir/gitlabmcp';
// Get complete MR view
const view = await getMergeRequestView('group/project', '123');
// Fetch all commits
const commits = await fetchAllCommits('group/project', '123');
// Fetch all discussions
const discussions = await fetchAllDiscussions('group/project', '123');
// Get diffs and approvals via REST
const changes = await getMRChangesRest('group/project', '123');
const approvals = await getMRApprovalsRest('group/project', '123');Development
npm install
npm run build
npm testLicense
MIT
