MCP JIRA Server

MCP JIRA Server

Enables comprehensive interaction with JIRA through the Model Context Protocol, supporting issue management, search, comments, attachments, workflow transitions, and custom fields with enterprise Kerberos authentication.

Category
访问服务器

README

MCP JIRA Server

A comprehensive Model Context Protocol (MCP) server for JIRA built with FastMCP that provides full API access with Kerberos authentication and extensive custom fields support.

Features

  • ⚡ FastMCP Framework: Built with FastMCP 2.0 for simplified, decorator-based server implementation
  • 🔐 Kerberos/GSSAPI Authentication: Native support for enterprise Kerberos authentication
  • 🎫 Multiple Auth Methods: Kerberos, API Token, and Basic Authentication
  • 🔧 Custom Fields: Automatic field resolution and type conversion
  • 📝 Complete Operations: Issues, Search, Comments, Attachments, Transitions, Projects
  • 🔄 Retry Logic: Automatic retry with backoff for failed requests
  • 💾 Field Caching: Efficient custom field metadata caching

Installation

Prerequisites

  • Python 3.10 or higher
  • Access to a JIRA instance
  • For Kerberos: Valid Kerberos ticket or keytab file

Install UV (Recommended)

If you don't have uv installed, install it first:

# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

# Or via pip
pip install uv

Create Virtual Environment and Install Dependencies

Using uv (recommended - fast and efficient):

cd /Users/hanuman/.gemini/antigravity/scratch/mcp-jira-server

# Create virtual environment
uv venv

# Activate virtual environment
source .venv/bin/activate  # macOS/Linux
# or
.venv\Scripts\activate  # Windows

# Install dependencies
uv pip install -e .

Using pip (alternative):

cd /Users/hanuman/.gemini/antigravity/scratch/mcp-jira-server

# Create virtual environment
python -m venv .venv

# Activate virtual environment
source .venv/bin/activate  # macOS/Linux
# or
.venv\Scripts\activate  # Windows

# Install dependencies
pip install -e .

Note: This project uses FastMCP 2.0, which provides a streamlined decorator-based approach to building MCP servers. Using uv is recommended for faster dependency resolution and installation.

Kerberos Setup

macOS

# Install Kerberos dependencies
brew install krb5

# Install Python Kerberos packages
pip install requests-gssapi

Linux (Ubuntu/Debian)

# Install Kerberos dependencies
sudo apt-get install libkrb5-dev krb5-user

# Install Python Kerberos packages
pip install requests-gssapi

Initialize Kerberos Ticket

# Using kinit (interactive)
kinit your.username@REALM

# Verify ticket
klist

# Or use keytab file (set in .env)
kinit -kt /path/to/your.keytab principal@REALM

Configuration

Create a .env file in the project root:

cp .env.example .env

Edit .env with your JIRA configuration:

# JIRA Configuration
JIRA_URL=https://jira.yourcompany.com

# Authentication Method
AUTH_METHOD=kerberos  # or api_token or basic

# Kerberos (when AUTH_METHOD=kerberos)
KERBEROS_PRINCIPAL=HTTP/jira.yourcompany.com@REALM
KERBEROS_KEYTAB_PATH=/path/to/your.keytab
KERBEROS_MUTUAL_AUTH=true

# API Token (when AUTH_METHOD=api_token)
JIRA_EMAIL=your.email@example.com
JIRA_API_TOKEN=your_api_token_here

# Optional Settings
LOG_LEVEL=INFO
CUSTOM_FIELDS_CACHE_TTL=3600
REQUEST_TIMEOUT=30

Usage

Running the Server

Make sure your virtual environment is activated first:

# Activate virtual environment if not already active
source .venv/bin/activate  # macOS/Linux
# or
.venv\Scripts\activate  # Windows

# Run as module
python -m mcp_jira

# Or use entry point (after installation)
mcp-jira-server

MCP Client Configuration

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "jira": {
      "command": "python",
      "args": ["-m", "mcp_jira"],
      "env": {
        "JIRA_URL": "https://jira.yourcompany.com",
        "AUTH_METHOD": "kerberos"
      }
    }
  }
}

