TamarEngel/jira-github-mcp
简介
核心亮点
- 打通 Jira 与 GitHub,实现研发链路闭环
- 在 IDE 中直接处理票据并同步代码状态
- 自动化创建分支、提交 Commit 及发起 PR
- 消除多工具切换,大幅提升开发上下文连续性
完整文档
Jira - GitHub MCP Server
一个模块化且可扩展的 Model Context Protocol (MCP) server,用于 Jira 和 GitHub 的集成,旨在通过 IDE 内部的 AI agent 实现从问题追踪到代码变更及 pull request 管理的开发者工作流端到端自动化。
Overview
- Jira 集成:通过过滤器获取 issue,使用 JQL 搜索,并在工作流中转换 issue 状态
- GitHub 集成:创建 branch,开启并合并 PR
- 本地 Git 操作:在本地进行 stage、commit 和 push 变更
- IDE 原生:通过 stdio 与任何兼容 MCP 的 agent(如 GitHub Copilot)协同工作
- 端到端工作流:Jira issue → branch → code → commit → PR → merge → Jira 状态更新
Why
开发者经常在 Jira、GitHub 和 IDE 之间切换上下文,这会分散注意力并降低交付速度。本项目将该工作流转化为无缝的、IDE 原生的对话式体验,允许开发者使用自然语言和 AI 辅助自动化,直接从 Jira issue 推进到合并 pull request。
Features
- 使用 fields 和 JQL 检索、过滤和搜索 Jira issues
- 在 workflow statuses 之间转换 Jira issues 状态
- 作为 Jira 驱动工作流的一部分,自动化创建 branch
- 从 local Git repository 进行 commit 和 push 变更
- 创建并合并 GitHub pull requests
- 提供 workflow guidance 和 current issue context 的 MCP resources
Available Tools| Tool | Description |
|------|-------------| |jira_get_issue | 通过 key(例如 KAN-1)检索 Jira issue,支持配置字段 |
| jira_search_issues | 使用 JQL 搜索 Jira;支持分页和过滤结果 |
| jira_get_my_issues | 列出分配给当前用户的 issue,可选按状态/类型过滤... |
| jira_transition_issue | 将 issue 转移到另一个状态,可选添加评论 |
| create_branch_for_issue | 基于 Jira issue 创建新的 Git 分支(例如 feature/KAN-15) |
| create_pull_request | 从分支在 GitHub 上创建 PR |
| git_commit_and_push | 暂存所有更改,提交消息并推送到分支 |
| merge_pull_request | 使用 squash、merge 或 rebase 合并 PR;可选检查 CI 状态 |
Project Structure
src/— 应用程序源代码
server/ — MCP server 入口点和工具注册
- config/ — Jira 和 GitHub 的配置加载
- providers/ — Jira/GitHub API 客户端和本地 Git 操作
- tools/ — MCP 工具定义与实现
- resources/ — MCP 资源(工作流指南、issue 上下文)
- prompts/ — server 内部用于引导 agent 行为的 AI prompt
tests/— 集成测试和单元测试
pyproject.toml— 项目元数据和依赖
uv.lock— 依赖锁定文件
Architecture Overview
系统设计和主要组件的高层概述。查看完整架构文档:docs/architecture.md
安装与设置
环境要求
- Python 3.10+
- Git (已添加到 PATH)
- 具有 REST API v3 访问权限的 Jira 实例 (Cloud 或私有部署)
- 具有基于 token 的 API 访问权限的 GitHub 仓库
1. 克隆仓库bashgit clone https://github.com/YOUR-USERNAME/jira-github-mcp.git
cd jira-github-mcp
### 2. 创建并激活虚拟环境
git clone https://github.com/YOUR-USERNAME/jira-github-mcp.git
cd jira-github-mcp使用 uv(推荐)
uv venvpythonpython -m venv .venv使用 uv(推荐):
uv syncpip install -r requirements.txtfastmcp: MCP 协议和服务器实用工具
4. 配置环境变量
在仓库根目录下创建 .env 文件:
# Jira Configuration
JIRA_BASE_URL=https://your-instance.atlassian.net
[email protected]
JIRA_API_TOKEN=your-jira-api-token
GitHub Configuration
GITHUB_TOKEN=your-github-personal-access-token
GIT_REPO_URL=https://github.com/owner/repo.git
GIT_DEFAULT_BRANCH=main
Optional: Local Git Repository Path
If omitted, defaults to the current working directory
GIT_REPO_LOCAL_PATH=/path/to/local/repoJIRA_BASE_URL不应以/结尾
- 仅授予 GitHub PAT 所需的最小权限(branches, pull requests 等)
5. 运行 MCP Server
以 Python 模块形式运行 server:
python -m src.server.serverentrypoint,还可以运行:mcp-server要在 MCP client(例如 VS Code / GitHub Copilot)中使用此 server,请配置 client 从项目根目录运行该 server。
MCP 配置示例:
{
"servers": {
"jira-github-mcp-server": {
"type": "stdio",
"command": "python",
"args": ["-m", "src.server.server"],
"cwd": "/absolute/path/to/jira-github-mcp"
}
}
}/absolute/path/to/mcp-server 替换为仓库的实际路径。
连接到 GitHub Copilot
以下是如何连接并在 Copilot 中开始使用该 server 的步骤:
1. 打开 VS Code 并确保已安装 GitHub Copilot
2. 登录您的 GitHub 账号(如果尚未登录)
3. 将 MCP server 配置添加到 VS Code 设置中(参见上方的 JSON)
4. 重新加载 VS Code
5. 开始向 Copilot 提出自然语言问题——它会自动调用相关 tools
工作原理mermaid%%{init: {'flowchart': {'htmlLabels': true, 'useMaxWidth': false, 'fontSize': 12}}}%%
graph LR
IDE["Your IDE<br/>VS Code + Copilot"]
MCP["MCP Server"]
JIRA["Jira API<br/>(httpx.Async)"]
GITHUB["GitHub API<br/>(httpx.Async)"]
GIT["Local Git"]
IDE -->|ask| MCP
MCP -->|fetch/update| JIRA
MCP -->|create/merge| GITHUB
MCP -->|commit/push| GIT
MCP -->|respond| IDE
## 工作流示例
%%{init: {'flowchart': {'htmlLabels': true, 'useMaxWidth': false, 'fontSize': 12}}}%%
graph LR
IDE["Your IDE<br/>VS Code + Copilot"]
MCP["MCP Server"]
JIRA["Jira API<br/>(httpx.Async)"]
GITHUB["GitHub API<br/>(httpx.Async)"]
GIT["Local Git"]
IDE -->|ask| MCP
MCP -->|fetch/update| JIRA
MCP -->|create/merge| GITHUB
MCP -->|commit/push| GIT
MCP -->|respond| IDE本示例演示了使用 GitHub Copilot 配合此 MCP server 完成从 issue 到 merge 的完整流程。
1. 发现下一个任务
询问 Copilot:
> "What is the most urgent task assigned to me?"
调用 Tools:
- jira_get_my_issues — 列出分配给用户的 issues
- jira_search_issues — 根据状态或紧急程度进行优先级排序
_选定 issue:KAN-42_
2. 开始处理 issue
询问 Copilot:
> "Start work on KAN-42"
调用 Tools:
- jira_get_issue(issue_key="KAN-42")
- create_branch_for_issue(issue_key="KAN-42")
- jira_transition_issue(issue_key="KAN-42", to_status="In Progress")
在编辑器中进行修改。
3. 提交更改
询问 Copilot:
> "Commit my changes with message 'Implement KAN-42'"
调用 Tools:
- git_commit_and_push(message="Implement KAN-42", branch="feature/KAN-42")
4. 创建 pull request
询问 Copilot:
> "Create a PR for KAN-42"
调用 Tools:
- create_pull_request(issue_key="KAN-42", branch_name="feature/KAN-42")
- jira_transition_issue(issue_key="KAN-42", to_status="In Review")
在 GitHub 上运行代码审查和 CI 检查。
5. 合并并关闭 issue
询问 Copilot:
> "Merge the PR and move KAN-42 to Done"
调用 Tools:
- merge_pull_request(pr_number=123)
- jira_transition_issue(issue_key="KAN-42", to_status="Done")
Issue 已关闭,代码已合并,工作流完成。
Use Cases- 涵盖 Jira issue、branch 和 pull request 的日常开发工作流
- 具有清晰 pull request 状态跟踪的代码评审流程
- Sprint 执行与任务进度可见性
- 快速 bug 修复与 hotfix 工作流
- 从 issue 到 merge 的端到端功能开发
- 具有一致状态和所有权跟踪的团队协作
Future Enhancements
- 多平台支持:将集成范围从 GitHub 扩展到其他平台(如 GitLab)
- 更智能的工作流:多 repo 支持、可复用的 JQL 模板以及可配置的自动化规则
- 更深层的自动化:AI 辅助的 PR/commit 起草、webhook 驱动的同步以及 CI/CD 反馈
Summary
该 MCP server 通过单一的对话界面连接 Jira 和 GitHub,提供了一个清晰且可追溯的开发工作流。
通过减少手动协调并保持 issue、branch 和 pull request 的同步,它帮助团队专注于开发而非流程。
*设计重点在于清晰度、可扩展性和开发者体验。*