Jira和Bitbucket集成工具

一个基于AWS Lambda的无服务器集成工具,通过Amazon Q CLI实现Jira和Bitbucket的无缝交互,适用于项目管理与代码协作。

  • by NSandeep12
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 nsandeep12/atlassian-mcp-server

使用说明

Atlassian MCP服务器-无服务器

无服务器AWS Lambda集成 Jira 和 比特桶 Amazon Q CLI使用模型上下文协议(MCP)。

✨ 特性

  • 🎫 Jira集成:搜索问题、创建问题、管理项目
  • 🔧 Bitbucket集成:存储库、拉取请求、分支、提交
  • 🔗 参见项:Jira问题和Bitbucket PRs/commits之间的自动链接
  • 🤖 自然语言:使用Q CLI与两个平台无缝交互
  • ☁️ 无服务器:AWS Lambda部署-仅在需要时运行
  • 💰 成本效益高:适度使用约0.002美元/月

🏗️ 建筑

┌─────────────┐    ┌──────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   USER      │    │   AMAZON Q   │    │   MCP WRAPPER   │    │   AWS LAMBDA    │
│             │    │     CLI      │    │                 │    │                 │
│ "Show me    │───▶│              │───▶│ q_mcp_wrapper   │───▶│ atlassian-mcp   │
│  issues"    │    │ Natural Lang │    │     .py         │    │    -server      │
│             │    │ Processing   │    │                 │    │                 │
└─────────────┘    └──────────────┘    └─────────────────┘    └─────────────────┘
                                                │                        │
                                                │                        ▼
                                                ▼                ┌─────────────────┐
                                    ┌─────────────────┐          │ ATLASSIAN APIS  │
                                    │ MCP PROTOCOL    │          │                 │
                                    │                 │          │ • Jira Cloud    │
                                    │ • tools/list    │          │ • Bitbucket     │
                                    │ • tools/call    │          │                 │
                                    │ • initialize    │          │ Only connects   │
                                    │                 │          │ when needed     │
                                    └─────────────────┘          └─────────────────┘

📋 分步设置指南

步骤1:先决条件检查✅

在开始之前,请确保您已经:

必修的:

  • []具有管理员权限的AWS帐户
  • []Jira Cloud帐户(不是服务器/数据中心)
  • []比特桶云账户
  • []可上网的电脑

我们将一起安装这些:

  • []AWS-CLI
  • []亚马逊Q CLI
  • []Python 3.8+(通常预装)

步骤2:安装所需工具🛠️

2.1安装AWS CLI

在macOS上:

# Using Homebrew (recommended)
brew install awscli

# Or download installer
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
sudo installer -pkg AWSCLIV2.pkg -target /

在Linux上:

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

在Windows上:

# Download and run: https://awscli.amazonaws.com/AWSCLIV2.msi

验证安装:

aws --version
# Should show: aws-cli/2.x.x

2.2安装Amazon Q命令行界面

# Install Amazon Q CLI
pip install amazon-q-cli

# Or using pip3
pip3 install amazon-q-cli

# Verify installation
q --version

2.3配置AWS CLI

选项A:使用AWS SSO(建议组织使用)

aws configure sso
# Follow prompts to set up SSO

选项B:使用访问密钥

aws configure
# Enter your AWS Access Key ID
# Enter your AWS Secret Access Key
# Enter your default region (e.g., us-west-2)
# Enter output format: json

测试AWS连接:

aws sts get-caller-identity
# Should show your AWS account info

步骤3:获取API凭据🔑

3.1获取Jira API代币

  1. 转到Jira API代币页面:

    • 访问:https://id.atlassian.com/manage-profile/security/api-tokens
    • 点击“创建API令牌”
  2. 创建令牌:

    • 标签: Amazon Q MCP Integration
    • 点击“创建”
    • 复制令牌 (开始于 ATATT3x...)
    • ⚠️ 立即保存 -你不会再看到它了!
  3. 请注意您的Jira详细信息:

    • 您的Jira URL: https://YOUR-DOMAIN.atlassian.net
    • 您的电子邮件: your-email@domain.com

3.2获取Bitbucket应用程序密码

  1. 转到Bitbucket应用程序密码:

    • 访问:https://bitbucket.org/account/settings/app-passwords/
    • 点击“创建应用密码”
  2. 配置权限:

    • 标签: Amazon Q MCP Integration
    • 选择权限:
      • ✅ 帐户:已读
      • ✅ 存储库:读、写
      • ✅ 拉取请求:读取、写入
    • 点击“创建”
  3. 复制凭据:

    • 应用程序密码 (开始于 ATBB...)
    • 用户名 (您的Bitbucket用户名)
    • 工作区 (通常与用户名或团队名称相同)

