使用说明
Jira MCP服务器
一个MCP(模型上下文协议)服务器,用于通过REST API创建和获取Jira问题。建于 包子.
特性
- 获取并更新现有的Jira问题
- 使用单个工具调用创建Jira问题
- 支持所有标准问题字段(摘要、描述、类型、优先级、标签)
- 灵活的描述输入:
- 纯文本→ 自动转换为基本ADF段落
- 预格式化的ADF对象→ 完全控制格式(面板、标题、列表等)
- 使用Zod模式进行运行时ADF验证
- 独立可执行文件(无运行时依赖关系)
--help快速设置参考标志
先决条件
- 包子 v1.0+--安装时使用
curl -fsSL https://bun.sh/install | bash- 或使用 devbox 适用于没有永久Bun安装的隔离环境(见下文)
- Jira Cloud实例
- Jira API令牌(请参见 Atlassian API代币)
安装
git clone <your-repo-url>
cd jira-mcp-server
bun install
使用devbox(无永久Bun安装)
如果你不想全局安装Bun, devbox 提供带Bun的隔离外壳:
# Install devbox (one-time)
curl -fsSL https://get.jetify.com/devbox | bash
# Enter the devbox shell (installs Bun automatically)
devbox shell
# Now use bun as normal
bun install
bun run build
跑 exit 离开devbox shell。Bun不会添加到系统之外。
配置
服务器需要以下环境变量:
| 变量 | 描述 | 示例 |
|---|---|---|
JIRA_URL |
您的Jira实例URL | https://your-domain.atlassian.net |
JIRA_EMAIL |
您的Jira帐户电子邮件 | user@example.com |
JIRA_API_TOKEN |
您的Jira API代币 | your-api-token |
JIRA_PROJECT |
创建问题的默认项目密钥 | PROJ |
用法
# Build standalone executable
bun run build
# Build and deploy to ~/bin
bun run deploy
# Build, deploy, and sign (required on macOS — see note below)
bun run deploy-and-sign
# Run from source (development)
bun run dev
# Inspect with MCP Inspector
bun run mcp-inspect
# Display setup instructions
./dist/jira-mcp-server --help
macOS:使用 deploy-and-sign
在macOS上,使用 bun run deploy-and-sign 而不是 bun run deploy.何时 bun build --compile 生成二进制文件时,它嵌入了代码签名。使用复制文件 cp 由于macOS在复制时重新计算文件哈希,因此该签名无效。然后,Gatekeeper使用以下命令杀死二进制文件 SIGKILL 当你试图从新位置运行它时。
deploy-and-sign 添加临时重新签名步骤(codesign -s -)复制后,它满足macOS的要求,不需要Apple Developer证书。
与MCP客户端集成
克劳德桌面版
添加到您的配置文件中:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - 窗户:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"jira": {
"command": "/absolute/path/to/jira-mcp-server/dist/jira-mcp-server",
"env": {
"JIRA_URL": "https://your-domain.atlassian.net",
"JIRA_EMAIL": "user@example.com",
"JIRA_API_TOKEN": "your-token",
"JIRA_PROJECT": "PROJ"
}
}
}
}
对于开发(从源代码运行),请替换 command 随着 "bun" 并添加 "args": ["run", "/absolute/path/to/jira-mcp-server/src/index.ts"].
光标
- 打开光标设置→ 特性→ MCP
- 添加新的MCP服务器:
- 运输类型: 标准
- 命令:
/absolute/path/to/jira-mcp-server/dist/jira-mcp-server
- 在Cursor的设置中设置环境变量
克劳德代码
claude mcp add jira /absolute/path/to/jira-mcp-server/dist/jira-mcp-server
工具参考
jira-search-issues
使用JQL查询搜索Jira问题。返回与关键字段匹配的问题列表。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
jql |
string |
是 | JQL查询字符串 |
maxResults |
number |
否 | 返回的最大结果数(1-100,默认值20) |
JQL示例:
project = MYPROJ AND status = "In Progress"
assignee = currentUser() AND sprint in openSprints()
project = MYPROJ AND labels = "backend" ORDER BY created DESC
示例响应:
{
"success": true,
"total": 42,
"returned": 20,
"issues": [
{
"key": "PROJ-123",
"summary": "Fix login button on mobile",
"status": "In Progress",
"priority": "High",
"issueType": "Bug",
"assignee": "Jane Doe",
"reporter": "John Smith",
"labels": ["mobile", "frontend"],
"created": "2026-02-19T10:00:00.000+0000",
"updated": "2026-02-19T12:30:00.000+0000",
"url": "https://your-domain.atlassian.net/browse/PROJ-123"
}
]
}
jira-get-issue
通过密钥获取现有的Jira问题。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
issueKey |
string |
是 | 问题密钥(例如“PROJ-123”) |
示例响应:
{
"success": true,
"issue": {
"key": "PROJ-123",
"summary": "Fix login button on mobile",
"status": "In Progress",
"priority": "High",
"issueType": "Bug",
"assignee": "Jane Doe",
"reporter": "John Smith",
"labels": ["mobile", "frontend"],
"description": { "type": "doc", "version": 1, "content": [] },
"created": "2026-02-19T10:00:00.000+0000",
"updated": "2026-02-19T12:30:00.000+0000",
"url": "https://your-domain.atlassian.net/browse/PROJ-123"
}
}
jira-update-issue
更新现有Jira问题的摘要和/或描述。必须至少提供一个字段。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
issueKey |
string |
是 | 问题密钥(例如“PROJ-123”) |
summary |
string |
否 | 问题的新摘要/标题 |
description |
string 或 ADF |
否 | 纯文本或预格式化ADF |
示例响应:
{
"success": true,
"issue": {
"key": "PROJ-123",
"url": "https://your-domain.atlassian.net/browse/PROJ-123"
},
"message": "Successfully updated issue PROJ-123"
}
jira-create-issue
在Jira中创建新问题。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
summary |
string |
是 | 问题摘要/标题 |
description |
string 或 ADF |
否 | 纯文本或预格式化的ADF对象 |
issueType |
string |
否 | 问题类型(默认:“任务”) |
priority |
string |
否 | 优先级(“最高”、“高”、“中”、“低”、“最低”) |
labels |
string[] |
否 | 要添加到问题中的标签 |
projectKey |
string |
否 | 覆盖默认项目密钥 |
parentKey |
string |
否 | 父问题密钥(例如“PROJ-10”)--作为子问题创建 |
描述格式:
纯文本会自动转换为ADF段落:
"description": "Main description.\n\nAnother paragraph."
要进行完全格式控制,请传递一个预格式化的ADF对象:
"description": {
"type": "doc",
"version": 1,
"content": [
{ "type": "paragraph", "content": [{ "type": "text", "text": "Main description" }] },
{ "type": "heading", "attrs": { "level": 3 }, "content": [{ "type": "text", "text": "TODO" }] },
{ "type": "panel", "attrs": { "panelType": "error" }, "content": [
{ "type": "paragraph", "content": [{ "type": "text", "text": "First task" }] }
]}
]
}
面板类型: error (红色), info (蓝色), warning (黄色), success (绿色), note (紫色)。
示例响应:
{
"success": true,
"issue": {
"id": "10001",
"key": "PROJ-123",
"url": "https://your-domain.atlassian.net/browse/PROJ-123"
},
"message": "Successfully created issue PROJ-123"
}
示例命令
jira-ticket
用于起草和创建具有适当ADF格式的Jira票证的交互式命令。通过智能问题流和自动ADF构建支持故事、错误和维护任务。
地点: command/jira-ticket.md
/jira-ticket [optional summary]
项目结构
jira-mcp-server/
├── src/
│ ├── index.ts # Entry point, orchestrates startup
│ ├── config.ts # Environment variable validation
│ ├── server.ts # MCP server setup and tool registration
│ ├── jira-client.ts # Jira REST API client
│ ├── adf-schema.ts # Zod schema for ADF validation
│ ├── adf-schema.test.ts # ADF validation tests
│ ├── types.ts # TypeScript type definitions
│ ├── help.ts # Help text display
│ └── version.ts # Version from package.json
├── dist/
│ └── jira-mcp-server # Standalone executable (after build)
├── command/
│ └── jira-ticket.md # Interactive ticket creation command
├── biome.json # Linter/formatter configuration
└── package.json
可用脚本
| 脚本 | 描述 |
|---|---|
build |
构建包含Bun运行时的独立可执行文件 |
deploy |
构建可执行文件并将其复制到~/bin目录 |
deploy-and-sign |
构建、复制和临时签名(macOS上需要) |
dev |
直接使用Bun运行源代码(用于开发) |
test |
使用Bun运行测试 |
lint |
使用Biome检查代码(lint+格式) |
lint:fix |
自动修复棉绒和格式问题 |
mcp-inspect |
构建并启动MCP检查器进行手动测试 |
未来改进
- []添加更多Jira操作(删除、搜索、评论、转换)
- []支持自定义字段
- []支持附件
- []缓存项目/问题类型元数据
- []支持Jira服务器/数据中心(不同的身份验证方法)
- []添加受让人字段支持
- []添加组件支持
许可证
麻省理工学院
