# mh-13/maveric-mcp-mini architecture

> Architecture diagram of the GitHub repository mh-13/maveric-mcp-mini, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mh-13/maveric-mcp-mini
- Repository: https://github.com/mh-13/maveric-mcp-mini

## Overview

##### Project type and purpose
- This is a real-time network tower monitoring & log-analysis pipeline
– Simulates cell‐tower status changes
– Uses MCP (Model Context Protocol) to expose tools
– Stores time-series logs in MongoDB
– Performs AI-powered summaries with a Groq LLM
– Visualizes via Jupyter notebooks

##### File structure
- Top-level files:
– docker-compose.yml: spins up MongoDB
– notebooks (enhanced_analytics.ipynb, simple_analytics.ipynb): dashboards
– performance_trends.py, SLA report: sample analytics scripts
- src/ subdirectories:
– generator/: log-simulation scripts (generate_logs.py)
– clients/: client utilities for ping, fetch, summarize
– common/: shared db connection (db.py) and Pydantic models (models.py)
– mcp_server/: FastMCP server (server.py) and AI summarizers (groq_llm.py)

##### README insights
- Data flow steps confirm component interactions

##### Main components & relationships
a. Log Generator
– Label: “Log Generator (generate_logs.py)”
– Role: simulates cell towers, emits JSON via stdio
b. MCP Server
– Label: “MCP Server (FastMCP)”
– Contains tools: write_logs, fetch_logs, summarize_once
– Protocol: stdio/JSON in, internal dispatch, PyMongo out
c. MongoDB
– Label: “MongoDB time-series”
– Interaction: writes logs (write_logs tool), reads logs (fetch_logs tool)
– Note: automatic indexing, TTL on collections
d. Groq LLM
– Label: “Groq LLM service”
– Interaction: RPC/HTTP API call from MCP server summarizer
e. Visualization
– Label: “Jupyter Notebooks” (simple & enhanced)
– Reads directly from MongoDB (PyMongo or pandas)

– Generator →(stdio/JSON)→ MCP Server
– MCP Server →(PyMongo write)→ MongoDB
– MCP Server →(PyMongo read)→ MongoDB
– MCP Server →(API call)→ Groq LLM
– Visualization →(PyMongo or pandas)→ MongoDB

##### Architectural patterns
- Tool-oriented microservices via FastMCP
- Clear separation of concerns:
– generator (data source),
– mcp_server (orchestration + API),
– db (storage),
– external AI service,
– notebooks (presentation)
- Use of Pydantic models for schema validation

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Simulation Layer"
        LG["Log Generator\ngenerate_logs.py"]:::sim
    end
    subgraph "Common Modules"
        DB["db.py"]:::common
        MD["models.py"]:::common
    end
    subgraph "Orchestration Layer"
        MCP["MCP Server\nFastMCP\n- write_logs\n- fetch_logs\n- summarize_once"]:::orch
        subgraph "Tools (clients)"
            WLP["write_logs client"]:::orch
            FLP["fetch_logs client"]:::orch
            SOP["summarize_once client"]:::orch
        end
    end
    subgraph "Storage Layer"
        MDB["MongoDB\nTime-Series"]:::storage
    end
    subgraph "AI Service Layer"
        LLM["Groq LLM Service"]:::ai
    end
    subgraph "Visualization Layer"
        NB["Jupyter Notebooks\n(simple & enhanced)"]:::vis
        PT["performance_trends.py"]:::vis
    end

    LG -->|"stdio/JSON"| MCP
    DB --> MCP
    MD --> MCP
    MCP -->|"PyMongo write"| MDB
    MCP -->|"PyMongo read"| MDB
    MCP -->|"HTTP API"| LLM
    MDB -->|"PyMongo/pandas"| NB
    MDB -->|"PyMongo/pandas"| PT

    click LG "https://github.com/mh-13/maveric-mcp-mini/blob/master/src/generator/generate_logs.py"
    click MCP "https://github.com/mh-13/maveric-mcp-mini/blob/master/src/mcp_server/server.py"
    click WLP "https://github.com/mh-13/maveric-mcp-mini/blob/master/src/clients/db_ping.py"
    click FLP "https://github.com/mh-13/maveric-mcp-mini/blob/master/src/clients/mcp_fetch.py"
    click SOP "https://github.com/mh-13/maveric-mcp-mini/blob/master/src/clients/summarize_once.py"
    click DB "https://github.com/mh-13/maveric-mcp-mini/blob/master/src/common/db.py"
    click MD "https://github.com/mh-13/maveric-mcp-mini/blob/master/src/common/models.py"
    click MDB "https://github.com/mh-13/maveric-mcp-mini/blob/master/docker-compose.yml"
    click LLM "https://github.com/mh-13/maveric-mcp-mini/blob/master/src/mcp_server/summarizers/groq_llm.py"
    click NB "https://github.com/mh-13/maveric-mcp-mini/blob/master/simple_analytics.ipynb"
    click PT "https://github.com/mh-13/maveric-mcp-mini/blob/master/performance_trends.py"

    classDef sim fill:#add8e6,stroke:#000,stroke-width:1px
    classDef common fill:#d3d3d3,stroke:#000,stroke-width:1px
    classDef orch fill:#90ee90,stroke:#000,stroke-width:1px
    classDef storage fill:#ffa500,stroke:#000,stroke-width:1px
    classDef ai fill:#dda0dd,stroke:#000,stroke-width:1px
    classDef vis fill:#ffff99,stroke:#000,stroke-width:1px
```