Other MCP Clients

The server uses stdio transport and can be integrated with any MCP client that supports stdio.

Available Tools

Issue Operations

  • jira_create_issue: Create new issue with custom fields
  • jira_get_issue: Get issue details
  • jira_update_issue: Update issue fields
  • jira_delete_issue: Delete issue
  • jira_assign_issue: Assign issue to user

Search & Query

  • jira_search_issues: Search using JQL with pagination

Comments

  • jira_add_comment: Add comment to issue

Attachments

  • jira_upload_attachment: Upload file to issue

Workflow

  • jira_get_transitions: Get available transitions
  • jira_transition_issue: Move issue through workflow

Metadata

  • jira_list_projects: List accessible projects
  • jira_get_custom_fields: Get custom field definitions

Available Resources

  • jira://projects: List of all projects
  • jira://custom-fields: Custom field definitions
  • jira://current-user: Current user information

Examples

Create Issue with Custom Fields

{
  "tool": "jira_create_issue",
  "arguments": {
    "project": "PROJ",
    "summary": "Example issue",
    "issue_type": "Bug",
    "description": "This is a test issue",
    "priority": "High",
    "custom_fields": {
      "Story Points": 5,
      "Sprint": "Sprint 23",
      "Custom Date Field": "2024-12-31"
    }
  }
}

Search Issues

{
  "tool": "jira_search_issues",
  "arguments": {
    "jql": "project = PROJ AND status = 'In Progress'",
    "max_results": 50
  }
}

Transition Issue

{
  "tool": "jira_transition_issue",
  "arguments": {
    "issue_key": "PROJ-123",
    "transition": "In Progress",
    "comment": "Starting work on this issue"
  }
}

Custom Fields

The server automatically resolves custom field names to IDs and handles type conversion:

  • Text fields: Single/multi-line text
  • Select fields: Single/multi-select options
  • Date fields: Date and DateTime
  • User fields: User picker
  • Number fields: Numeric values
  • Arrays: Multi-value fields

Custom Field Usage

You can reference custom fields by name or ID:

# By name
"custom_fields": {
  "Story Points": 5,
  "Epic Link": "PROJ-100"
}

# By ID
"custom_fields": {
  "customfield_10016": 5,
  "customfield_10014": "PROJ-100"
}

Troubleshooting

Kerberos Issues

Problem: No valid Kerberos ticket found

Solution:

# Initialize ticket
kinit your.username@REALM

# Verify
klist

Problem: Server not found in Kerberos database

Solution: Verify KERBEROS_PRINCIPAL matches your JIRA server's SPN

Connection Issues

Problem: Failed to connect to JIRA

Solution:

  • Verify JIRA_URL is correct
  • Check network connectivity
  • Verify authentication credentials
  • Check logs for detailed error messages

Custom Fields Not Found

Problem: Custom field not resolved

Solution:

# List all custom fields
# Use jira_get_custom_fields tool to see available fields

# Clear cache if fields were recently added
# Restart the server

Development

Running Tests

# Install dev dependencies with uv
uv pip install -e ".[dev]"

# Or with pip
pip install -e ".[dev]"

# Run tests
pytest tests/

# Run with coverage
pytest --cov=mcp_jira tests/

Code Quality

# Format code
black src/

# Type checking
mypy src/

# Linting
ruff check src/

Architecture

The server uses FastMCP for a streamlined, decorator-based implementation with a layered architecture:

