JIRA MCP Server
A production-ready MCP server for JIRA integration that enables AI assistants to query JIRA issues and perform searches using natural language through JQL.
README
JIRA MCP Server
A production-ready Model Context Protocol (MCP) server for JIRA integration. This server enables AI assistants to query JIRA issues and perform searches using natural language.
🎯 What This Demonstrates
MCP Concepts
- Tool Registration: Using
@mcp.tooldecorator - Async Operations: Asynchronous tool functions
- Tool Documentation: Proper descriptions and type hints
- Server Lifecycle: Managing MCP sessions with FastAPI
- HTTP Streaming: Stateless HTTP-based MCP communication
Integration Patterns
- API Wrapper Design: Clean separation between MCP layer and API layer
- Error Handling: Robust error handling for API failures
- Configuration: Environment-based configuration
- Formatting: LLM-friendly Markdown output
- Authentication: Bearer token authentication
🚀 Quick Start
Prerequisites
- Python 3.11 or higher
- JIRA instance (Atlassian Cloud or self-hosted)
- JIRA API token with appropriate permissions
Installation
-
Navigate to this directory:
cd 20_mcp/04-implementations/02-jira-server -
Install dependencies:
# Using uv (recommended) uv venv uv sync # Or using pip python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt -
Configure environment:
cp .env.example .env nano .env
Configuration
Create a .env file with your JIRA details:
# JIRA Configuration
JIRA_API_TOKEN=your_api_token_here
JIRA_BASE_URL=https://your-company.atlassian.net
# Optional: Custom SSL Certificate Path
# JIRA_CERT_PATH=/path/to/ca-bundle.crt
# Optional: Server Port
PORT=8000
Getting Your JIRA API Token
For Atlassian Cloud:
- Log in to https://id.atlassian.com
- Go to Security → API tokens
- Click Create API token
- Copy the token and add to
.env
For Self-Hosted JIRA:
- Log in to your JIRA instance
- Go to Profile → Personal Access Tokens
- Create a new token with appropriate scopes
- Copy the token and add to
.env
Running the Server
# Method 1: Using Python
python server.py
# Method 2: Using uvicorn directly
uvicorn server:app --host 0.0.0.0 --port 8000
# Method 3: Using uv
uv run server.py
Server will be available at:
- MCP Endpoint: http://localhost:8000/jira
- API Docs: http://localhost:8000/docs
📖 Usage
Available Tools
1. Get JIRA Issue
Fetch detailed information about a specific JIRA issue.
Example:
# Single issue
get_jira_issue("PROJECT-123")
# Multiple issues (comma-separated)
get_jira_issue("PROJECT-123,PROJECT-456")
Returns:
### Issue PROJECT-123: Fix login bug
**Status:** Open
#### Description:
Users cannot log in after password reset. Error occurs on login page...
2. Search JIRA Issues
Search for issues using JQL (JIRA Query Language).
Example JQL Queries:
# Open issues in a project
project = MYPROJECT AND status = Open
# High priority bugs assigned to you
assignee = currentUser() AND priority = High AND type = Bug
# Recently created issues
created >= -7d
# Search by text
summary ~ "performance" OR description ~ "performance"
# Complex query
project = MYPROJECT AND status IN (Open, "In Progress") AND assignee = currentUser() ORDER BY priority DESC
Example:
search_jira_issue("project = MYPROJECT AND status = Open")
Returns:
### Issue PROJECT-123: Fix login bug
**Status:** Open
#### Description:
Users cannot log in...
### Issue PROJECT-456: Update API documentation
**Status:** Open
#### Description:
API docs need updating...
🔌 Integration with AI Assistants
VS Code with GitHub Copilot
Add to your VS Code settings.json:
{
"mcp.servers": {
"jira": {
"command": "python",
"args": ["/path/to/20_mcp/04-implementations/02-jira-server/server.py"],
"env": {
"JIRA_API_TOKEN": "${env:JIRA_API_TOKEN}",
"JIRA_BASE_URL": "https://your-company.atlassian.net"
}
}
}
}
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"jira": {
"command": "python",
"args": ["/path/to/20_mcp/04-implementations/02-jira-server/server.py"],
"env": {
"JIRA_API_TOKEN": "your_token_here",
"JIRA_BASE_URL": "https://your-company.atlassian.net"
}
}
}
}
Using with MCP Client
from mcp.client import Client
async with Client("http://localhost:8000/jira") as client:
# Get issue details
result = await client.call_tool("get_jira_issue", {"issue_key": "PROJECT-123"})
print(result)
# Search issues
result = await client.call_tool(
"search_jira_issue",
{"query": "project = MYPROJECT AND status = Open"}
)
print(result)
🐳 Docker Deployment
FROM python:3.11-slim
WORKDIR /app
COPY pyproject.toml ./
RUN pip install uv && uv sync
COPY . .
CMD ["python", "server.py"]
Build and run:
docker build -t jira-mcp .
docker run -p 8000:8000 --env-file .env jira-mcp
🔒 Security Considerations
Authentication
- ✅ Uses Bearer token authentication (secure)
- ✅ Tokens stored in environment variables (not in code)
- ✅ Supports custom SSL certificates for enterprise
- ⚠️ Ensure
.envis in.gitignore
Best Practices
- Use read-only JIRA tokens when possible
- Implement rate limiting for production
- Add request validation and sanitization
- Use HTTPS in production
- Implement proper logging (avoid logging tokens)
📚 JQL Reference
Common Operators
=: Equals!=: Not equals~: Contains text>,<,>=,<=: ComparisonIN: Match any of a listAND,OR: Logical operators
Common Fields
project: Project keystatus: Issue statusassignee: Assigned userpriority: Issue prioritytype: Issue type (Bug, Story, etc.)created,updated: Datessummary,description: Text fields
Special Functions
currentUser(): Current logged-in user-7d: Relative dates (7 days ago)ORDER BY: Sort results
Full JQL Documentation:
- https://support.atlassian.com/jira-service-management-cloud/docs/use-advanced-search-with-jira-query-language-jql/
🧪 Testing
# Run tests
pytest
# With coverage
pytest --cov=. --cov-report=html
# Test individual tool
python -c "
from jiraAPI import JIRA
print(JIRA.get_jira_issue('PROJECT-123'))
"
🔧 Customization
Adding More Tools
@mcp.tool(description="Create a new JIRA issue")
async def create_jira_issue(
project: str,
summary: str,
description: str,
issue_type: str = "Task"
) -> str:
"""Create a new JIRA issue"""
# Implementation here
pass
Adding Resources
@mcp.resource("jira://projects")
async def list_projects() -> str:
"""List all available JIRA projects"""
# Implementation here
pass
Adding Prompts
@mcp.prompt()
async def analyze_sprint() -> str:
"""Generate a sprint analysis prompt"""
return "Analyze the current sprint and provide insights..."
📊 Architecture
┌─────────────────┐
│ AI Assistant │ (Claude, GPT, Copilot)
└────────┬────────┘
│ MCP Protocol
┌────────▼────────┐
│ FastAPI Server │ (server.py)
└────────┬────────┘
│
┌────────▼────────┐
│ jiraMCP.py │ (MCP Tools)
└────────┬────────┘
│
┌────────▼────────┐
│ jiraAPI.py │ (JIRA API Wrapper)
└────────┬────────┘
│ HTTPS
┌────────▼────────┐
│ JIRA Server │ (Atlassian Cloud / Self-Hosted)
└─────────────────┘
🐛 Troubleshooting
"Authentication failed"
- Verify JIRA_API_TOKEN is correct
- Check token hasn't expired
- Ensure token has appropriate permissions
"SSL Certificate verify failed"
- For self-hosted JIRA with custom certs, set JIRA_CERT_PATH
- For Atlassian Cloud, ensure JIRA_CERT_PATH is not set or set to
None
"Issue not found"
- Verify issue key format (e.g., "PROJECT-123")
- Check you have permission to view the issue
- Ensure project key is correct
"JQL query failed"
- Validate JQL syntax at: https://your-jira-instance/secure/IssueNavigator.jspa
- Check field names are correct
- Ensure you have permission for the queried projects
📝 License
MIT License - Feel free to use in your projects
🤝 Contributing
This is an educational example. Feel free to:
- Extend with more JIRA operations
- Add better error handling
- Implement caching
- Add rate limiting
- Improve documentation
📚 Related Documentation
- MCP Protocol Documentation
- JIRA REST API Reference
- JQL Documentation
- FastAPI Documentation
- FastMCP Documentation
Part of the MCP Learning Guide: Main Repository
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。