Jira自然语言管理工具

通过自然语言与Jira交互的项目管理工具,支持项目创建、问题管理、自动化工作流等功能,适用于团队协作和项目管理场景。

  • by George5562
  • JavaScript
  • 本地部署
  • 64 星标
  • 更新于
在 GitHub 查看 George5562/Jira-MCP-Server

使用说明

Jira MCP服务器

用自然语言与Jira交谈,以获取有关项目的信息并对其进行修改。将其与Claude Desktop结合使用,并结合您将使用项目信息创建的自定义README,以便您可以委派PM任务(例如,如果您有我的团队及其专业的列表,请将任何新问题分配给最相关的人)。

使用 模型上下文协议.

服务器启用:

  • 项目创建和配置
  • 问题和子任务管理
  • 问题链接和依赖关系
  • 自动化问题工作流程

配置

所需的环境变量:

  • JIRA_HOST:您的Jira实例主机名
  • JIRA_API_TOKEN:来自的API令牌https://id.atlassian.com/manage-profile/security/api-tokensOR个人访问令牌(PAT)
  • JIRA_AUTH_TYPE:身份验证类型-“基本”(默认)或“承载”

可选环境变量:

  • JIRA_API_VERSION:要使用的Jira API版本(默认值:“3”)

对于基本身份验证(默认):

  • JIRA_EMAIL:您的Jira帐户电子邮件(使用基本身份验证时需要)

对于个人访问令牌(PAT)身份验证:

  • 集 JIRA_AUTH_TYPE=bearer 并提供您的PAT作为 JIRA_API_TOKEN
  • JIRA_EMAIL 使用PAT时不需要

个人访问令牌设置

个人访问令牌(PAT)是Jira Cloud推荐的身份验证方法,因为它们比API令牌提供更好的安全性。要创建PAT,请执行以下操作:

  1. 转到Jira实例设置
  2. 引导到 个人访问令牌 (通常在 安全 或 帐户设置)
  3. 点击 创建令牌
  4. 为您的令牌命名一个描述性名称(例如“Jira MCP服务器”)
  5. 设置适当的范围/权限(通常您需要对项目和问题具有读写权限)
  6. 复制生成的令牌并将其用作您的 JIRA_API_TOKEN
  7. 集 JIRA_AUTH_TYPE=bearer 在您的配置中

注: PAT并非对所有Jira实例都可用。如果您的实例不支持PAT,请使用常规API令牌的基本身份验证方法。

可用工具

1.用户管理

// Get user's account ID by email
{
  email: "user@example.com";
}

2.问题类型管理

// List all available issue types
// Returns: id, name, description, subtask status
// No parameters required

3.问题链接类型

// List all available issue link types
// Returns: id, name, inward/outward descriptions
// No parameters required

4.问题管理

检索问题

// Get all issues in a project
{
  projectKey: "PROJECT"
}

// Get issues with JQL filtering
{
  projectKey: "PROJECT",
  jql: "status = 'In Progress' AND assignee = currentUser()"
}

// Get issues assigned to user
{
  projectKey: "PROJECT",
  jql: "assignee = 'user@example.com' ORDER BY created DESC"
}

制造问题

// Create a standard issue
{
  projectKey: "PROJECT",
  summary: "Issue title",
  issueType: "Task",  // or "Story", "Bug", etc.
  description: "Detailed description",
  assignee: "accountId",  // from get_user tool
  labels: ["frontend", "urgent"],
  components: ["ui", "api"],
  priority: "High"
}

// Create a subtask
{
  parent: "PROJECT-123",
  projectKey: "PROJECT",
  summary: "Subtask title",
  issueType: "Subtask",
  description: "Subtask details",
  assignee: "accountId"
}

更新问题

// Update issue fields
{
  issueKey: "PROJECT-123",
  summary: "Updated title",
  description: "New description",
  assignee: "accountId",
  status: "In Progress",
  priority: "High"
}

问题依赖关系

// Create issue link
{
  linkType: "Blocks",  // from list_link_types
  inwardIssueKey: "PROJECT-124",  // blocked issue
  outwardIssueKey: "PROJECT-123"  // blocking issue
}

删除问题

// Delete single issue
{
  issueKey: "PROJECT-123"
}

// Delete issue with subtasks
{
  issueKey: "PROJECT-123",
  deleteSubtasks: true
}

