# shrirajasekar/mcptest architecture

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

- Interactive diagram: https://gitdiagram.com/shrirajasekar/mcptest
- Repository: https://github.com/shrirajasekar/mcptest

## Overview

Market Data MCP exposes bounded-window OHLCV search, extrema, and moving-average queries to MCP clients over stdio or HTTP. The server obtains missing date bounds through elicitation, then delegates each query to the file-backed store, which routes to CSV data and uses metadata to prune scans; bounded caches support repeated lookups. The README also documents warehouse generation and adaptive manifest sharding. Source excerpts do not show every query implementation detail, so those documented storage relationships are cited to the README; no tests or benchmark utilities are included.

Main entry points: [`src/market_data_mcp/market_data.py`](https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/market_data.py) (Market data store), [`src/market_data_mcp/server.py`](https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/server.py) (MCP server), [`scripts/restructure_storage.py`](https://github.com/shrirajasekar/mcptest/blob/main/scripts/restructure_storage.py) (Warehouse generator), [`data/GLD.csv`](https://github.com/shrirajasekar/mcptest/blob/main/data/GLD.csv) (Source CSV files)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["MCP interface"]
  node_server["MCP server<br/>[server.py]"]
  node_date_bounds["Date elicitation<br/>[server.py]"]
end

subgraph group_analytics["Query analytics"]
  node_search["OHLCV search<br/>[market_data.py]"]
  node_extrema["OHLCV extrema<br/>[market_data.py]"]
  node_sma["Moving average<br/>[market_data.py]"]
end

subgraph group_storage["File-backed storage"]
  node_store["Market data store<br/>[market_data.py]"]
  node_routing["Manifest routing<br/>[market_data.py]"]
  node_metadata["Partition metadata<br/>[market_data.py]"]
  node_csv_data[("CSV partitions<br/>[market_data.py]")]
  node_caches["Bounded caches<br/>[market_data.py]"]
end

subgraph group_warehouse["Warehouse preparation"]
  node_generator["Warehouse generator"]
end

node_client(("MCP client"))
node_source_csv["Source CSV files<br/>[GLD.csv]"]

node_client -->|"calls tools"| node_server
node_server -->|"requests bounds"| node_date_bounds
node_server -->|"delegates search"| node_search
node_server -->|"delegates extrema"| node_extrema
node_server -->|"delegates average"| node_sma
node_search -->|"queries through"| node_store
node_extrema -->|"queries through"| node_store
node_sma -->|"queries through"| node_store
node_store -->|"resolves symbols"| node_routing
node_store -->|"checks and updates"| node_caches
node_routing -->|"selects partitions"| node_metadata
node_store -->|"prunes partitions"| node_metadata
node_store -->|"streams rows"| node_csv_data
node_generator -->|"reads source"| node_source_csv
node_generator -->|"writes indexes"| node_metadata
node_generator -->|"writes partitions"| node_csv_data

click node_server "https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/server.py"
click node_date_bounds "https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/server.py"
click node_search "https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/market_data.py"
click node_extrema "https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/market_data.py"
click node_sma "https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/market_data.py"
click node_store "https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/market_data.py"
click node_routing "https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/market_data.py"
click node_metadata "https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/market_data.py"
click node_csv_data "https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/market_data.py"
click node_caches "https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/market_data.py"
click node_generator "https://github.com/shrirajasekar/mcptest/blob/main/scripts/restructure_storage.py"
click node_source_csv "https://github.com/shrirajasekar/mcptest/blob/main/data/GLD.csv"

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_server,node_date_bounds,node_client toneBlue
class node_search,node_extrema,node_sma toneAmber
class node_store,node_routing,node_metadata,node_csv_data,node_caches toneMint
class node_generator toneRose
class node_source_csv toneTeal
```

## Components

### MCP interface

- [MCP server](https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/server.py): `src/market_data_mcp/server.py`
- [Date elicitation](https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/server.py): `src/market_data_mcp/server.py`

### Query analytics

- [OHLCV search](https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/market_data.py): `src/market_data_mcp/market_data.py`
- [OHLCV extrema](https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/market_data.py): `src/market_data_mcp/market_data.py`
- [Moving average](https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/market_data.py): `src/market_data_mcp/market_data.py`

### File-backed storage

- [Market data store](https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/market_data.py): `src/market_data_mcp/market_data.py`
- [Manifest routing](https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/market_data.py): `src/market_data_mcp/market_data.py`
- [Partition metadata](https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/market_data.py): `src/market_data_mcp/market_data.py`
- [CSV partitions](https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/market_data.py): `src/market_data_mcp/market_data.py`
- [Bounded caches](https://github.com/shrirajasekar/mcptest/blob/main/src/market_data_mcp/market_data.py): `src/market_data_mcp/market_data.py`

### Warehouse preparation

- [Warehouse generator](https://github.com/shrirajasekar/mcptest/blob/main/scripts/restructure_storage.py): `scripts/restructure_storage.py`

### Other components

- **MCP client**
- [Source CSV files](https://github.com/shrirajasekar/mcptest/blob/main/data/GLD.csv): `data/GLD.csv`

## Connections

- MCP client → MCP server: calls tools (evidence: `README.md`)
- MCP server → Date elicitation: requests bounds (evidence: `src/market_data_mcp/server.py`)
- MCP server → OHLCV search: delegates search (evidence: `src/market_data_mcp/server.py`)
- MCP server → OHLCV extrema: delegates extrema (evidence: `src/market_data_mcp/server.py`)
- MCP server → Moving average: delegates average (evidence: `src/market_data_mcp/server.py`)
- OHLCV search → Market data store: queries through (evidence: `README.md`)
- OHLCV extrema → Market data store: queries through (evidence: `README.md`)
- Moving average → Market data store: queries through (evidence: `README.md`)
- Market data store → Manifest routing: resolves symbols (evidence: `src/market_data_mcp/market_data.py`)
- Market data store → Bounded caches: checks and updates (evidence: `src/market_data_mcp/market_data.py`)
- Manifest routing → Partition metadata: selects partitions (evidence: `README.md`)
- Market data store → Partition metadata: prunes partitions (evidence: `README.md`)
- Market data store → CSV partitions: streams rows (evidence: `README.md`)
- Warehouse generator → Source CSV files: reads source (evidence: `scripts/restructure_storage.py`)
- Warehouse generator → Partition metadata: writes indexes (evidence: `scripts/restructure_storage.py`)
- Warehouse generator → CSV partitions: writes partitions (evidence: `scripts/restructure_storage.py`)
