# midatm1234/prithvi-wxc-skills architecture

> Architecture diagram of the GitHub repository midatm1234/prithvi-wxc-skills, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/midatm1234/prithvi-wxc-skills
- Repository: https://github.com/midatm1234/prithvi-wxc-skills

## Overview

Prithvi WxC Downscaling is an agent-driven MCP product for reproducing weather downscaling runs on a local machine. The principal workflow checks machine readiness, obtains pinned inputs and code, configures and preflights a run, then executes preprocessing, scalar computation, training, inference, and evaluation; NARR refinement is an additional branch. Analysis and run replay are separate capabilities. The graph reflects README-documented stages and indexed source references; unsampled implementation details are not inferred, and optional HTTP serving is shown separately.

Main entry points: [`mcp/mcp_downscaling_tools.py`](https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/mcp_downscaling_tools.py) (Tool dispatcher), [`mcp/job_manager.py`](https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/job_manager.py) (Job orchestration), [`mcp/download_pipeline_data.py`](https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/download_pipeline_data.py) (Input acquisition), [`mcp/provenance.py`](https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/provenance.py) (Preflight and manifests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Agent interaction"]
  node_skills["Agent skills"]
  node_stdio["Stdio transport<br/>[mcp_stdio.py]"]
  node_http["HTTP/SSE transport<br/>[mcp_server.py]"]
  node_toolrouter["Tool dispatcher"]
end

subgraph group_readiness["Setup and inputs"]
  node_setup["Machine readiness<br/>[setup_tools.py]"]
  node_config["Paths and pins<br/>[config.py]"]
  node_downloads["Input acquisition"]
  node_downloaders["Dataset downloaders"]
  node_inputs[("Inputs and weights")]
end

subgraph group_execution["Downscaling execution"]
  node_yaml["Run configuration<br/>[yaml_tools.py]"]
  node_provenance["Preflight and manifests<br/>[provenance.py]"]
  node_jobs["Job orchestration<br/>[job_manager.py]"]
  node_trainingcode["Pinned training code"]
  node_results[("Run outputs")]
end

subgraph group_insight["Analysis and replay"]
  node_analysis["Data analysis<br/>[analyzer.py]"]
  node_replay["Run replay<br/>[provenance.py]"]
  node_knowledge["Workflow knowledge"]
end

node_agent(("Agent / MCP host"))
node_data_services(("Data providers"))

node_agent -->|"sends MCP calls"| node_stdio
node_agent -.->|"sends HTTP/SSE calls"| node_http
node_skills -->|"guides tool order"| node_agent
node_knowledge -->|"documents workflows"| node_agent
node_stdio -->|"dispatches tools"| node_toolrouter
node_http -->|"dispatches tools"| node_toolrouter
node_toolrouter -->|"checks readiness"| node_setup
node_toolrouter -->|"starts downloads"| node_downloads
node_toolrouter -->|"creates configs"| node_yaml
node_toolrouter -->|"starts and polls"| node_jobs
node_toolrouter -->|"invokes analysis"| node_analysis
node_toolrouter -->|"checks and replays"| node_provenance
node_setup -->|"reads paths and pins"| node_config
node_downloads -->|"reads paths and pins"| node_config
node_downloads -.->|"selects dataset fetchers"| node_downloaders
node_downloads -->|"fetches pinned data"| node_data_services
node_downloads -->|"writes downloaded inputs"| node_inputs
node_yaml -->|"localizes paths"| node_config
node_jobs -->|"reads run config"| node_yaml
node_jobs -->|"writes run manifest"| node_provenance
node_provenance -->|"checks pinned inputs"| node_config
node_jobs -->|"runs pipeline stages"| node_trainingcode
node_jobs -->|"uses pipeline inputs"| node_inputs
node_jobs -->|"writes run artifacts"| node_results
node_analysis -.->|"reads run outputs"| node_results
node_provenance -->|"relaunches recorded run"| node_jobs

click node_skills "https://github.com/midatm1234/prithvi-wxc-skills/tree/main/skills"
click node_stdio "https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/mcp_stdio.py"
click node_http "https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/mcp_server.py"
click node_toolrouter "https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/mcp_downscaling_tools.py"
click node_setup "https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/setup_tools.py"
click node_config "https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/config.py"
click node_downloads "https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/download_pipeline_data.py"
click node_downloaders "https://github.com/midatm1234/prithvi-wxc-skills/tree/main/mcp/downloaders"
click node_yaml "https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/yaml_tools.py"
click node_provenance "https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/provenance.py"
click node_jobs "https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/job_manager.py"
click node_analysis "https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/analyzer.py"
click node_replay "https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/provenance.py"
click node_knowledge "https://github.com/midatm1234/prithvi-wxc-skills/tree/main/playbooks"

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_skills,node_stdio,node_http,node_toolrouter toneBlue
class node_setup,node_config,node_downloads,node_downloaders,node_inputs toneAmber
class node_yaml,node_provenance,node_jobs,node_trainingcode,node_results toneMint
class node_analysis,node_replay,node_knowledge toneRose
class node_agent,node_data_services toneIndigo
```

## Components

### Agent interaction

- [Agent skills](https://github.com/midatm1234/prithvi-wxc-skills/tree/main/skills): `skills`
- [Stdio transport](https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/mcp_stdio.py): `mcp/mcp_stdio.py`
- [HTTP/SSE transport](https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/mcp_server.py): `mcp/mcp_server.py`
- [Tool dispatcher](https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/mcp_downscaling_tools.py): `mcp/mcp_downscaling_tools.py`

### Setup and inputs

- [Machine readiness](https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/setup_tools.py): `mcp/setup_tools.py`
- [Paths and pins](https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/config.py): `mcp/config.py`
- [Input acquisition](https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/download_pipeline_data.py): `mcp/download_pipeline_data.py`
- [Dataset downloaders](https://github.com/midatm1234/prithvi-wxc-skills/tree/main/mcp/downloaders): `mcp/downloaders`
- **Inputs and weights**

### Downscaling execution

- [Run configuration](https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/yaml_tools.py): `mcp/yaml_tools.py`
- [Preflight and manifests](https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/provenance.py): `mcp/provenance.py`
- [Job orchestration](https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/job_manager.py): `mcp/job_manager.py`
- **Pinned training code**
- **Run outputs**

### Analysis and replay

- [Data analysis](https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/analyzer.py): `mcp/analyzer.py`
- [Run replay](https://github.com/midatm1234/prithvi-wxc-skills/blob/main/mcp/provenance.py): `mcp/provenance.py`
- [Workflow knowledge](https://github.com/midatm1234/prithvi-wxc-skills/tree/main/playbooks): `playbooks`

### Other components

- **Agent / MCP host**
- **Data providers**

## Connections

- Agent / MCP host → Stdio transport: sends MCP calls (evidence: `mcp/mcp_stdio.py`)
- Agent / MCP host → HTTP/SSE transport: sends HTTP/SSE calls (evidence: `README.md`)
- Agent skills → Agent / MCP host: guides tool order (evidence: `README.md`)
- Workflow knowledge → Agent / MCP host: documents workflows (evidence: `README.md`)
- Stdio transport → Tool dispatcher: dispatches tools (evidence: `mcp/mcp_stdio.py`)
- HTTP/SSE transport → Tool dispatcher: dispatches tools (evidence: `mcp/mcp_server.py`)
- Tool dispatcher → Machine readiness: checks readiness (evidence: `mcp/mcp_downscaling_tools.py`)
- Tool dispatcher → Input acquisition: starts downloads (evidence: `mcp/mcp_downscaling_tools.py`)
- Tool dispatcher → Run configuration: creates configs (evidence: `mcp/mcp_downscaling_tools.py`)
- Tool dispatcher → Job orchestration: starts and polls (evidence: `mcp/mcp_downscaling_tools.py`)
- Tool dispatcher → Data analysis: invokes analysis (evidence: `mcp/mcp_downscaling_tools.py`)
- Tool dispatcher → Preflight and manifests: checks and replays (evidence: `mcp/mcp_downscaling_tools.py`)
- Machine readiness → Paths and pins: reads paths and pins (evidence: `mcp/setup_tools.py`)
- Input acquisition → Paths and pins: reads paths and pins (evidence: `mcp/download_pipeline_data.py`)
- Input acquisition → Dataset downloaders: selects dataset fetchers
- Input acquisition → Data providers: fetches pinned data (evidence: `README.md`)
- Input acquisition → Inputs and weights: writes downloaded inputs (evidence: `README.md`)
- Run configuration → Paths and pins: localizes paths (evidence: `mcp/yaml_tools.py`)
- Job orchestration → Run configuration: reads run config (evidence: `mcp/job_manager.py`)
- Job orchestration → Preflight and manifests: writes run manifest (evidence: `mcp/job_manager.py`)
- Preflight and manifests → Paths and pins: checks pinned inputs (evidence: `mcp/provenance.py`)
- Job orchestration → Pinned training code: runs pipeline stages (evidence: `README.md`)
- Job orchestration → Inputs and weights: uses pipeline inputs (evidence: `README.md`)
- Job orchestration → Run outputs: writes run artifacts (evidence: `README.md`)
- Data analysis → Run outputs: reads run outputs
- Preflight and manifests → Job orchestration: relaunches recorded run (evidence: `mcp/provenance.py`)