// Delete multiple issues
{
  issueKeys: ["PROJECT-123", "PROJECT-124"]
}

字段格式

描述字段

描述字段支持标记样式格式:

  • 在段落之间使用空行
  • 使用“-”表示要点
  • 使用“1。“用于编号列表
  • 使用以“:”结尾的标题(后跟空行)

例子:

Task Overview:

This task involves implementing new features:
- Feature A implementation
- Feature B testing

Steps:
1. Design component
2. Implement logic
3. Add tests

Acceptance Criteria:
- All tests passing
- Documentation updated

错误处理

服务器为以下对象提供详细的错误消息:

  • 问题密钥无效
  • 缺少必填字段
  • 权限问题
  • API费率限制

安装说明

  1. 克隆存储库:

    git clone https://github.com/George5562/Jira-MCP-Server.git
    cd Jira-MCP-Server
    
  2. 安装依赖项:

    npm install
    
  3. 配置环境变量: 创建一个 .env 根目录中的文件:

    对于基本身份验证(默认):

    JIRA_HOST=your-instance.atlassian.net
    JIRA_EMAIL=your-email@example.com
    JIRA_API_TOKEN=your-api-token
    JIRA_AUTH_TYPE=basic
    

    对于个人访问令牌(PAT)身份验证:

    JIRA_HOST=your-instance.atlassian.net
    JIRA_API_TOKEN=your-personal-access-token
    JIRA_AUTH_TYPE=bearer
    
  4. 构建项目:

    npm run build
    
  5. 启动服务器:

    npm start
    

配置Claude桌面

要将此MCP服务器与Claude Desktop一起使用:

  1. 找到您的Claude Desktop配置文件:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • 窗户: %APPDATA%/Claude/claude_desktop_config.json
    • Linux: ~/.config/Claude/claude_desktop_config.json
  2. 将Jira MCP服务器添加到您的配置中:

    对于基本身份验证(默认):

    {
      "mcpServers": {
        "jira-server": {
          "name": "jira-server",
          "command": "/path/to/node",
          "args": ["/path/to/jira-server/build/index.js"],
          "cwd": "/path/to/jira-server",
          "env": {
            "JIRA_HOST": "your-jira-instance.atlassian.net",
            "JIRA_EMAIL": "your-email@example.com",
            "JIRA_API_TOKEN": "your-api-token",
            "JIRA_AUTH_TYPE": "basic"
          }
        }
      }
    }
    

    对于个人访问令牌(PAT)身份验证:

    {
      "mcpServers": {
        "jira-server": {
          "name": "jira-server",
          "command": "/path/to/node",
          "args": ["/path/to/jira-server/build/index.js"],
          "cwd": "/path/to/jira-server",
          "env": {
            "JIRA_HOST": "your-jira-instance.atlassian.net",
            "JIRA_API_TOKEN": "your-personal-access-token",
            "JIRA_AUTH_TYPE": "bearer"
          }
        }
      }
    }
    

    替换 /path/to/jira-server 带有克隆存储库的绝对路径。 替换 /path/to/node 使用Node.js可执行文件的绝对路径(通常可以通过运行 which node 或 where node 在您的终端中)。 使用Node.js可执行文件和构建的JavaScript文件的直接路径(build/index.js 运行后 npm run build)为了确保可靠性,建议使用。

  3. 重新启动Claude Desktop以应用更改。

配置光标

