[AI] 設定 Atlassian Jira MCP with Claude Code

  • 116
  • 0
  • 2025-09-04

最近被同事推坑 Claude Code

嘗試使用 Claude Code 搭配 Atlassian Jira MCP ,就順手紀錄一下自己的安裝過程

Step 1. 產生 Atlassian API Token

在 security tab 底下 API tokens 可以找到 Create and manage API tokens 的連結

Step 2. Configure the MCP Server

我有安裝 Claude 桌面版,所以我這邊使用 UI 介面操作,點擊 Edit Config

就會看到你的 claude_desktop_config.json 檔案,也可以直接用路徑尋找

macOs: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Roaming\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json

以下是我的 claude_desktop_config.json檔案內容:

{
  "mcpServers": {
    "jira": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e", "CONFLUENCE_URL",
        "-e", "CONFLUENCE_USERNAME",
        "-e", "CONFLUENCE_API_TOKEN",
        "-e", "JIRA_URL",
        "-e", "JIRA_USERNAME", 
        "-e", "JIRA_API_TOKEN",
        "ghcr.io/sooperset/mcp-atlassian:latest"
      ],
      "env": {
        "CONFLUENCE_URL": "$JIRA_BASE_URL/wiki",
        "CONFLUENCE_USERNAME": "$JIRA_USERNAME",
        "CONFLUENCE_API_TOKEN": "$JIRA_API_TOKEN",
        "JIRA_BASE_URL": "$JIRA_BASE_URL",
        "JIRA_USERNAME": "$JIRA_USERNAME", 
        "JIRA_API_TOKEN": "$JIRA_API_TOKEN"
      }
    }
  }
}

我把 Jira 相關放到我的環境變數,而不是直接寫在 json 檔案裡,我使用的指令:

cat >> ~/.zshrc << 'EOF'

# JIRA MCP Configuration
export JIRA_BASE_URL="https://your.jira.url"
export JIRA_USERNAME="your_name"
export JIRA_API_TOKEN="your_toke"
EOF

然後重新載入 shell 配置

source ~/.zshrc

驗證環境變數

echo $JIRA_URL
echo $JIRA_USERNAME
echo $JIRA_API_TOKEN

Step 3.重新啟動 Claude

就能看到 jira 狀態變成 running


後來發現 Claude CLI 的設定和 Claude Code Desktop 是不一樣的

macOs Claude CLI 的設定檔案在 ~/.claude.json

在 mcpServers 區塊加入以下設定

"jira": {
  "type": "stdio",
  "command": "npx",
  "args": ["-y", "jira-mcp"],
  "env": {
    "JIRA_INSTANCE_URL": "${JIRA_URL}",
    "JIRA_USER_EMAIL": "${JIRA_USERNAME}",
    "JIRA_API_KEY": "${JIRA_API_TOKEN}"
  }
}

然後在 command 驗證設定成功

claude mcp get jira

參考:

Claude Code 官方文件

Model Context Protocol servers github repo

AI Development: Integrating Atlassian Jira with Claude Code

JIRA MCP 整合