# ashbansal03/analytics-mcp architecture

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

- Interactive diagram: https://gitdiagram.com/ashbansal03/analytics-mcp
- Repository: https://github.com/ashbansal03/analytics-mcp

## Overview

1. This repository is a small deployment package for an “Analytics-MCP” service, not a large multi-module application. The core runtime appears to be a single Python entrypoint, `server.py`, supported by environment configuration and a systemd service file for VPS deployment.

2. The main application boundary is the Python process in `server.py`. Based on the README, its purpose is to provide an Analytics MCP layer over a PostgreSQL database. In an architecture diagram, this is the central service node that sits between client/tooling on one side and PostgreSQL on the other.

3. The data backend is PostgreSQL. The README explicitly says the repo is for “Analytics MCP for PostgreSQL DB on VPS,” so the service is likely responsible for reading analytics data from that database and exposing it through the MCP interface. PostgreSQL should be shown as an external datastore, separate from the application runtime.

4. Configuration is externalized into an environment file. The checked-in `a.env` is intended to be renamed to `.env` on Linux web servers, which means the service likely reads runtime settings from environment variables rather than hardcoded values. This is an important boundary for secrets such as DB credentials, hostnames, or ports.

5. `analytics-mcp.service` indicates the app is managed by systemd on Linux. That means the deployment architecture includes the host OS as an operational layer, with systemd responsible for starting, stopping, and restarting the Python service. This file is part of the runtime lifecycle, not the business logic.

6. `uk_cafe_sales.csv` is a bundled data file, likely a sample dataset or local analytics input used during development/testing. It should be treated as a data artifact rather than a core service dependency unless `server.py` explicitly loads it. In a diagram, place it as optional local test data or example input.

7. The repository is therefore organized around three practical layers: service code (`server.py`), configuration (`a.env` / `.env`), and deployment control (`analytics-mcp.service`). The external data boundary is PostgreSQL, and the local CSV is an auxiliary data asset.

8. The most important flow is: systemd launches the Python process using environment configuration; the Python service connects to PostgreSQL; the service then acts as the analytics/MCP interface for upstream consumers. If the CSV is used, it would be a secondary input path into the same Python service.

9. There are no signs here of a frontend, message queue, ORM layer, or multi-service backend. So the architecture should be drawn as a compact server-side integration service with one main executable, one external database, and one deployment unit.

10. For a diagram, the key nodes are: Linux VPS / systemd, `server.py` service, `.env` configuration, PostgreSQL database, and optional CSV data file. The main trust and dependency boundary is between the Python service and PostgreSQL, with systemd handling process supervision.

Main entry points: [`server.py`](https://github.com/ashbansal03/analytics-mcp/blob/main/server.py) (Analytics MCP), [`analytics-mcp.service`](https://github.com/ashbansal03/analytics-mcp/blob/main/analytics-mcp.service) (systemd), [`a.env`](https://github.com/ashbansal03/analytics-mcp/blob/main/a.env) (Env config), [`uk_cafe_sales.csv`](https://github.com/ashbansal03/analytics-mcp/blob/main/uk_cafe_sales.csv) (Sales CSV)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g_deploy["Deployment"]
  node_n_systemd["systemd<br/>service manager"]
end

subgraph group_g_runtime["Runtime"]
  node_n_server["Analytics MCP<br/>python service<br/>[server.py]"]
  node_n_env["Env config<br/>runtime config<br/>[a.env]"]
end

subgraph group_g_data["Data"]
  node_n_pg[("PostgreSQL<br/>database")]
  node_n_csv["Sales CSV<br/>data file<br/>[uk_cafe_sales.csv]"]
end

node_n_clients(("MCP clients<br/>upstream consumers"))

node_n_systemd -->|"starts"| node_n_server
node_n_env -.->|"configures"| node_n_server
node_n_clients -->|"queries"| node_n_server
node_n_server -->|"reads"| node_n_pg
node_n_csv -.->|"inputs"| node_n_server

click node_n_systemd "https://github.com/ashbansal03/analytics-mcp/blob/main/analytics-mcp.service"
click node_n_server "https://github.com/ashbansal03/analytics-mcp/blob/main/server.py"
click node_n_env "https://github.com/ashbansal03/analytics-mcp/blob/main/a.env"
click node_n_csv "https://github.com/ashbansal03/analytics-mcp/blob/main/uk_cafe_sales.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_n_systemd toneBlue
class node_n_server,node_n_env toneAmber
class node_n_pg,node_n_csv toneMint
class node_n_clients toneNeutral
```

## Components

### Deployment

Process supervision and service lifecycle on the VPS.

- [systemd](https://github.com/ashbansal03/analytics-mcp/blob/main/analytics-mcp.service): service manager · Supervises the Python service on Linux VPS startup and restart. · `analytics-mcp.service`

### Runtime

Core Python analytics MCP service and its configuration boundary.

- [Analytics MCP](https://github.com/ashbansal03/analytics-mcp/blob/main/server.py): python service · Main application entrypoint that exposes the analytics MCP layer. · `server.py`
- [Env config](https://github.com/ashbansal03/analytics-mcp/blob/main/a.env): runtime config · Environment variables for service settings and secrets. · `a.env`

### Data

Primary and auxiliary data sources used by the service.

- **PostgreSQL**: database · External analytics datastore queried by the service.
- [Sales CSV](https://github.com/ashbansal03/analytics-mcp/blob/main/uk_cafe_sales.csv): data file · Bundled sample or local analytics input dataset. · `uk_cafe_sales.csv`

### Other components

- **MCP clients**: upstream consumers · Tools or agents that connect to the analytics MCP service.

## Connections

- systemd → Analytics MCP: starts · systemd launches and supervises the Python process.
- Env config → Analytics MCP: configures · Environment variables provide runtime settings and credentials.
- MCP clients → Analytics MCP: queries · Upstream consumers interact with the MCP interface.
- Analytics MCP → PostgreSQL: reads · Primary data access path for analytics queries.
- Sales CSV → Analytics MCP: inputs · Optional local dataset used for development or sample analytics.
