Purpose
mcp-gitlab-jira is a Model Context Protocol (MCP) server for integrating GitLab and Jira into AI agent workflows. It allows AI agents such as gemini-cli to interact with the user's GitLab and Jira instances, thereby directly managing projects, code reviews, CI/CD, and tickets within conversations or automated processes.
Main Capabilities
This server provides a rich set of tools covering common operations in GitLab and Jira:
GitLab Features
- Projects: List all accessible projects, or filter fuzzily by name.
- Merge Requests: List merge requests, get detailed information (including file diffs), add comments, assign reviewers.
- Pipelines/CI/CD: Get pipeline status, trigger, retry, or cancel pipelines, get job details and logs.
- Branch Management: List, create, delete branches, get branch details.
- Issue Management: Create, list, update, close issues, manage comments.
- Files: Get the content of a specific file at a specified SHA.
- Releases: List all releases of a project, or filter by a specific version.
- Users: List project members, get a user ID by username, get user activity.
Jira Features
- Tickets: Get ticket details (flattened fields, including custom fields), comments, add comments, search tickets using JQL, create new tickets, get available status transitions, update tickets, transition ticket status.
- Project Management: Get all projects, project details, components, and versions.
- Fields and Custom Fields: Get a list of all fields, update custom fields, update priority (automatically matches fuzzy strings), update sprint (automatically matches active and future sprints).
Usage
Prerequisites
- A GitLab personal access token with API access permissions
- An accessible GitLab instance (self-hosted or GitLab.com)
- An accessible Jira instance
Installation
Install the npm package globally:
npm i -g mcp-gitlab-jira
Environment Variable Configuration
# GitLab
export GITLAB_URL="https://your-gitlab-instance.com"
export GITLAB_ACCESS_TOKEN="your-personal-access-token"
# Jira
export ATLASSIAN_SITE_NAME="your-atlassian-site-name"
export ATLASSIAN_USER_EMAIL="your-email@example.com"
export ATLASSIAN_API_TOKEN="your-jira-api-token"
Manual Testing
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}' | mcp-gitlab-jira
The server should start and log "GitLab/Jira MCP server started" to stderr.
Using with an MCP Client
Create or update the MCP configuration file (usually ~/.mcp/config.json or similar).
Running with Docker
You can use the prebuilt images on Docker Hub. Images are automatically built and published for each version:
- Latest version: hainanzhao/mcp-gitlab-jira:latest
- Specific versions: hainanzhao/mcp-gitlab-jira:v0.1.2, v0.1.1, etc. The images support multiple architectures: linux/amd64 and linux/arm64 (compatible with Apple Silicon).
Pull and run the container:
docker run -d --name mcp-gitlab-jira-container \
-e GITLAB_URL="https://your-gitlab-instance.com" \
-e GITLAB_ACCESS_TOKEN="your-personal-access-token" \
-e ATLASSIAN_SITE_NAME="your-atlassian-site-name" \
-e ATLASSIAN_USER_EMAIL="your-email@example.com" \
-e ATLASSIAN_API_TOKEN="your-jira-api-token" \
hainanzhao/mcp-gitlab-jira:latest
One-off execution (no persistent container):
docker run --rm -i \
-e GITLAB_URL="https://your-gitlab-instance.com" \
-e GITLAB_ACCESS_TOKEN="your-personal-access-token" \
-e ATLASSIAN_SITE_NAME="your-atlassian-site-name" \
-e ATLASSIAN_USER_EMAIL="your-email@example.com" \
-e ATLASSIAN_API_TOKEN="your-jira-api-token" \
hainanzhao/mcp-gitlab-jira:latest
Applicable Scenarios
- AI agent-assisted code review: automatically retrieve merge request details and diffs, add comments, or assign reviewers.
- Automated CI/CD management: trigger, retry, or cancel pipelines via natural language, and view job logs.
- Project and issue management: create, update, and search Jira issues in AI conversations, and manage sprints and priorities.
- Cross-platform collaboration: unify the operation entry points for GitLab and Jira, reducing context switching.
Limitations
- Requires a valid GitLab personal access token and Jira API token, with the corresponding permissions.
- Requires accessible GitLab and Jira instances.
- Some features (such as updating priorities and sprints) rely on fuzzy string matching and may be affected by field naming and available options.
- The documentation does not provide specific details on fees, pricing, or platform compatibility.
Troubleshooting
- "Cannot find module" error: During local development, ensure that npm install and npm run build have been run.
- Authentication errors: Verify that GITLAB_ACCESS_TOKEN, ATLASSIAN_USER_EMAIL, and ATLASSIAN_API_TOKEN have the necessary permissions.
- Connection errors: Ensure that GITLAB_URL and ATLASSIAN_SITE_NAME are correct and accessible.
- Server not responding: Check whether the MCP server process is running and whether the paths in the configuration are correct.
Project Structure
- src/index.ts: Main MCP server implementation
- src/gitlab.service.ts: GitLab API client
- src/gitlab.ts: GitLab type definitions
- src/jira.service.ts: Jira API client
- src/jira.ts: Jira type definitions
- dist/: Compiled JavaScript output
Adding New Features
- Add a new method to the GitLabService or JiraService class.
- Define a new tool in the allTools array in index.ts.
- Add the corresponding case in the tool handler in index.ts.
- Use npm run build to rebuild.