Jira数据中心MCP服务器

一个用于与Atlassian Jira数据中心版交互的Go语言MCP服务器实现,支持搜索、检索、创建和更新Jira问题。

  • by anudeepd
  • Go
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 anudeepd/atlassian-jira-dc-go-mcp

使用说明

Atlassian Jira数据中心MCP服务器(Go)

Go中用于与Atlassian Jira数据中心版本交互的模型上下文协议(MCP)服务器实现。此服务器使AI助手和其他MCP客户端能够以编程方式搜索、检索、创建和更新Jira问题。

备注:这是对原始TypeScript实现的Go重写。特别感谢 b1ff/atlassian直流mcp 感谢启发这个项目的原始实现。

特性

  • 问题搜索:使用JQL(Jira查询语言)和强大的过滤选项搜索问题
  • 问题管理:在全面的现场支持下检索、创建和更新Jira问题
  • 评论管理:获取问题评论并发布有关问题的新评论
  • 自定义字段:支持自定义字段,包括优先级、受让人和标签
  • 安全认证:承载令牌身份验证支持
  • 高性能:使用Go构建,速度和效率更高
  • 零依赖:外部依赖性最小,尽可能使用标准库

工具

服务器提供以下MCP工具:

jira_search_issues

在JIRA数据中心版本实例中使用JQL搜索JIRA问题。

论据:

  • jql (string,必填):JQL查询字符串
  • maxResults (number,可选):返回的最大结果数(默认值:50)
  • startAt (number,可选):返回的第一个结果的索引
  • expand (字符串,可选):逗号分隔的字段可展开

jira_get_issue

从JIRA数据中心版本实例中按密钥获取JIRA问题的详细信息。

论据:

  • issueKey (字符串,必填):JIRA问题密钥(例如PROJ-123)
  • expand (字符串,可选):逗号分隔的字段可展开

jira_get_issue_comments

从JIRA数据中心版本实例中按密钥获取JIRA问题的注释。

论据:

  • issueKey (字符串,必填):JIRA问题密钥(例如PROJ-123)
  • expand (字符串,可选):逗号分隔的字段可展开

jira_post_issue_comment

在JIRA数据中心版本实例中对JIRA问题发表评论。

论据:

  • issueKey (字符串,必填):JIRA问题密钥(例如PROJ-123)
  • comment (字符串,必填):适用于JIRA数据中心版本的注释文本格式(JIRA Wiki标记)

jira_create_issue

在JIRA数据中心版本实例中创建新的JIRA问题。

论据:

  • projectKey (字符串,必填):项目密钥(例如PROJ)
  • summary (字符串,必填):问题摘要
  • description (字符串,可选):以适用于JIRA数据中心版本的格式发布描述(JIRA Wiki标记)
  • issueTypeId (字符串,必填):问题类型id(例如任务、Bug、故事的id)。应首先找到特定JIRA安装的正确编号
  • customFields (字符串,可选):可选自定义字段作为键值对。示例:{'customfield_10001':“自定义值”,“优先级”:{'id':“1”},“受让人”:{'名称':'john.doe'},“标签”:[“目标”,“错误”]}

jira_update_issue

更新JIRA数据中心版本实例中现有的JIRA问题。

论据:

  • issueKey (字符串,必填):JIRA问题密钥(例如PROJ-123)
  • summary (字符串,可选):新摘要(可选)
  • description (字符串,可选):JIRA Wiki标记中的新描述(可选)
  • issueTypeId (字符串,可选):新问题类型id(可选)
  • customFields (字符串,可选):可选的自定义字段,可更新为键值对。示例:{'customfield_10001':“自定义值”,“优先级”:{'id':“1”},“受让人”:{'名称':'john.doe'},“标签”:[“目标”,“错误”]}

使用模式(MCP配置)

如果您不确定选择哪个选项:

  • 使用 预构建二进制文件 如果你不使用Go
  • 使用 去安装 如果你是Go开发者

此MCP服务器可用于 三种支持方式. 选择 一 这取决于您希望如何安装和运行它。

选项1:使用预构建二进制文件(建议非Go用户使用)

安装