步骤4:下载和部署🚀

4.1克隆项目

# Clone the repository
git clone https://github.com/NSandeep12/atlassian-mcp-server.git

# Navigate to project
cd atlassian-mcp-server

# Make scripts executable
chmod +x deploy.sh configure-bitbucket.sh

4.2部署到AWS Lambda

运行部署命令:

./deploy.sh JIRA_API_TOKEN BITBUCKET_WORKSPACE BITBUCKET_USERNAME BITBUCKET_APP_PASSWORD

实际值示例:

./deploy.sh ATATT3xFfGF0... nsandeep12 nsandeep12-admin ATBBzpnPDsn4...

这有什么作用:

  • ✅ 创建AWS Lambda函数
  • ✅ 设置IAM角色和权限
  • ✅ 安全地配置环境变量
  • ✅ 配置Amazon Q CLI集成
  • ✅ 测试部署

预期产量:

🚀 Deploying Atlassian Suite MCP Server (Jira + Bitbucket)...
✅ Lambda function created successfully
✅ Environment variables configured
✅ Q CLI configured
✅ Deployment complete!

💡 Test with: q chat "List my repositories"

步骤5:测试您的设置✅

5.1测试亚马逊Q集成

# Test basic functionality
q chat "Hello, can you help me with Jira and Bitbucket?"

# Test Jira integration
q chat "Show me all open issues"
q chat "What projects do I have access to?"

# Test Bitbucket integration
q chat "List my repositories"
q chat "Show me recent commits"

5.2测试高级功能

# Cross-platform queries
q chat "Create a Jira issue for my main repository"
q chat "Find all pull requests related to bug fixes"
q chat "Show me commits that mention Jira issues"

# Specific project queries
q chat "Show me all open issues in PROJECT-NAME"
q chat "List branches in REPO-NAME repository"

5.3验证AWS Lambda

# Check Lambda function status
aws lambda get-function --function-name atlassian-mcp-server

# View recent logs
aws logs tail /aws/lambda/atlassian-mcp-server --follow

🎯 使用示例

Jira运营

# Search and filter
q chat "Show me all open issues in SCRUM project"
q chat "Find issues assigned to me"
q chat "What are the latest 5 issues created?"
q chat "Show me high priority bugs"

# Create issues
q chat "Create a new bug about login issues in SCRUM project"
q chat "Create a story for user authentication feature"

Bitbucket操作

# Repository management
q chat "List all my repositories"
q chat "Show me branches in online-shop repository"
q chat "What are the recent commits in main branch?"

# Pull requests
q chat "List open pull requests in online-shop"
q chat "Show me pull requests I need to review"
q chat "Create a pull request from feature-branch to main"

跨平台集成

# Link Jira and Bitbucket
q chat "Create a Jira issue for repository online-shop"
q chat "Find all pull requests related to SCRUM-123"
q chat "Show me commits that mention Jira issues"
q chat "Link this pull request to JIRA-456"

🔧 可用工具

Jira工具

  • search_jira_issues -使用JQL查询进行搜索
  • create_jira_issue -创建新问题

Bitbucket工具

  • list_bitbucket_repositories -列出存储库
  • list_pull_requests -列出拉取请求
  • create_pull_request -创建新的拉取请求
  • list_branches -列出存储库分支
  • get_commits -获取最近的提交

交叉引用工具

  • search_cross_references -跨平台查找相关活动

🛠️ 配置和定制

更新AWS设置

更改AWS配置文件/区域:

# Edit deploy.sh
nano deploy.sh

# Update these lines:
PROFILE="your-aws-profile-name"
REGION="your-preferred-region"

更新凭据

更新Jira凭据:

aws lambda update-function-configuration \
    --function-name atlassian-mcp-server \
    --environment Variables='{
        "JIRA_EMAIL":"new-email@domain.com",
        "JIRA_API_TOKEN":"new-token",
        "JIRA_URL":"https://new-domain.atlassian.net"
    }'

更新Bitbucket凭据:

./configure-bitbucket.sh NEW_WORKSPACE NEW_USERNAME NEW_APP_PASSWORD

🧪 测试和故障排除

测试单个组件

直接测试Lambda函数:

