Jira MCP服务器
MCP(模型上下文协议)服务器,为Cursor、VS Code Copilot、Claude Desktop和Codex等AI助手提供Jira问题上下文。
特性
- get_jira_issue -按密钥获取完整的问题详细信息
- get_jira_issue_from_branch -从git分支名称中提取Jira密钥并获取详细信息
- get_jira_comments -获取问题的评论
- test_jira_connection -验证Jira API连接
每个工具返回:
- 问题摘要、描述、状态、优先级、受让人
- 复制步骤 (摘自描述)
- 近期评论 (最多10个)
- 组件、标签和元数据
设置
先决条件
- Python 3.11+
- 紫外线 -快速Python包管理器
- 带有API令牌的Jira帐户
安装
- 克隆存储库:
git clone
cd cursor-mcp-server- 安装uv(如果尚未安装):
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Or with Homebrew
brew install uv- 安装依赖项:
uv sync环境变量
创建一个 .env 项目根目录中的文件:
JIRA_SERVER=https://your-company.atlassian.net
JIRA_EMAIL=your-email@company.com
JIRA_API_TOKEN=your-jira-api-token要创建Jira API令牌,请执行以下操作:
- 首选https://id.atlassian.com/manage-profile/security/api-tokens
- 点击“创建API令牌”
- 复制令牌并将其添加到您的
.env文件
配置
光标
添加到光标MCP设置(~/.cursor/mcp.json):
{
"mcpServers": {
"jira": {
"command": "uv",
"args": ["run", "--directory", "/path/to/cursor-mcp-server", "python", "-m", "app.main"]
}
}
}VS代码(副本)
添加到您的VS代码设置或 .vscode/mcp.json:
{
"mcpServers": {
"jira": {
"command": "uv",
"args": ["run", "--directory", "/path/to/cursor-mcp-server", "python", "-m", "app.main"]
}
}
}克劳德桌面版
添加到您的Claude桌面配置(~/Library/Application Support/Claude/claude_desktop_config.json 在macOS上):
{
"mcpServers": {
"jira": {
"command": "uv",
"args": ["run", "--directory", "/path/to/cursor-mcp-server", "python", "-m", "app.main"]
}
}
}法典
添加到您的Codex MCP配置中:
{
"mcpServers": {
"jira": {
"command": "uv",
"args": ["run", "--directory", "/path/to/cursor-mcp-server", "python", "-m", "app.main"]
}
}
}可用工具
get_jira_issue
按密钥获取Jira问题的详细信息。
Input: { "issue_key": "PROJ-123" }
Output: {
"issue_key": "PROJ-123",
"summary": "Issue title",
"description": "Full description...",
"status": "In Progress",
"priority": "High",
"assignee": "John Doe",
"reproduction_steps": "1. Do this\n2. Do that",
"comments": [...]
}get_jira_issue_from_branch
从git分支名称中提取Jira密钥并获取问题详细信息。
Input: { "branch_name": "feature/PROJ-123-add-feature" }
Output: { ... same as get_jira_issue ... }get_jira_comments
获取Jira问题的评论。
Input: { "issue_key": "PROJ-123", "max_comments": 5 }
Output: {
"issue_key": "PROJ-123",
"comment_count": 5,
"comments": [
{ "author": "Jane Doe", "body": "Comment text...", "created": "..." }
]
}test_jira_connection
验证Jira API连接。
Input: {}
Output: {
"status": "success",
"connected_as": "John Doe",
"email": "john@company.com"
}发展
本地运行(用于测试)
uv run python -m app.main运行测试
uv run pytest项目结构
cursor-mcp-server/
├── app/
│ ├── __init__.py
│ ├── main.py # MCP server and tool definitions
│ ├── jira_client.py # Jira API client with caching
│ └── utils.py # Utility functions
├── pyproject.toml # Project configuration and dependencies
├── .env # Environment variables (not in git)
└── README.md