graph TB
    subgraph "MCP Clients"
        CD[Claude Desktop]
        OC[Other MCP Clients]
    end

    subgraph "MCP JIRA Server"
        subgraph "Server Layer"
            MCP[FastMCP Server<br/>mcp_server.py]
            TOOLS["@mcp.tool() Decorators"]
            RES["@mcp.resource() Decorators"]
        end

        subgraph "Operations Layer"
            ISS[Issues<br/>issues.py]
            SRCH[Search<br/>search.py]
            CMT[Comments<br/>comments.py]
            ATT[Attachments<br/>attachments.py]
            TRN[Transitions<br/>transitions.py]
            PRJ[Projects<br/>projects.py]
        end

        subgraph "Client Layer"
            JC[JIRA Client<br/>jira_client.py]
            CF[Custom Fields Manager<br/>custom_fields.py]
        end

        subgraph "Authentication Layer"
            AM[Auth Manager<br/>auth_manager.py]
            KRB[Kerberos Auth<br/>kerberos_auth.py]
            ADFS[ADFS Auth<br/>adfs_auth.py]
            API[API Token /<br/>Basic Auth]
        end

        subgraph "Configuration"
            CFG[Config<br/>config.py]
            ENV[.env File]
        end

        subgraph "Models"
            MDL[Pydantic Types<br/>types.py]
        end
    end

    subgraph "External Services"
        JIRA[(JIRA Server<br/>REST API)]
        KDC[Kerberos KDC]
        ADFSS[ADFS Server]
    end

    CD <-->|stdio| MCP
    OC <-->|stdio| MCP
    
    MCP --> TOOLS
    MCP --> RES
    TOOLS --> ISS
    TOOLS --> SRCH
    TOOLS --> CMT
    TOOLS --> ATT
    TOOLS --> TRN
    TOOLS --> PRJ
    RES --> PRJ
    
    ISS --> JC
    SRCH --> JC
    CMT --> JC
    ATT --> JC
    TRN --> JC
    PRJ --> JC
    
    JC --> CF
    JC --> AM
    
    AM --> KRB
    AM --> ADFS
    AM --> API
    
    KRB --> KDC
    ADFS --> ADFSS
    JC --> JIRA
    
    CFG --> ENV
    MCP --> CFG
    JC --> CFG

    classDef serverLayer fill:#4a90d9,stroke:#2c5aa0,color:#fff
    classDef opsLayer fill:#50b356,stroke:#2d7a32,color:#fff
    classDef clientLayer fill:#f5a623,stroke:#c78515,color:#fff
    classDef authLayer fill:#9b59b6,stroke:#6c3483,color:#fff
    classDef external fill:#e74c3c,stroke:#a93226,color:#fff
    classDef config fill:#95a5a6,stroke:#717d7e,color:#fff

    class MCP,TOOLS,RES serverLayer
    class ISS,SRCH,CMT,ATT,TRN,PRJ opsLayer
    class JC,CF clientLayer
    class AM,KRB,ADFS,API authLayer
    class JIRA,KDC,ADFSS external
    class CFG,ENV,MDL config

Component Overview

Layer Components Responsibility
Server mcp_server.py FastMCP server with @mcp.tool() and @mcp.resource() decorators
Operations issues.py, search.py, comments.py, attachments.py, transitions.py, projects.py JIRA API operations and business logic
Client jira_client.py, custom_fields.py HTTP client, retry logic, and custom field resolution
Authentication auth_manager.py, kerberos_auth.py, adfs_auth.py Multi-method auth (Kerberos, ADFS, API Token, Basic)
Models types.py Pydantic type definitions for request/response validation
Config config.py Environment-based configuration management

Directory Structure

mcp-jira-server/
├── src/mcp_jira/
│   ├── auth/              # Authentication (Kerberos, ADFS, API token, basic)
│   ├── client/            # JIRA client and custom fields manager
│   ├── models/            # Pydantic type definitions
│   ├── operations/        # JIRA operations (issues, search, etc.)
│   ├── server/
│   │   └── mcp_server.py  # FastMCP server with @mcp.tool and @mcp.resource decorators
│   ├── config.py          # Configuration management
│   └── __main__.py        # Entry point
├── tests/                 # Test suite
├── pyproject.toml         # Project metadata
└── .env.example           # Example configuration

Key Design Principles

  • Layered Architecture: Clear separation between server, operations, client, and auth layers
  • Decorator-Based Tools: Simple @mcp.tool() and @mcp.resource() decorators for MCP integration
  • Pluggable Authentication: Support for multiple auth methods via AuthManager abstraction
  • Automatic Type Conversion: Parameter validation and type conversion from function signatures
  • Custom Field Resolution: Automatic field name-to-ID mapping with caching

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For issues and questions:

  • Check the troubleshooting section
  • Review JIRA API documentation
  • Check MCP protocol documentation

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选