# senhub-io/mcp-server-prtg architecture

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

- Interactive diagram: https://gitdiagram.com/senhub-io/mcp-server-prtg
- Repository: https://github.com/senhub-io/mcp-server-prtg

## Overview

MCP Server PRTG exposes monitoring data to MCP-compatible clients through authenticated Streamable HTTP, with PostgreSQL-backed tools and an optional PRTG API v2 metrics branch. The main workflow registers tools, accepts client requests, queries the relevant source, and formats results. A separate stdio entry point is also present. The graph follows documented capabilities and shown wiring; unsampled internals and unverified links are omitted.

Main entry points: [`internal/agent/agent.go`](https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/agent/agent.go) (Agent setup), [`internal/handlers/tools.go`](https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/handlers/tools.go) (Database tools), [`internal/server/streamable_http_server.go`](https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/server/streamable_http_server.go) (HTTP transport), [`internal/handlers/tools_metrics.go`](https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/handlers/tools_metrics.go) (Metrics tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and transport"]
  node_service["Service runner<br/>[service.go]"]
  node_agent["Agent setup<br/>[agent.go]"]
  node_http["HTTP transport"]
  node_stdio["Stdio transport<br/>[stdio.go]"]
end

subgraph group_tools["MCP tools and output"]
  node_toolset["Database tools<br/>[tools.go]"]
  node_metrics["Metrics tools<br/>[tools_metrics.go]"]
  node_format["Response formatting<br/>[formatting.go]"]
  node_visual["Visualizations<br/>[visualization.go]"]
end

subgraph group_data["Monitoring data sources"]
  node_dbaccess["Database queries<br/>[queries.go]"]
  node_db["PostgreSQL connection<br/>[db.go]"]
  node_prtgclient["PRTG API client<br/>[client.go]"]
end

subgraph group_support["Configuration and operations"]
  node_config["Configuration manager<br/>[config.go]"]
  node_logger["Logging<br/>[logger.go]"]
end

node_client(("MCP client"))
node_postgres[("PRTG exporter database")]
node_prtgapi["PRTG Core API v2"]

node_client -->|"sends MCP requests"| node_http
node_service -->|"starts agent"| node_agent
node_agent -->|"loads configuration"| node_config
node_agent -->|"initializes database"| node_db
node_agent -->|"registers tools"| node_toolset
node_agent -->|"creates optional client"| node_prtgclient
node_agent -->|"registers metrics tools"| node_metrics
node_agent -->|"starts transport"| node_http
node_stdio -->|"registers tools"| node_toolset
node_stdio -->|"registers metrics tools"| node_metrics
node_toolset -->|"queries data"| node_dbaccess
node_toolset -->|"formats responses"| node_format
node_db -->|"reads monitoring data"| node_postgres
node_metrics -->|"requests metrics"| node_prtgclient
node_prtgclient -->|"calls API v2"| node_prtgapi
node_config -->|"provides connection settings"| node_db
node_http -->|"uses server settings"| node_config
node_agent -->|"initializes logging"| node_logger

click node_service "https://github.com/senhub-io/mcp-server-prtg/blob/main/cmd/server/service.go"
click node_agent "https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/agent/agent.go"
click node_http "https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/server/streamable_http_server.go"
click node_stdio "https://github.com/senhub-io/mcp-server-prtg/blob/main/cmd/server/stdio.go"
click node_toolset "https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/handlers/tools.go"
click node_metrics "https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/handlers/tools_metrics.go"
click node_format "https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/handlers/formatting.go"
click node_visual "https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/handlers/visualization.go"
click node_dbaccess "https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/database/queries.go"
click node_db "https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/database/db.go"
click node_prtgclient "https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/prtg/client.go"
click node_config "https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/services/configuration/config.go"
click node_logger "https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/services/logger/logger.go"

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_service,node_agent,node_http,node_stdio,node_client toneBlue
class node_toolset,node_metrics,node_format,node_visual,node_postgres toneAmber
class node_dbaccess,node_db,node_prtgclient,node_prtgapi toneMint
class node_config,node_logger toneRose
```

## Components

### Runtime and transport

- [Service runner](https://github.com/senhub-io/mcp-server-prtg/blob/main/cmd/server/service.go): `cmd/server/service.go`
- [Agent setup](https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/agent/agent.go): `internal/agent/agent.go`
- [HTTP transport](https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/server/streamable_http_server.go): `internal/server/streamable_http_server.go`
- [Stdio transport](https://github.com/senhub-io/mcp-server-prtg/blob/main/cmd/server/stdio.go): `cmd/server/stdio.go`

### MCP tools and output

- [Database tools](https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/handlers/tools.go): `internal/handlers/tools.go`
- [Metrics tools](https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/handlers/tools_metrics.go): `internal/handlers/tools_metrics.go`
- [Response formatting](https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/handlers/formatting.go): `internal/handlers/formatting.go`
- [Visualizations](https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/handlers/visualization.go): `internal/handlers/visualization.go`

### Monitoring data sources

- [Database queries](https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/database/queries.go): `internal/database/queries.go`
- [PostgreSQL connection](https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/database/db.go): `internal/database/db.go`
- [PRTG API client](https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/prtg/client.go): `internal/prtg/client.go`

### Configuration and operations

- [Configuration manager](https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/services/configuration/config.go): `internal/services/configuration/config.go`
- [Logging](https://github.com/senhub-io/mcp-server-prtg/blob/main/internal/services/logger/logger.go): `internal/services/logger/logger.go`

### Other components

- **MCP client**
- **PRTG exporter database**
- **PRTG Core API v2**

## Connections

- MCP client → HTTP transport: sends MCP requests (evidence: `README.md`)
- Service runner → Agent setup: starts agent (evidence: `cmd/server/service.go`)
- Agent setup → Configuration manager: loads configuration (evidence: `internal/agent/agent.go`)
- Agent setup → PostgreSQL connection: initializes database (evidence: `internal/agent/agent.go`)
- Agent setup → Database tools: registers tools (evidence: `internal/agent/agent.go`)
- Agent setup → PRTG API client: creates optional client (evidence: `internal/agent/agent.go`)
- Agent setup → Metrics tools: registers metrics tools (evidence: `internal/agent/agent.go`)
- Agent setup → HTTP transport: starts transport (evidence: `internal/agent/agent.go`)
- Stdio transport → Database tools: registers tools (evidence: `cmd/server/stdio.go`)
- Stdio transport → Metrics tools: registers metrics tools (evidence: `cmd/server/stdio.go`)
- Database tools → Database queries: queries data (evidence: `internal/handlers/tools.go`)
- Database tools → Response formatting: formats responses (evidence: `internal/handlers/tools.go`)
- PostgreSQL connection → PRTG exporter database: reads monitoring data (evidence: `README.md`)
- Metrics tools → PRTG API client: requests metrics (evidence: `internal/handlers/tools_metrics.go`)
- PRTG API client → PRTG Core API v2: calls API v2 (evidence: `README.md`)
- Configuration manager → PostgreSQL connection: provides connection settings (evidence: `internal/services/configuration/config.go`)
- HTTP transport → Configuration manager: uses server settings (evidence: `internal/server/streamable_http_server.go`)
- Agent setup → Logging: initializes logging (evidence: `internal/agent/agent.go`)
