# rajeevmax12/ai-agent architecture

> Architecture diagram of the GitHub repository rajeevmax12/ai-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rajeevmax12/ai-agent
- Repository: https://github.com/rajeevmax12/ai-agent

## Overview

The product is a Jira automation agent with a separate stdio MCP server and a React review UI. A user submits a goal, reviews a generated plan, explicitly approves it, then starts execution; the executor dispatches approved steps through MCP, with signed one-use authorization for comments. Task state is persisted across restarts. The README also documents tool discovery and Jira search, lookup, and approved-comment capabilities. Relationships below follow source-index references or README statements; unsampled details are omitted where the call path is not shown.

Main entry points: [`Services/AgentTaskService.cs`](https://github.com/rajeevmax12/ai-agent/blob/main/Services/AgentTaskService.cs) (Task orchestration), [`Services/AgentExecutor.cs`](https://github.com/rajeevmax12/ai-agent/blob/main/Services/AgentExecutor.cs) (Plan execution), [`Api/AgentTaskEndpoints.cs`](https://github.com/rajeevmax12/ai-agent/blob/main/Api/AgentTaskEndpoints.cs) (Task API), [`Jira.McpServer/JiraTools.cs`](https://github.com/rajeevmax12/ai-agent/blob/main/Jira.McpServer/JiraTools.cs) (Jira tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User interface"]
  node_ui["Review UI<br/>[App.tsx]"]
end

subgraph group_host["Agent host"]
  node_api["Task API"]
  node_auth["API key guard"]
  node_taskservice["Task orchestration"]
  node_planner["Plan generation<br/>[AgentPlanner.cs]"]
  node_executor["Plan execution<br/>[AgentExecutor.cs]"]
  node_mcpfactory["MCP client factory"]
  node_approval["Comment approval tokens"]
end

subgraph group_state["Task state"]
  node_store[("Task persistence<br/>[AgentTaskStore.cs]")]
  node_taskmodel["Task records<br/>[AgentTask.cs]"]
end

subgraph group_mcp["Jira MCP server"]
  node_mcpserver["MCP stdio server<br/>[Program.cs]"]
  node_tools["Jira tools<br/>[JiraTools.cs]"]
  node_jiraclient["Jira REST client<br/>[JiraClient.cs]"]
  node_issue["Issue model<br/>[JiraIssue.cs]"]
end

node_user(("Operator"))
node_jira["Jira Cloud"]
node_model["Model provider"]

node_user -->|"submits goal"| node_ui
node_ui -->|"calls task routes"| node_api
node_api -->|"passes through"| node_auth
node_api -->|"delegates tasks"| node_taskservice
node_taskservice -->|"creates plan"| node_planner
node_planner -->|"requests plan"| node_model
node_taskservice -->|"discovers tools"| node_mcpfactory
node_taskservice -->|"saves and reads"| node_store
node_store -->|"serializes records"| node_taskmodel
node_user -->|"approves then executes"| node_taskservice
node_taskservice -->|"executes approved task"| node_executor
node_executor -->|"connects for tools"| node_mcpfactory
node_executor -->|"signs comment calls"| node_approval
node_executor -->|"records progress"| node_store
node_mcpfactory -->|"launches over stdio"| node_mcpserver
node_mcpserver -->|"registers tools"| node_tools
node_tools -->|"validates comment token"| node_approval
node_tools -->|"invokes Jira operations"| node_jiraclient
node_jiraclient -->|"searches, reads, comments"| node_jira
node_jiraclient -->|"parses issue data"| node_issue
node_user -->|"lists saved tasks"| node_api

click node_ui "https://github.com/rajeevmax12/ai-agent/blob/main/web/src/App.tsx"
click node_api "https://github.com/rajeevmax12/ai-agent/blob/main/Api/AgentTaskEndpoints.cs"
click node_auth "https://github.com/rajeevmax12/ai-agent/blob/main/Api/AutomationApiKeyMiddleware.cs"
click node_taskservice "https://github.com/rajeevmax12/ai-agent/blob/main/Services/AgentTaskService.cs"
click node_planner "https://github.com/rajeevmax12/ai-agent/blob/main/Services/AgentPlanner.cs"
click node_executor "https://github.com/rajeevmax12/ai-agent/blob/main/Services/AgentExecutor.cs"
click node_mcpfactory "https://github.com/rajeevmax12/ai-agent/blob/main/Services/JiraMcpClientFactory.cs"
click node_approval "https://github.com/rajeevmax12/ai-agent/blob/main/Security/ApprovalTokenService.cs"
click node_store "https://github.com/rajeevmax12/ai-agent/blob/main/Services/AgentTaskStore.cs"
click node_taskmodel "https://github.com/rajeevmax12/ai-agent/blob/main/Models/AgentTask.cs"
click node_mcpserver "https://github.com/rajeevmax12/ai-agent/blob/main/Jira.McpServer/Program.cs"
click node_tools "https://github.com/rajeevmax12/ai-agent/blob/main/Jira.McpServer/JiraTools.cs"
click node_jiraclient "https://github.com/rajeevmax12/ai-agent/blob/main/Services/JiraClient.cs"
click node_issue "https://github.com/rajeevmax12/ai-agent/blob/main/Models/JiraIssue.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ui toneBlue
class node_api,node_auth,node_taskservice,node_planner,node_executor,node_mcpfactory,node_approval toneAmber
class node_store,node_taskmodel toneMint
class node_mcpserver,node_tools,node_jiraclient,node_issue toneRose
class node_user,node_jira,node_model toneIndigo
```

## Components

### User interface

- [Review UI](https://github.com/rajeevmax12/ai-agent/blob/main/web/src/App.tsx): `web/src/App.tsx`

### Agent host

- [Task API](https://github.com/rajeevmax12/ai-agent/blob/main/Api/AgentTaskEndpoints.cs): `Api/AgentTaskEndpoints.cs`
- [API key guard](https://github.com/rajeevmax12/ai-agent/blob/main/Api/AutomationApiKeyMiddleware.cs): `Api/AutomationApiKeyMiddleware.cs`
- [Task orchestration](https://github.com/rajeevmax12/ai-agent/blob/main/Services/AgentTaskService.cs): `Services/AgentTaskService.cs`
- [Plan generation](https://github.com/rajeevmax12/ai-agent/blob/main/Services/AgentPlanner.cs): `Services/AgentPlanner.cs`
- [Plan execution](https://github.com/rajeevmax12/ai-agent/blob/main/Services/AgentExecutor.cs): `Services/AgentExecutor.cs`
- [MCP client factory](https://github.com/rajeevmax12/ai-agent/blob/main/Services/JiraMcpClientFactory.cs): `Services/JiraMcpClientFactory.cs`
- [Comment approval tokens](https://github.com/rajeevmax12/ai-agent/blob/main/Security/ApprovalTokenService.cs): `Security/ApprovalTokenService.cs`

### Task state

- [Task persistence](https://github.com/rajeevmax12/ai-agent/blob/main/Services/AgentTaskStore.cs): `Services/AgentTaskStore.cs`
- [Task records](https://github.com/rajeevmax12/ai-agent/blob/main/Models/AgentTask.cs): `Models/AgentTask.cs`

### Jira MCP server

- [MCP stdio server](https://github.com/rajeevmax12/ai-agent/blob/main/Jira.McpServer/Program.cs): `Jira.McpServer/Program.cs`
- [Jira tools](https://github.com/rajeevmax12/ai-agent/blob/main/Jira.McpServer/JiraTools.cs): `Jira.McpServer/JiraTools.cs`
- [Jira REST client](https://github.com/rajeevmax12/ai-agent/blob/main/Services/JiraClient.cs): `Services/JiraClient.cs`
- [Issue model](https://github.com/rajeevmax12/ai-agent/blob/main/Models/JiraIssue.cs): `Models/JiraIssue.cs`

### Other components

- **Operator**
- **Jira Cloud**
- **Model provider**

## Connections

- Operator → Review UI: submits goal (evidence: `README.md`)
- Review UI → Task API: calls task routes (evidence: `README.md`)
- Task API → API key guard: passes through
- Task API → Task orchestration: delegates tasks (evidence: `Api/AgentTaskEndpoints.cs`)
- Task orchestration → Plan generation: creates plan (evidence: `Services/AgentTaskService.cs`)
- Plan generation → Model provider: requests plan (evidence: `README.md`)
- Task orchestration → MCP client factory: discovers tools (evidence: `Services/AgentTaskService.cs`)
- Task orchestration → Task persistence: saves and reads (evidence: `Services/AgentTaskService.cs`)
- Task persistence → Task records: serializes records (evidence: `Services/AgentTaskStore.cs`)
- Operator → Task orchestration: approves then executes (evidence: `README.md`)
- Task orchestration → Plan execution: executes approved task (evidence: `Services/AgentTaskService.cs`)
- Plan execution → MCP client factory: connects for tools (evidence: `Services/AgentExecutor.cs`)
- Plan execution → Comment approval tokens: signs comment calls (evidence: `Services/AgentExecutor.cs`)
- Plan execution → Task persistence: records progress (evidence: `Services/AgentExecutor.cs`)
- MCP client factory → MCP stdio server: launches over stdio (evidence: `Services/JiraMcpClientFactory.cs`)
- MCP stdio server → Jira tools: registers tools (evidence: `Jira.McpServer/Program.cs`)
- Jira tools → Comment approval tokens: validates comment token (evidence: `Jira.McpServer/JiraTools.cs`)
- Jira tools → Jira REST client: invokes Jira operations (evidence: `Jira.McpServer/JiraTools.cs`)
- Jira REST client → Jira Cloud: searches, reads, comments (evidence: `Services/JiraClient.cs`)
- Jira REST client → Issue model: parses issue data (evidence: `Services/JiraClient.cs`)
- Operator → Task API: lists saved tasks (evidence: `README.md`)
