mcp-gitlab-jira

mcp-gitlab-jira

A Model Context Protocol (MCP) server for GitLab and Jira integration. This server allows AI agents like gemini-cli to interact with your GitLab and Jira instances.

Category
访问服务器

README

MCP GitLab Jira Server

A Model Context Protocol (MCP) server for GitLab and Jira integration. This server allows AI agents like gemini-cli to interact with your GitLab and Jira instances.

Features

GitLab

  • Projects: List all accessible projects or filter them by name.
  • Merge Requests: List merge requests for a project, get detailed information (including diffs), add comments, and assign reviewers.
  • Files: Get the content of a specific file at a given SHA.
  • Releases: List all releases for a project or filter them since a specific version.
  • Users: List project members, get a user's ID by username, and get user activities.

Jira

  • Tickets: Get detailed information about a ticket, get comments, add comments, search for tickets using JQL, create new tickets, get available transitions, update tickets, and transition tickets to a new status.

Setup

Prerequisites

  • Node.js 18+
  • GitLab Personal Access Token with API access
  • Jira API Token
  • Access to a GitLab instance (on-premise or GitLab.com)
  • Access to a Jira instance

Installation

  1. Install the package globally:

    npm i -g mcp-gitlab-jira
    
  2. Set up environment variables:

    # 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"
    
  3. Test the server manually:

    # Test that the server starts without errors
    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 MCP Clients

Configuration for gemini-cli or other MCP clients

Create or update your MCP configuration file (usually ~/.mcp/config.json or similar):

{
  "mcpServers": {
    "gitlab-jira-mcp": {
      "command": "mcp-gitlab-jira",
      "env": {
        "GITLAB_URL": "https://your-gitlab-instance.com",
        "GITLAB_ACCESS_TOKEN": "your-personal-access-token",
        "ATLASSIAN_SITE_NAME": "your-atlassian-site-name",
        "ATLASSIAN_USER_EMAIL": "your-email@example.com",
        "ATLASSIAN_API_TOKEN": "your-jira-api-token"
      }
    }
  }
}

Running with Docker

You can also run this MCP server in a Docker container using the pre-built image from Docker Hub.

Available Docker Images

The Docker images are automatically built and published to Docker Hub for each release:

  • Latest release: hainanzhao/mcp-gitlab-jira:latest
  • Specific versions: hainanzhao/mcp-gitlab-jira:v0.1.2, hainanzhao/mcp-gitlab-jira:v0.1.1, etc.
  • View all available tags: Docker Hub - mcp-gitlab-jira

The images are built for multiple architectures: linux/amd64 and linux/arm64 (Apple Silicon compatible).

Usage

  1. Pull and run the Docker 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
    
  2. Alternative: Run without persistent container (one-time execution):

    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
    

Using with MCP Clients (Docker)

You have two options for using the Docker container with MCP clients:

Option 1: Using a persistent container (recommended)

First, start the container as shown above, then update your MCP configuration file. The env block is empty because the necessary environment variables are passed directly to the container using the -e flag in the docker run command.

{
  "mcpServers": {
    "gitlab-jira-mcp": {
      "command": "docker",
      "args": ["exec", "-i", "mcp-gitlab-jira-container", "npm", "start"],
      "env": {}
    }
  }
}

Option 2: Using one-time execution

This runs a new container for each MCP session:

{
  "mcpServers": {
    "gitlab-jira-mcp": {
      "command": "docker",
      "args": [
        "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"
      ],
      "env": {}
    }
  }
}

Available Tools

GitLab Tools

  • gitlab_get_merge_request_details: Fetches detailed information about a GitLab Merge Request, including file diffs.
  • gitlab_get_file_content: Fetches the content of a specific file at a given SHA in a GitLab project.
  • gitlab_add_comment_to_merge_request: Adds a comment to a GitLab Merge Request. Can be a general comment, a reply to an existing discussion, or an inline comment on a specific line.
  • gitlab_list_merge_requests: Lists merge requests for a given GitLab project.
  • gitlab_assign_reviewers_to_merge_request: Assigns reviewers to a GitLab Merge Request.
  • gitlab_list_project_members: Lists all members (contributors) of a given GitLab project.
  • gitlab_list_project_members_by_project_name: Lists all members (contributors) of a given GitLab project by project name.
  • gitlab_list_projects_by_name: Filters GitLab projects by name using a fuzzy, case-insensitive match.
  • gitlab_list_all_projects: Lists all accessible GitLab projects.
  • gitlab_list_all_releases: Fetches releases for a given GitLab project.
  • gitlab_list_releases_since_version: Filters releases for a given GitLab project since a specific version.
  • gitlab_get_user_id_by_username: Retrieves the GitLab user ID for a given username.
  • gitlab_get_user_activities: Fetches activities for a given GitLab user by their username, optionally filtered by date.

Jira Tools

  • jira_get_jira_ticket_details: Fetches detailed information about a Jira ticket.
  • jira_get_jira_ticket_comments: Fetches comments for a Jira ticket.
  • jira_add_comment_to_ticket: Adds a comment to a Jira ticket.
  • jira_search_tickets_by_jql: Searches for Jira tickets using a JQL (Jira Query Language) string.
  • jira_create_ticket: Creates a new Jira ticket with given fields.
  • jira_get_available_transitions: Fetches available transitions for a Jira ticket.
  • jira_update_ticket: Updates a Jira ticket summary, description, labels.
  • jira_update_custom_fields: Updates custom fields on a Jira ticket.
  • jira_transition_ticket: Transitions a Jira ticket to a new status.

Troubleshooting

Common Issues

  1. "Cannot find module" errors: If you are developing locally, make sure you've run npm install and npm run build.
  2. Authentication errors: Verify your GITLAB_ACCESS_TOKEN, ATLASSIAN_USER_EMAIL, and ATLASSIAN_API_TOKEN have the necessary permissions.
  3. Connection errors: Ensure your GITLAB_URL and ATLASSIAN_SITE_NAME are correct and accessible.
  4. Server not responding: Check that the MCP server process is running and the path in your config is correct.

Debug Mode

To see detailed logs, you can run the server directly:

export GITLAB_URL="your-url"
export GITLAB_ACCESS_TOKEN="your-token"
export ATLASSIAN_SITE_NAME="your-atlassian-site-name"
export ATLASSIAN_USER_EMAIL="your-email@example.com"
export ATLASSIAN_API_TOKEN="your-jira-api-token"
mcp-gitlab-jira

Development

For development, clone the repository and install the dependencies.

npm install
npm run build

Local Docker Development

To test the Docker build locally before pushing:

# Build and test the Docker image locally
./scripts/build-docker-local.sh

This script will build the Docker image and run basic tests to ensure it works correctly.

For maintainers: See Docker Setup Guide for information about setting up automated Docker Hub publishing.

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

  1. Add new methods to the GitLabService or JiraService class.
  2. Define new tools in the allTools array in index.ts.
  3. Add a corresponding case in the tool handler in index.ts.
  4. Rebuild with npm run build.

License

ISC

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选