Jira MCP Server
This project provides a simple, well-structured MCP (Model Context Protocol) server in Python that integrates with Jira. The server exposes two distinct actions for an AI to retrieve data from a Jira instance.
Project Structure```
jira-mcp/
├── src/
│ └── jira_mcp/
│ ├── init.py
│ ├── client.py
│ └── server.py
├── tests/
│ ├── init.py
│ └── test_jira_client.py
├── .env.example
├── .gitignore
├── debug_stdio.py
├── pyproject.toml
└── README.md
## Setup
1. **Create and Activate Virtual Environment:**
It is recommended to use a virtual environment:```bash
# Create virtual environment
python3 -m venv .venv
# Activate it
source .venv/bin/activate
```
2. **Install the Package:**
With the virtual environment activated, install the package in editable mode:```bash
pip install -e .
```
3. **Configuration:**
The server works by reading environment variables. You must set the following environment variables:
* `JIRA_SERVER_URL`
* `JIRA_USERNAME`
* `JIRA_API_TOKEN`
* `JIRA_DEFAULT_FIELDS` (Optional)
You can set these in your shell profile, or pass them when running the command.
## MCP Configuration
To use this server with an MCP client (like Claude Desktop), add the following configuration to your `claude_desktop_config.json` (or equivalent).
Make sure to update the environment variables with your Jira credentials and check that the python path matches your local setup.```json
{
"mcpServers": {
"jira-mcp": {
"type": "stdio",
"command": "/git/jira-mcp/.venv/bin/python3",
"args": [
"-m",
"jira_mcp.server"
],
"env": {
"JIRA_SERVER_URL": "",
"JIRA_USERNAME": "",
"JIRA_API_TOKEN": "",
"JIRA_DEFAULT_FIELDS": "summary,status,description,labels,issuetype,issuelinks,customfield_11404"
}
}
}
}
Running the Server
Option 1: Using the CLI command
After installation, you can run the server directly:```bash
Ensure env vars are set
export JIRA_SERVER_URL="https://your-domain.atlassian.net"
export JIRA_USERNAME="your-email@example.com"
export JIRA_API_TOKEN="your_api_token_here"
jira-mcp
### Option 2: Running via Python Module
You can also run it using the python module syntax:```bash
python3 -m jira_mcp.server
Debugging
A helper script debug_stdio.py is provided to run the server in stdio mode for debugging purposes. It can load environment variables from a .env file if desired (requires python-dotenv).
-
Create a
.envfile (optional for this script):bash cp .env.example .env
Populate it with your credentials. -
Run the debug script:
bash python3 debug_stdio.py
Available MCP Tools
get_jira_ticket(ticket_id: str): Retrieves the full, raw JSON data for a specific Jira ticket.get_jira_ticket_comments(ticket_id: str): Retrieves a list of all comments from a specific Jira ticket.