从下载相应的二进制文件 发布页面 并将其放置在系统的某个位置(例如。 /usr/local/bin).

chmod +x atlassian-jira-dc-go-mcp

MCP配置

{
  "mcpServers": {
    "jira": {
      "command": "/usr/local/bin/atlassian-jira-dc-go-mcp",
      "env": {
        "JIRA_API_TOKEN": "your-api-token",
        "JIRA_BASE_URL": "https://jira.example.com"
      }
    }
  }
}

选项2:使用 go install (推荐给Go用户)

安装

go install github.com/anudeepd/atlassian-jira-dc-go-mcp@latest

确保 $GOBIN (或 ~/go/bin)在你的 PATH.

export PATH="$HOME/go/bin:$PATH"

MCP配置

因为二进制文件在你的 PATH,您只需要命令名:

{
  "mcpServers": {
    "jira": {
      "command": "atlassian-jira-dc-go-mcp",
      "env": {
        "JIRA_API_TOKEN": "your-api-token",
        "JIRA_BASE_URL": "https://jira.example.com"
      }
    }
  }
}

选项3:源代码运行(开发/贡献)

直接运行

git clone https://github.com/anudeepd/atlassian-jira-dc-go-mcp.git
cd atlassian-jira-dc-go-mcp
go run .

MCP配置(不建议用于生产)

{
  "mcpServers": {
    "jira-dev": {
      "command": "go",
      "args": ["run", "."],
      "cwd": "/path/to/atlassian-jira-dc-go-mcp",
      "env": {
        "JIRA_API_TOKEN": "your-api-token",
        "JIRA_BASE_URL": "https://jira.example.com"
      }
    }
  }
}

配置

服务器需要以下环境变量:

必需变量

  • JIRA_API_TOKEN:您的Jira API代币(Bearer代币)
  • JIRA_BASE_URL:Jira实例的基本URL(例如。, https://jira.example.com)

备选URL变量

您也可以使用其中一个来代替 JIRA_BASE_URL:

  • JIRA_API_BASE_PATH:API完整路径
  • JIRA_HOST:只有主机名(前缀为 https://)

服务器将自动追加 /rest 如果不存在,则返回到基本URL。

配置示例

export JIRA_API_TOKEN="your-api-token-here"
export JIRA_BASE_URL="https://jira.example.com"

发展

运行测试

# Run all tests
go test -v

# Run tests with coverage
go test -v -cover

# Generate coverage report
go test -coverprofile=coverage.out
go tool cover -html=coverage.out

建筑

# Build for current platform
go build .

# Build for multiple platforms
./build.sh

这 build.sh 脚本为以下对象创建二进制文件:

  • Linux(amd64、arm64)
  • macOS(amd64、arm64)
  • Windows(amd64、arm64)

使用较旧的Go版本进行构建

如果您使用的是较旧版本的Go(例如1.24)并且无法升级,您可以修改 go.mod 文件:

  1. 克隆存储库:

    git clone https://github.com/anudeepd/atlassian-jira-dc-go-mcp.git
    cd atlassian-jira-dc-go-mcp
    
  2. 在中编辑Go版本 go.mod:

    go mod edit -go=1.24
    
  3. 整理模块:

    go mod tidy
    
  4. 构建项目:

    go build .
    

项目结构

.
├── main.go           # Main server implementation
├── main_test.go      # Comprehensive test suite
├── go.mod            # Go module dependencies
├── go.sum            # Dependency checksums
├── build.sh          # Multi-platform build script
└── README.md         # This file

api参考

Jira REST API

此服务器使用Jira数据中心REST API v2。有关API端点和JQL语法的更多信息,请参阅:

贡献

欢迎投稿!请随时提交拉取请求。

  1. 分叉存储库
  2. 创建功能分支(git checkout -b feature/amazing-feature)
  3. 提交您的更改(git commit -m 'Add some amazing feature')
  4. 推到分支(git push origin feature/amazing-feature)
  5. 打开拉取请求

许可证

此项目根据MIT许可证获得许可-有关详细信息,请参阅许可证文件。

致谢

支持

对于问题、疑问或贡献,请在GitHub上打开问题。