aws lambda invoke \
    --function-name atlassian-mcp-server \
    --region us-west-2 \
    --payload '{"action":"list_tools"}' \
    response.json && cat response.json

测试MCP包装:

echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | python3 q_mcp_wrapper.py

测试API证书:

# Test Jira connection
curl -u "your-email@domain.com:YOUR_JIRA_TOKEN" \
    https://your-domain.atlassian.net/rest/api/3/myself

# Test Bitbucket connection
curl -u "username:YOUR_APP_PASSWORD" \
    https://api.bitbucket.org/2.0/user

常见问题及解决方案

问题:“找不到命令:q”

# Solution: Install Amazon Q CLI
pip3 install amazon-q-cli

问题:“未找到AWS凭据”

# Solution: Configure AWS CLI
aws configure
# Or set up AWS SSO
aws configure sso

问题:“找不到Lambda函数”

# Solution: Check if deployment completed
aws lambda list-functions | grep atlassian-mcp-server

# Re-deploy if needed
./deploy.sh JIRA_TOKEN WORKSPACE USERNAME APP_PASSWORD

问题:“Jira/Bitbucket身份验证失败”

# Solution: Verify credentials
# For Jira: Check token hasn't expired
# For Bitbucket: Verify app password permissions

问题:“Q CLI没有响应”

# Solution: Check MCP configuration
cat ~/.config/q/mcp-servers.json

# Restart Q CLI
q --restart

🔐 安全功能

  • 🔒 无硬编码凭据:所有秘密都存储为加密的Lambda环境变量
  • 🛡️ 静态加密:Lambda环境变量使用AWS KMS加密
  • 🔐 仅限HTTPS:所有API通信都使用TLS加密
  • ⚡ 最低权限:Lambda以所需的最低IAM权限运行
  • 🎯 按需:仅在发出请求时连接到API
  • 🚫 无数据存储:无持久数据存储,无状态执行

💰 成本细分

AWS Lambda成本

  • 免费等级:每月1M请求+400000 GB秒/月
  • 免费等级之后:每次请求0.0000002美元+每秒0.0000166667美元
  • 典型用法:适度使用约0.002美元/月(每天100次请求)

大西洋API成本

  • 吉拉云:免费层包括API访问
  • 比特桶云:免费层包括API访问

每月总成本

  • 灯光使用 (10个请求/天): 自由 (在AWS免费层内)
  • 适度使用 (100个请求/天): 约0.002美元/月
  • 大量使用 (1000个请求/天): 约0.02美元/月

📁 项目结构

atlassian-mcp-server/
├── lambda_handler.py          # Main AWS Lambda function
├── q_mcp_wrapper.py           # Amazon Q CLI MCP bridge
├── deploy.sh                  # One-command deployment script
├── configure-bitbucket.sh     # Bitbucket configuration helper
├── test-bitbucket-endpoints.py # Testing utilities
├── requirements.txt           # Python dependencies
├── q-mcp-config.json         # Q CLI configuration
├── README.md                 # This documentation
└── LICENSE                   # MIT license

🆘 支持与帮助

获取帮助

  1. 检查日志:

    aws logs tail /aws/lambda/atlassian-mcp-server --follow
    
  2. 测试单个组件 使用上面的测试部分

  3. 检查AWS Lambda控制台:

    • 转到AWS控制台→ 拉姆达→ atlasian mcp服务器
    • 检查功能配置和最近的调用
  4. 验证Q CLI配置:

    cat ~/.config/q/mcp-servers.json
    

通用命令参考

# Deploy/Update
./deploy.sh JIRA_TOKEN WORKSPACE USERNAME APP_PASSWORD

# Test Q CLI
q chat "test message"

# Check AWS function
aws lambda get-function --function-name atlassian-mcp-server

# View logs
aws logs tail /aws/lambda/atlassian-mcp-server

# Update Bitbucket config
./configure-bitbucket.sh WORKSPACE USERNAME APP_PASSWORD

📄 许可证

MIT许可证-请参阅 许可证 文件。


🚀 快速入门摘要

  1. 安装工具:AWS CLI+亚马逊Q CLI
  2. 获取凭据:Jira API代币+Bitbucket应用程序密码
  3. 部署: ./deploy.sh JIRA_TOKEN WORKSPACE USERNAME APP_PASSWORD
  4. 使用: q chat "List my repositories and open issues"

您的无服务器Atlassian集成在10分钟内即可完成! 🎉