Skip to main content

JIRA MCP for querying JIRA details and lists

Project description

G7 JIRA MCP

一个基于FastMCP框架的JIRA集成插件,用于查询JIRA问题详情、列表及进行基本操作,支持JIRA附件管理。

什么是MCP?

MCP (Model Context Protocol) 是一种为大型语言模型(LLM)提供上下文和工具的标准化协议。它被称为"AI的USB-C接口",提供了统一的方式连接LLM与各种资源和功能。

本项目是一个MCP服务器,专门针对JIRA集成,允许AI通过标准化接口访问JIRA数据和功能,使得人工智能助手能够:

  • 查询和检索JIRA问题
  • 创建和更新工作项
  • 下载和管理附件
  • 执行JIRA相关操作

主要功能

  • 查询JIRA问题详情和问题列表
  • 创建和更新JIRA问题
  • 获取项目列表和详情
  • 管理和下载JIRA问题附件
    • 自动将附件保存到~/.jira_mcp目录
    • 按问题ID组织的子目录结构
    • 支持下载单个或所有附件

安装

前提条件

  • Python 3.10 或更高版本
  • 安装 uv (推荐) 或 pip

安装 uv

uv 是一个快速的 Python 包管理器,推荐用于安装和管理 Python 包。

Linux / macOS

# 使用 curl 安装
curl -sSf https://astral.sh/uv/install.sh | sh

# 或使用 pip 安装
pip install uv

Windows

# 使用 PowerShell 安装
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

# 或使用 pip 安装
pip install uv

验证安装

uv --version

从PyPI安装

# 使用 uv (推荐)
uv pip install g7-jira-mcp

# 或使用 pip
pip install g7-jira-mcp

从GitHub安装

# 使用 uv (推荐)
uv pip install git+https://github.com/YOUR_USERNAME/g7-jira-mcp.git

# 或使用 pip
pip install git+https://github.com/YOUR_USERNAME/g7-jira-mcp.git

本地开发安装

# 克隆仓库
git clone https://github.com/YOUR_USERNAME/g7-jira-mcp.git
cd g7-jira-mcp

# 使用 uv 安装依赖并开发模式安装
uv pip install -e .

# 或使用 pip
pip install -e .

配置

创建一个.env文件,设置以下环境变量:

JIRA_SERVER_URL=http://your-jira-instance.com
JIRA_USERNAME=your_username
JIRA_PASSWORD=your_password
# 或者使用API令牌
JIRA_API_TOKEN=your_api_token

Cursor配置

.cursor/mcp.json 中添加以下配置(推荐使用uvx方式):

{
  "mcpServers": {
    "g7-jira-mcp": {
      "command": "uvx",
      "args": [
        "--from=g7-jira-mcp",
        "g7-jira-mcp",
        "--transport",
        "stdio"
      ],
      "env": {
        "JIRA_SERVER_URL": "http://your-jira-instance.com",
        "JIRA_USERNAME": "your_username",
        "JIRA_PASSWORD": "your_password"
      }
    }
  }
}

如果您已经本地安装了g7-jira-mcp(不推荐),也可以直接使用命令:

{
  "mcpServers": {
    "g7-jira-mcp": {
      "command": "g7-jira-mcp",
      "args": ["--transport", "stdio"],
      "env": {
        "JIRA_SERVER_URL": "http://your-jira-instance.com",
        "JIRA_USERNAME": "your_username",
        "JIRA_PASSWORD": "your_password"
      }
    }
  }
}

其他MCP客户端配置

如果你使用其他支持MCP协议的客户端或IDE,可以使用以下两种方式配置:

基于命令行方式

{
  "command": "g7-jira-mcp",
  "args": ["--transport", "stdio"],
  "env": {
    "JIRA_SERVER_URL": "http://your-jira-instance.com",
    "JIRA_USERNAME": "your_username",
    "JIRA_PASSWORD": "your_password"
  }
}

基于HTTP方式(需要单独运行服务器)

{
  "url": "http://localhost:8000/mcp",
  "headers": {
    "Authorization": "Bearer your_token_if_needed"
  }
}

快速开始

启动MCP服务器

# 使用stdio传输模式(默认,适合IDE集成)
g7-jira-mcp --transport stdio

# 使用sse传输模式(适合Web集成)
g7-jira-mcp --transport sse

# 使用streamable-http模式(适合HTTP调用)
g7-jira-mcp --transport streamable-http --port 8000

命令行工具

# 下载单个附件
g7-jira-extract ERP-161 example.png --output saved_file.png

# 下载问题的所有附件
g7-jira-attachments ERP-161

# 仅列出问题的所有附件,不下载
g7-jira-attachments ERP-161 --list-only

# 输出附件信息到JSON文件
g7-jira-attachments ERP-161 --output attachments.json

在Cursor中使用

配置好mcp.json后,可以在Cursor中使用以下自然语言命令:

查看JIRA问题ERP-161的详情
下载JIRA问题ERP-161的所有附件
搜索所有处于"进行中"状态的JIRA问题

详细文档

更详细的使用指南和API参考,请查看使用指南

MCP提供的工具

本MCP服务器提供以下工具:

工具名称 描述 示例
get_issue 获取JIRA问题详情 ERP-123
search_issues 搜索JIRA问题列表 project = ERP AND status = "In Progress"
create_issue 创建JIRA问题 创建一个标题为"修复登录问题"的任务
update_issue 更新JIRA问题 将ERP-123的状态改为"已完成"
get_projects 获取JIRA项目列表 列出所有可访问的项目
get_project 获取项目详情 获取ERP项目的详细信息
get_issue_attachments 获取问题的所有附件 列出ERP-123的所有附件
download_all_attachments 下载问题的所有附件 下载ERP-123的全部附件
get_attachment_by_filename 获取特定附件 从ERP-123获取名为"截图.png"的附件

开发

安装开发依赖

# 使用 uv
uv pip install -e ".[dev]"

# 或使用 pip
pip install -e ".[dev]"

发布

使用自动化脚本发布

# 使用包含的发布脚本
./scripts/publish.sh

手动构建并发布到PyPI

# 确保已安装构建工具
pip install build twine

# 构建包
python -m build

# 上传到PyPI
python -m twine upload dist/*

许可证

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

g7_jira_mcp-0.1.0.tar.gz (47.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

g7_jira_mcp-0.1.0-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file g7_jira_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: g7_jira_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 47.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for g7_jira_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 64da472469cb7bfc92f4ec2c8581b05f2a69c174af6186f97746106ddedbd024
MD5 946986dc6089a4ec939aa139c9163849
BLAKE2b-256 fec4167e36f59e9dfff9ee8a2a7d06ad434eb7d3fe05a82d07e425ddebf9e928

See more details on using hashes here.

File details

Details for the file g7_jira_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: g7_jira_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for g7_jira_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ce507e13b4623775b420a267ceb6135e3b39561848148e254064a7fb14b76ac
MD5 7c1be8fc3ae97ad56a5cea0be0a5b9ea
BLAKE2b-256 e054ee9cb74db0cbf3de6c41309be427c1a26d81a273093bd3c79ae24015179f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page