# edgedelta/edgedelta-mcp-server architecture

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

- Interactive diagram: https://gitdiagram.com/edgedelta/edgedelta-mcp-server
- Repository: https://github.com/edgedelta/edgedelta-mcp-server

## Overview

##### Project type and purpose
- This is a Go-based, containerized backend service (“monolith” in the sense that all business logic lives in one process) plus a companion CLI tool.
- It implements a Model Context Protocol (MCP) server that developers and tools (e.g. Cursor) can call, and it calls out to Edge Delta’s APIs.

##### File structure
- Top-level directories:
- cmd/mcp-server – the main server binary (incoming MCP requests).
- cmd/mcp-curl – a lightweight CLI for exercising the MCP server.
- pkg/core – all business logic: protocol handling, client wrapper for Edge Delta API, event/log management, anomaly detection, patterns, etc.
- .github/workflows & goreleaser config – CI/CD pipelines for linting, testing, Docker image build/publish.
- Dockerfile – containerizes the server.
- Scripts/license checks and contributing/docs are support artifacts.

##### README for additional insights
- The service is delivered as a Docker image, driven by environment variables (ED_API_TOKEN, ED_ORG_ID).
- Customers embed it into their “Cursor” config or run it standalone via “docker run”.
- It’s intended for data extraction and AI-powered tooling against Edge Delta.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User-Facing Components"
        CLI["CLI (cmd/mcp-curl)"]:::userFacing
        Cursor["Cursor Tool"]:::userFacing
        CLI --> CLIMain["main.go"]:::userFacing
    end

    subgraph "MCP Server (cmd/mcp-server)"
        Server["Server"]:::server
        Server --> ServerMain["main.go"]:::server
        subgraph "Core (pkg/core)"
            CoreMain["core.go"]:::core
            Protocol["Protocol Handler (server.go)"]:::core
            APIClient["Edge Delta API Client (client.go)"]:::core
            EventMgr["Event Manager (events.go)"]:::core
            LogProc["Log Processor (logs.go)"]:::core
            Anomaly["Anomaly Detector (anomaly.go)"]:::core
            Patterns["Pattern Matcher (pattterns.go)"]:::core
        end
    end

    subgraph "External Services"
        EdgeAPI["Edge Delta REST API"]:::external
        Registry["Docker Registry"]:::external
    end

    subgraph "CI/CD Pipeline"
        Repo["Code Repository"]:::cicd
        Actions["GitHub Actions"]:::cicd
        DockerBuild["Docker Build (Buildx)"]:::cicd
        GoReleaser["GoReleaser"]:::cicd
    end

    subgraph "Build Artifacts"
        DockerfileNode["Dockerfile"]:::cicd
        ScriptLic["script/licenses"]:::cicd
        ScriptLicCheck["script/licenses-check"]:::cicd
    end

    CLI -->|"MCP request"| Server
    Cursor -->|"MCP request"| Server
    Server -->|"handles request"| Protocol
    Protocol -->|"invokes modules"| APIClient
    APIClient -->|"HTTP call (token, org)"| EdgeAPI
    EdgeAPI -->|"response"| EventMgr
    EdgeAPI -->|"response"| LogProc
    EventMgr -->|"processed events"| Protocol
    LogProc -->|"processed logs"| Protocol
    Protocol -->|"MCP response"| Server
    Server -->|"MCP response"| CLI
    Server -->|"MCP response"| Cursor

    Repo --> Actions
    Actions -->|"runs tests/lint"| Actions
    Actions -->|"build images"| DockerBuild
    DockerBuild -->|"push images"| Registry
    Actions -->|"release artifacts"| GoReleaser
    GoReleaser -->|"publish images"| Registry

    classDef userFacing fill:#D0E8FF,stroke:#0066CC
    classDef server fill:#CCFFCC,stroke:#008800
    classDef core fill:#CCFFCC,stroke:#008800
    classDef external fill:#FFDDCC,stroke:#CC6600
    classDef cicd fill:#EEEEEE,stroke:#666666

    click CLI "https://github.com/edgedelta/edgedelta-mcp-server/tree/main/cmd/mcp-curl"
    click CLIMain "https://github.com/edgedelta/edgedelta-mcp-server/blob/main/cmd/mcp-curl/main.go"
    click Server "https://github.com/edgedelta/edgedelta-mcp-server/tree/main/cmd/mcp-server"
    click ServerMain "https://github.com/edgedelta/edgedelta-mcp-server/blob/main/cmd/mcp-server/main.go"
    click CoreMain "https://github.com/edgedelta/edgedelta-mcp-server/blob/main/pkg/core/core.go"
    click Protocol "https://github.com/edgedelta/edgedelta-mcp-server/blob/main/pkg/core/server.go"
    click APIClient "https://github.com/edgedelta/edgedelta-mcp-server/blob/main/pkg/core/client.go"
    click EventMgr "https://github.com/edgedelta/edgedelta-mcp-server/blob/main/pkg/core/events.go"
    click LogProc "https://github.com/edgedelta/edgedelta-mcp-server/blob/main/pkg/core/logs.go"
    click Anomaly "https://github.com/edgedelta/edgedelta-mcp-server/blob/main/pkg/core/anomaly.go"
    click Patterns "https://github.com/edgedelta/edgedelta-mcp-server/blob/main/pkg/core/pattterns.go"
    click DockerfileNode "https://github.com/edgedelta/edgedelta-mcp-server/tree/main/Dockerfile"
    click Repo "https://github.com/edgedelta/edgedelta-mcp-server/blob/main/."
    click Actions "https://github.com/edgedelta/edgedelta-mcp-server/blob/main/.github/workflows/go.yml"
    click Actions "https://github.com/edgedelta/edgedelta-mcp-server/blob/main/.github/workflows/lint.yaml"
    click Actions "https://github.com/edgedelta/edgedelta-mcp-server/blob/main/.github/workflows/docker-publish.yml"
    click Actions "https://github.com/edgedelta/edgedelta-mcp-server/blob/main/.github/workflows/goreleaser.yml"
    click GoReleaser "https://github.com/edgedelta/edgedelta-mcp-server/blob/main/.goreleaser.yaml"
    click ScriptLic "https://github.com/edgedelta/edgedelta-mcp-server/tree/main/script/licenses"
    click ScriptLicCheck "https://github.com/edgedelta/edgedelta-mcp-server/tree/main/script/licenses-check"
```
