# nguyenvanduocit/jira-mcp architecture

> Architecture diagram of the GitHub repository nguyenvanduocit/jira-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nguyenvanduocit/jira-mcp
- Repository: https://github.com/nguyenvanduocit/jira-mcp

## Overview

##### Project Type and Purpose
- It’s an open-source Go-based MCP connector/CLI for Atlassian Jira.
- It exposes a Model Control Protocol (MCP) interface over stdin/stdout (or Docker), translates incoming commands into Jira REST API calls, and returns structured JSON responses.

##### File Structure
- main.go + util/handler.go: the MCP server entrypoint and generic request router.
- tools/*.go: one file per Jira operation (issues, comments, sprints, transitions, etc.)—these are your “Command Handlers.”
- services/*.go: abstractions for core domain concepts (Atlassian host config, Jira service logic, HTTP client wrapper).
- .github/workflows, Dockerfile, justfile: CI/CD and build/deployment automation.
- go.mod/go.sum: dependency management.

##### README Insights
- Uses environment variables to configure ATLASSIAN_HOST, ATLASSIAN_EMAIL, ATLASSIAN_TOKEN.
- Runs as a standalone binary or Docker container.
- Integrates with AI assistants (e.g., Claude) by registering as an MCP server in Cursor.

##### Main Components
a. MCP Server / CLI Layer
– The “jira-mcp” binary (main.go) or Docker container entrypoint
– Listens on stdin/stdout for MCP messages
b. Command Handler Layer (tools package)
– Modules like jira_issue, jira_comment, jira_transition
– Parse command, validate input, call service methods
c. Service Layer (services package)
– atlassian.go: configuration & authentication
– jira.go: high-level business operations
– httpclient.go: generic HTTP client wrapper (retry, headers)
d. External System
– Atlassian Jira Cloud REST API
e. Configuration Store
– Environment variables (.env or Docker args)
f. CI/CD & Packaging (side annotation)
– GitHub Workflows, Dockerfile, justfile

##### Relationships and Data Flow
1. User/AI → MCP Server (stdin)
2. MCP Server → Command Handler (tools package)
3. Command Handler → Service Layer
4. Service Layer → HTTP Client → Jira REST API (HTTPS)
5. Response bubbles back through HTTP Client → Service → Handler → MCP Server → User/AI (stdout)

##### Architectural Patterns & Principles
- Layered architecture: clear separation of protocol (MCP), command parsing, business logic, and transport (HTTP).
- Single Responsibility: one tool file per Jira operation; one service file per domain slice.
- Environment-driven configuration for credentials and host.
- Containerization for portability (Docker).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Layer
    User["User/AI"]:::external

    %% MCP/CLI Layer
    subgraph "MCP/CLI Layer"
        CLI["jira-mcp (main.go)"]:::mcp
        Handler["Request Router (util/handler.go)"]:::mcp
    end

    %% Command Handlers Layer
    subgraph "Command Handlers"
        HC1["tools/jira_issue.go"]:::handler
        HC2["tools/jira_comment.go"]:::handler
        HC3["tools/jira_transition.go"]:::handler
        HC4["tools/jira_status.go"]:::handler
        HC5["tools/jira_sprint.go"]:::handler
        HC6["tools/jira_search.go"]:::handler
        HC7["tools/jira_worklog.go"]:::handler
        HC8["tools/jira_history.go"]:::handler
        HC9["tools/jira_relationship.go"]:::handler
    end

    %% Service Layer
    subgraph "Service Layer"
        S1["services/atlassian.go"]:::service
        S2["services/jira.go"]:::service
        S3["services/httpclient.go"]:::http
    end

    %% External API
    Jira["Atlassian Jira Cloud API"]:::external

    %% Configuration Store
    subgraph "Configuration Store"
        DF1["Dockerfile"]:::config
        JF1["justfile"]:::config
        ENV[".env"]:::config
    end

    %% CI/CD & Packaging
    subgraph "CI/CD & Packaging"
        RY[".github/workflows/release.yaml"]:::cicd
        SC[".github/workflows/scan.yaml"]:::cicd
        GL[".github/workflows/gitleaks.yaml"]:::cicd
        DF2["Dockerfile"]:::cicd
        JF2["justfile"]:::cicd
    end

    %% Data Flow
    User -->|"stdin: MCP Messages"| CLI
    CLI --> Handler
    Handler --> HC1
    Handler --> HC2
    Handler --> HC3
    Handler --> HC4
    Handler --> HC5
    Handler --> HC6
    Handler --> HC7
    Handler --> HC8
    Handler --> HC9

    HC1 -->|"calls"| S2
    HC2 -->|"calls"| S2
    HC3 -->|"calls"| S2
    HC4 -->|"calls"| S2
    HC5 -->|"calls"| S2
    HC6 -->|"calls"| S2
    HC7 -->|"calls"| S2
    HC8 -->|"calls"| S2
    HC9 -->|"calls"| S2

    S2 -->|"uses config"| S1
    S2 -->|"invokes HTTP"| S3
    S3 -->|"HTTPS"| Jira
    Jira -->|"response"| S3
    S3 --> S2
    S2 --> Handler
    Handler --> CLI
    CLI -->|"stdout: JSON Response"| User

    %% Click Events
    click CLI "https://github.com/nguyenvanduocit/jira-mcp/blob/main/main.go"
    click Handler "https://github.com/nguyenvanduocit/jira-mcp/blob/main/util/handler.go"
    click HC1 "https://github.com/nguyenvanduocit/jira-mcp/blob/main/tools/jira_issue.go"
    click HC2 "https://github.com/nguyenvanduocit/jira-mcp/blob/main/tools/jira_comment.go"
    click HC3 "https://github.com/nguyenvanduocit/jira-mcp/blob/main/tools/jira_transition.go"
    click HC4 "https://github.com/nguyenvanduocit/jira-mcp/blob/main/tools/jira_status.go"
    click HC5 "https://github.com/nguyenvanduocit/jira-mcp/blob/main/tools/jira_sprint.go"
    click HC6 "https://github.com/nguyenvanduocit/jira-mcp/blob/main/tools/jira_search.go"
    click HC7 "https://github.com/nguyenvanduocit/jira-mcp/blob/main/tools/jira_worklog.go"
    click HC8 "https://github.com/nguyenvanduocit/jira-mcp/blob/main/tools/jira_history.go"
    click HC9 "https://github.com/nguyenvanduocit/jira-mcp/blob/main/tools/jira_relationship.go"
    click S1 "https://github.com/nguyenvanduocit/jira-mcp/blob/main/services/atlassian.go"
    click S2 "https://github.com/nguyenvanduocit/jira-mcp/blob/main/services/jira.go"
    click S3 "https://github.com/nguyenvanduocit/jira-mcp/blob/main/services/httpclient.go"
    click DF1 "https://github.com/nguyenvanduocit/jira-mcp/tree/main/Dockerfile"
    click JF1 "https://github.com/nguyenvanduocit/jira-mcp/tree/main/justfile"
    click ENV "https://github.com/nguyenvanduocit/jira-mcp/blob/main/.env"
    click RY "https://github.com/nguyenvanduocit/jira-mcp/blob/main/.github/workflows/release.yaml"
    click SC "https://github.com/nguyenvanduocit/jira-mcp/blob/main/.github/workflows/scan.yaml"
    click GL "https://github.com/nguyenvanduocit/jira-mcp/blob/main/.github/workflows/gitleaks.yaml"
    click DF2 "https://github.com/nguyenvanduocit/jira-mcp/tree/main/Dockerfile"
    click JF2 "https://github.com/nguyenvanduocit/jira-mcp/tree/main/justfile"

    %% Styles
    classDef mcp fill:#AEDFF7,stroke:#0366d6,stroke-width:1px
    classDef handler fill:#C6F6C6,stroke:#2f855a,stroke-width:1px
    classDef service fill:#FEEBC8,stroke:#d69e2e,stroke-width:1px
    classDef http fill:#FBD38D,stroke:#dd6b20,stroke-width:1px
    classDef external fill:#E2E8F0,stroke:#718096,stroke-width:1px
    classDef config fill:#D6BCFA,stroke:#805ad5,stroke-width:1px
    classDef cicd fill:#FEB2B2,stroke:#c53030,stroke-width:1px
```
