# ravisidh36/shogun-using-mcp architecture

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

- Interactive diagram: https://gitdiagram.com/ravisidh36/shogun-using-mcp
- Repository: https://github.com/ravisidh36/shogun-using-mcp

## Overview

Shogun turns a travel request into selectively routed flight, hotel, weather, budget, or itinerary intelligence, with human review before itinerary finalization. The web UI submits requests to FastAPI, which invokes the LangGraph workflow; results return to the UI, and itinerary drafts can be approved or revised. README documentation supplies several workflow and integration links; sampled source confirms API dispatch, MCP calls, weather-provider requests, and UI requests. Unsampled graph details are represented only where documented.

Main entry points: [`backend.py`](https://github.com/ravisidh36/shogun-using-mcp/blob/main/backend.py) (Guardrail and supervisor), [`mcp_client.py`](https://github.com/ravisidh36/shogun-using-mcp/blob/main/mcp_client.py) (MCP tool client), [`static/script.js`](https://github.com/ravisidh36/shogun-using-mcp/blob/main/static/script.js) (Travel command UI), [`app.py`](https://github.com/ravisidh36/shogun-using-mcp/blob/main/app.py) (FastAPI endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_webui["Travel command UI<br/>[script.js]"]
  node_api["FastAPI endpoints<br/>[app.py]"]
  node_pdf["PDF export<br/>[pdf_export.py]"]
end

subgraph group_orchestration["Workflow orchestration"]
  node_supervisor["Guardrail and supervisor<br/>[backend.py]"]
  node_approval["Human approval<br/>[backend.py]"]
  node_final["Final response<br/>[backend.py]"]
  node_llmguard["LLM context protection<br/>[mcp_client.py]"]
end

subgraph group_research["Travel intelligence"]
  node_flight["Flight research<br/>[backend.py]"]
  node_hotel["Hotel research<br/>[backend.py]"]
  node_weather["Weather research<br/>[backend.py]"]
  node_budget["Budget analysis<br/>[backend.py]"]
  node_itinerary["Itinerary drafting<br/>[backend.py]"]
end

subgraph group_services["Persistence and providers"]
  node_mcpclient["MCP tool client<br/>[mcp_client.py]"]
  node_weatherserver["Weather MCP server"]
  node_postgres[("PostgreSQL checkpoints")]
  node_groq{{"Groq model"}}
  node_aviation{{"AviationStack MCP"}}
  node_tavily{{"Tavily MCP"}}
  node_openweather{{"OpenWeather API"}}
end

node_traveler(("Traveler"))

node_traveler -->|"submits request"| node_webui
node_webui -->|"posts request"| node_api
node_api -->|"runs workflow"| node_supervisor
node_api -->|"resumes thread"| node_approval
node_supervisor -->|"routes selectively"| node_flight
node_supervisor -->|"routes selectively"| node_hotel
node_supervisor -->|"routes selectively"| node_weather
node_supervisor -->|"routes selectively"| node_budget
node_supervisor -->|"routes selectively"| node_itinerary
node_flight -->|"requests tools"| node_mcpclient
node_hotel -->|"searches lodging"| node_mcpclient
node_weather -->|"requests forecast"| node_mcpclient
node_mcpclient -->|"loads aviation tools"| node_aviation
node_mcpclient -->|"loads search tools"| node_tavily
node_mcpclient -->|"loads weather tools"| node_weatherserver
node_weatherserver -->|"requests conditions"| node_openweather
node_itinerary -->|"requests review"| node_approval
node_approval -->|"approves or revises"| node_final
node_final -->|"bounds context"| node_llmguard
node_llmguard -->|"invokes model"| node_groq
node_final -->|"returns results"| node_webui
node_supervisor -->|"checkpoints state"| node_postgres
node_approval -->|"resumes thread"| node_postgres
node_webui -->|"exports briefing"| node_pdf

click node_webui "https://github.com/ravisidh36/shogun-using-mcp/blob/main/static/script.js"
click node_api "https://github.com/ravisidh36/shogun-using-mcp/blob/main/app.py"
click node_pdf "https://github.com/ravisidh36/shogun-using-mcp/blob/main/utils/pdf_export.py"
click node_supervisor "https://github.com/ravisidh36/shogun-using-mcp/blob/main/backend.py"
click node_flight "https://github.com/ravisidh36/shogun-using-mcp/blob/main/backend.py"
click node_hotel "https://github.com/ravisidh36/shogun-using-mcp/blob/main/backend.py"
click node_weather "https://github.com/ravisidh36/shogun-using-mcp/blob/main/backend.py"
click node_budget "https://github.com/ravisidh36/shogun-using-mcp/blob/main/backend.py"
click node_itinerary "https://github.com/ravisidh36/shogun-using-mcp/blob/main/backend.py"
click node_approval "https://github.com/ravisidh36/shogun-using-mcp/blob/main/backend.py"
click node_final "https://github.com/ravisidh36/shogun-using-mcp/blob/main/backend.py"
click node_llmguard "https://github.com/ravisidh36/shogun-using-mcp/blob/main/mcp_client.py"
click node_mcpclient "https://github.com/ravisidh36/shogun-using-mcp/blob/main/mcp_client.py"
click node_weatherserver "https://github.com/ravisidh36/shogun-using-mcp/blob/main/mcp_customserver.py"

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_webui,node_api,node_pdf toneBlue
class node_supervisor,node_approval,node_final,node_llmguard toneAmber
class node_flight,node_hotel,node_weather,node_budget,node_itinerary toneMint
class node_mcpclient,node_weatherserver,node_postgres,node_groq,node_aviation,node_tavily,node_openweather toneRose
class node_traveler toneIndigo
```

## Components

### Web experience

- [Travel command UI](https://github.com/ravisidh36/shogun-using-mcp/blob/main/static/script.js): `static/script.js`
- [FastAPI endpoints](https://github.com/ravisidh36/shogun-using-mcp/blob/main/app.py): `app.py`
- [PDF export](https://github.com/ravisidh36/shogun-using-mcp/blob/main/utils/pdf_export.py): `utils/pdf_export.py`

### Workflow orchestration

- [Guardrail and supervisor](https://github.com/ravisidh36/shogun-using-mcp/blob/main/backend.py): `backend.py`
- [Human approval](https://github.com/ravisidh36/shogun-using-mcp/blob/main/backend.py): `backend.py`
- [Final response](https://github.com/ravisidh36/shogun-using-mcp/blob/main/backend.py): `backend.py`
- [LLM context protection](https://github.com/ravisidh36/shogun-using-mcp/blob/main/mcp_client.py): `mcp_client.py`

### Travel intelligence

- [Flight research](https://github.com/ravisidh36/shogun-using-mcp/blob/main/backend.py): `backend.py`
- [Hotel research](https://github.com/ravisidh36/shogun-using-mcp/blob/main/backend.py): `backend.py`
- [Weather research](https://github.com/ravisidh36/shogun-using-mcp/blob/main/backend.py): `backend.py`
- [Budget analysis](https://github.com/ravisidh36/shogun-using-mcp/blob/main/backend.py): `backend.py`
- [Itinerary drafting](https://github.com/ravisidh36/shogun-using-mcp/blob/main/backend.py): `backend.py`

### Persistence and providers

- [MCP tool client](https://github.com/ravisidh36/shogun-using-mcp/blob/main/mcp_client.py): `mcp_client.py`
- [Weather MCP server](https://github.com/ravisidh36/shogun-using-mcp/blob/main/mcp_customserver.py): `mcp_customserver.py`
- **PostgreSQL checkpoints**
- **Groq model**
- **AviationStack MCP**
- **Tavily MCP**
- **OpenWeather API**

### Other components

- **Traveler**

## Connections

- Traveler → Travel command UI: submits request (evidence: `README.md`)
- Travel command UI → FastAPI endpoints: posts request (evidence: `static/script.js`)
- FastAPI endpoints → Guardrail and supervisor: runs workflow (evidence: `app.py`)
- FastAPI endpoints → Human approval: resumes thread (evidence: `app.py`)
- Guardrail and supervisor → Flight research: routes selectively (evidence: `README.md`)
- Guardrail and supervisor → Hotel research: routes selectively (evidence: `README.md`)
- Guardrail and supervisor → Weather research: routes selectively (evidence: `README.md`)
- Guardrail and supervisor → Budget analysis: routes selectively (evidence: `README.md`)
- Guardrail and supervisor → Itinerary drafting: routes selectively (evidence: `README.md`)
- Flight research → MCP tool client: requests tools (evidence: `backend.py`)
- Hotel research → MCP tool client: searches lodging (evidence: `backend.py`)
- Weather research → MCP tool client: requests forecast (evidence: `backend.py`)
- MCP tool client → AviationStack MCP: loads aviation tools (evidence: `README.md`)
- MCP tool client → Tavily MCP: loads search tools (evidence: `README.md`)
- MCP tool client → Weather MCP server: loads weather tools (evidence: `mcp_client.py`)
- Weather MCP server → OpenWeather API: requests conditions (evidence: `mcp_customserver.py`)
- Itinerary drafting → Human approval: requests review (evidence: `README.md`)
- Human approval → Final response: approves or revises (evidence: `README.md`)
- Final response → LLM context protection: bounds context (evidence: `README.md`)
- LLM context protection → Groq model: invokes model (evidence: `mcp_client.py`)
- Final response → Travel command UI: returns results (evidence: `README.md`)
- Guardrail and supervisor → PostgreSQL checkpoints: checkpoints state (evidence: `README.md`)
- Human approval → PostgreSQL checkpoints: resumes thread (evidence: `README.md`)
- Travel command UI → PDF export: exports briefing (evidence: `README.md`)
