使用说明
GitHub Jira MCP服务器
一个全面的模型上下文协议(MCP)服务器,通过适当的权限控制和安全实施,在GitHub和Jira之间提供安全集成。
🛠️ 安装
先决条件
- Python 3.11+
- GitHub个人访问令牌
- Jira OAuth应用程序凭据
设置
-
克隆存储库
git clone <your-repo> cd mcp-servers -
安装依赖项
uv sync -
配置环境变量
cp env.example .env # Edit .env with your actual credentials -
设置凭据
github:
- 首选 GitHub设置>代币
- 生成新的个人访问令牌
- 所需范围:
repo(对于私人回购),public_repo(公共回购)
吉拉:
- 首选 Atlassian开发人员控制台
- 创建新的OAuth应用程序
- 将重定向URI设置为:
http://localhost:8080/callback - 记下Jira实例URL、客户端ID和客户端密码
🔧 配置
环境变量
创建一个 .env 项目根目录中的文件:
# GitHub Configuration
GITHUB_TOKEN=ghp_your_github_token_here
# Jira OAuth Configuration
JIRA_URL=https://your-domain.atlassian.net
JIRA_CLIENT_ID=your_jira_oauth_client_id_here
JIRA_CLIENT_SECRET=your_jira_oauth_client_secret_here
# Optional: Jira Access Tokens (will be obtained automatically via OAuth)
JIRA_ACCESS_TOKEN=
JIRA_REFRESH_TOKEN=
# Optional: Logging
LOG_LEVEL=INFO
MCP客户端配置
将此添加到MCP客户端配置中:
{
"mcpServers": {
"github-jira": {
"command": "python",
"args": ["mcp_github_jira_server.py"],
"env": {
"GITHUB_TOKEN": "your_token_here",
"JIRA_URL": "https://your-domain.atlassian.net",
"JIRA_CLIENT_ID": "your_jira_oauth_client_id_here",
"JIRA_CLIENT_SECRET": "your_jira_oauth_client_secret_here"
}
}
}
}
📚 用法
启动服务器
python mcp_github_jira_server.py
可用工具
GitHub工具
github_read_file(owner, repo, path)-通过安全检查读取文件内容github_create_issue(owner, repo, title, body, labels)-在自己的仓库中创建问题github_create_pull_request(owner, repo, title, body, head, base)-在自己的仓库中创建PRgithub_delete_file(owner, repo, path, message, sha)-从自己的存储库中删除文件check_github_permissions()-检查当前GitHub权限
Jira工具
jira_create_issue(project_key, summary, description, issue_type)-创建问题jira_search_issues(jql, max_results)-使用JQL搜索问题jira_update_issue(issue_key, updates)-更新问题字段jira_add_comment(issue_key, comment)-为问题添加评论jira_transition_issue(issue_key, transition_id)-通过工作流解决问题check_jira_permissions()-检查当前Jira权限setup_jira_oauth()-设置Jira OAuth身份验证
可用资源
GitHub资源
github://{owner}/{repo}-存储库信息github://{owner}/{repo}/files/{path}-文件内容
Jira资源
jira://projects/{project_key}-项目信息jira://issues/{issue_key}-问题详细信息
可用提示
check_repository_security_permissions-检查GitHub权限read_file_from_github_repo-从GitHub读取文件create_jira_issue_in_project-创建Jira问题update_jira_issue_workflow-更新工作流状态github_repository_management-管理GitHub仓库jira_project_workflow_management-管理Jira项目setup_jira_oauth_authentication-设置Jira OAuth身份验证