# awakened-sudo/datagovmy-mcp architecture

> Architecture diagram of the GitHub repository awakened-sudo/datagovmy-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/awakened-sudo/datagovmy-mcp
- Repository: https://github.com/awakened-sudo/datagovmy-mcp

## Overview

##### Project type and purpose
- This is a backend‐only MCP (Model Context Protocol) server written in Go. It exposes DataGovMy datasets as “tools” over either HTTP (default localhost:8080) or stdio (for AI agents like Cline/Cursor).

##### File structure
- **main.go**: application entrypoint—initializes server, loads configuration, and starts listening
- **handlers.go**: registers HTTP/stdio endpoints (MCP transport layer) and wires incoming requests to tool logic
- **tool.go**: implements each DataGovMy tool’s schema, input validation, data‐fetching logic, and MCP response formatting
- **go.mod/go.sum**: dependency declarations
- **README.md**: project description, usage patterns, and extension guidelines

##### README for additional insights
- Describes a single monolithic Go service with no separate frontend
- Clients: Cline (AI agent CLI) or Cursor (AI code editor)
- External dependency: DataGovMy open‐data API as the ultimate data source
- Transport modes: HTTP and stdio (subprocess)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "AI Agent Clients"
        Cline["Cline (AI CLI)"]:::client
        Cursor["Cursor (AI Editor)"]:::client
    end

    subgraph "MCP Server"
        subgraph "Bootstrap & Configuration"
            Main["main.go"]:::config
        end
        subgraph "Transport Layer"
            Handlers["handlers.go"]:::transport
        end
        subgraph "Business Logic & Data Access"
            Tools["tool.go"]:::logic
        end
        subgraph "Dependencies"
            GoMod["go.mod"]:::config
            GoSum["go.sum"]:::config
        end
        subgraph "Documentation"
            Readme["README.md"]:::doc
        end
    end

    External["DataGovMy API"]:::external

    Cline -->|"HTTP:8080 or stdio"| Handlers
    Cursor -->|"HTTP:8080 or stdio"| Handlers

    Main -->|initializes| Handlers
    Handlers -->|routes request| Tools
    Tools -->|fetch data| External
    External -->|returns JSON/CSV| Tools
    Tools -->|formats MCP response| Handlers
    Handlers -->|responds| Cline
    Handlers -->|responds| Cursor

    classDef client    fill:#FFDDC1,stroke:#333,stroke-width:1px
    classDef transport fill:#C8E6C9,stroke:#333,stroke-width:1px
    classDef logic     fill:#BBDEFB,stroke:#333,stroke-width:1px
    classDef config    fill:#E1BEE7,stroke:#333,stroke-width:1px
    classDef doc       fill:#FFF9C4,stroke:#333,stroke-width:1px
    classDef external  fill:#FFCCBC,stroke:#333,stroke-width:1px

    click Main "https://github.com/awakened-sudo/datagovmy-mcp/blob/main/main.go"
    click Handlers "https://github.com/awakened-sudo/datagovmy-mcp/blob/main/handlers.go"
    click Tools "https://github.com/awakened-sudo/datagovmy-mcp/blob/main/tool.go"
    click GoMod "https://github.com/awakened-sudo/datagovmy-mcp/blob/main/go.mod"
    click GoSum "https://github.com/awakened-sudo/datagovmy-mcp/blob/main/go.sum"
    click Readme "https://github.com/awakened-sudo/datagovmy-mcp/blob/main/README.md"
```