要将此Jira MCP服务器与Cursor一起使用,请执行以下操作:

  1. 确保服务器已构建: 跑 npm run build 在 Jira-MCP-Server 创建所需目录 build/index.js 文件。

  2. 查找或创建Cursor的MCP配置文件:

    • 对于项目特定配置: .cursor/mcp.json 在项目的根目录中。
    • 对于全局配置(所有项目): ~/.cursor/mcp.json 在您的主目录中。
  3. 将Jira MCP服务器配置添加到 mcp.json:

    对于基本身份验证(默认):

    {
      "mcpServers": {
        "jira-mcp-server": {
          "command": "node", // Or provide the absolute path to your Node.js executable
          "args": [
            "/path/to/your/Jira-MCP-Server/build/index.js" // Absolute path to the server's built index.js
          ],
          "cwd": "/path/to/your/Jira-MCP-Server", // Absolute path to the Jira-MCP-Server directory
          "env": {
            "JIRA_HOST": "your-jira-instance.atlassian.net",
            "JIRA_EMAIL": "your-email@example.com", // Your Jira email
            "JIRA_API_TOKEN": "your-api-token", // Your Jira API token
            "JIRA_AUTH_TYPE": "basic"
          }
        }
        // You can add other MCP server configurations here
      }
    }
    

    对于个人访问令牌(PAT)身份验证:

    {
      "mcpServers": {
        "jira-mcp-server": {
          "command": "node", // Or provide the absolute path to your Node.js executable
          "args": [
            "/path/to/your/Jira-MCP-Server/build/index.js" // Absolute path to the server's built index.js
          ],
          "cwd": "/path/to/your/Jira-MCP-Server", // Absolute path to the Jira-MCP-Server directory
          "env": {
            "JIRA_HOST": "your-jira-instance.atlassian.net",
            "JIRA_API_TOKEN": "your-personal-access-token", // Your Jira PAT
            "JIRA_AUTH_TYPE": "bearer"
          }
        }
        // You can add other MCP server configurations here
      }
    }
    
    • 替换 /path/to/your/Jira-MCP-Server 使用克隆位置的正确绝对路径 Jira-MCP-Server 存储库。
    • 如果 node 不在系统的PATH中,或者您更喜欢绝对路径,请替换 "node" 使用Node.js可执行文件的完整路径(例如。, /usr/local/bin/node 或 C:\Program Files\nodejs\node.exe).
    • 确保您的Jira实例详细信息和API令牌正确填写在 env 部分。
  4. 重新启动游标 以应用更改。

在Jira上下文中使用游标规则

为了使与Jira的交互更加顺畅,您可以在Cursor的规则中定义默认的Jira项目和用户标识符。这有助于Cursor的AI理解您的上下文,而无需在每个提示中都指定它。

创建或编辑光标规则文件(例如,在项目中 .cursor/rules.json 或全球 ~/.cursor/rules.json (规则的确切文件和方法可能会有所不同,请查看游标文档中的“规则”或“上下文管理”)。添加以下条目:

As an AI assistant, when I am asked about Jira tasks:
- Assume the primary Jira project key is 'YOUR_PROJECT_KEY_HERE'.
- Assume 'my assigned tasks' or tasks assigned to 'me' refer to the Jira user with the email 'your_jira_email@example.com' (or your Jira Account ID).
You can then use these in your JQL queries, for example: project = YOUR_PROJECT_KEY_HERE AND assignee = 'your_jira_email@example.com'.

替换 YOUR_PROJECT_KEY_HERE 和 your_jira_email@example.com 与您的实际细节。

光标聊天中的示例用法

配置后(特别是使用上下文的游标规则),您可以询问游标:

"Using Jira MCP, list my assigned tasks. Then, based on these tasks, come up with an implementation plan and work schedule."

如果你还没有设置规则,或者需要指定其他项目或用户,你会更明确:

"Using Jira MCP, list tasks assigned to 'user@example.com' in project 'PROJECT_KEY'. Then, based on these tasks, come up with an implementation plan and work schedule."

Cursor的AI将使用Jira MCP服务器获取任务,然后继续进行计划和调度请求。

通过Smithery安装

通过以下方式自动安装适用于Claude Desktop的Jira MCP服务器 史密瑟里:

npx -y @smithery/cli install @George5562/Jira-MCP-Server --client claude

手动安装

  1. 克隆存储库:

    git clone https://github.com/George5562/Jira-MCP-Server.git
    cd Jira-MCP-Server
    
  2. 安装依赖项:

    npm install
    
  3. 配置环境变量: 创建一个 .env 根目录中的文件:

    对于基本身份验证(默认):

    JIRA_HOST=your-instance.atlassian.net
    JIRA_EMAIL=your-email@example.com
    JIRA_API_TOKEN=your-api-token
    JIRA_AUTH_TYPE=basic
    

    对于个人访问令牌(PAT)身份验证:

    JIRA_HOST=your-instance.atlassian.net
    JIRA_API_TOKEN=your-personal-access-token
    JIRA_AUTH_TYPE=bearer
    
  4. 构建项目:

    npm run build
    
  5. 启动服务器:

    npm start
    

参考文献