Prometheus MCP Server Golang Single Binary API
Deploy a Golang MCP server single-binary for Prometheus with full API support and STDIO, SSE, and HTTP transports for complex deployments.
npx -y @tjhop/prometheus-mcp-serverOverview
This project provides a single-binary Golang server that implements the Model Context Protocol (MCP) with first-class support for multiple transports (STDIO, Server-Sent Events, and HTTP). It is designed to be embedded into Prometheus-centric environments or used as a lightweight broker between Prometheus components and external tools that need a persistent, stream-oriented API surface.
Because it ships as a single statically linked executable, the server is easy to deploy in containerized, edge, or bare-metal environments. The multi-transport approach allows the same MCP API to be consumed over direct process pipes (STDIO), streaming HTTP (SSE), or traditional request/response HTTP — making it suitable for complex topologies such as sidecars, proxies, central aggregators, and CI-driven testing harnesses.
Features
- Single static Go binary for simple deployment and distribution
- Full MCP API support (model/context streaming and request handling)
- Multiple transport options:
- STDIO for local piping and sidecar use
- Server-Sent Events (SSE) for long-lived streaming over HTTP
- Standard HTTP endpoints for request/response interactions
- TLS support for HTTP/SSE transports
- Structured logging and runtime flags for easy integration into scripts and service managers
- Docker-friendly and suitable for use in Kubernetes or systemd-managed hosts
Installation / Configuration
Build from source (Go 1.18+ recommended):
# Clone and build
Install via go install:
# binary will be in $GOPATH/bin or $GOBIN
Common runtime flags (examples):
# Basic HTTP SSE server on port 8080
# HTTP API server with TLS
# STDIO mode (useful for sidecars or piping)
|
Example Dockerfile:
FROM golang:1.20-alpine AS build
WORKDIR /src
COPY . .
RUN go build -o /out/prometheus-mcp-server ./cmd/prometheus-mcp-server
FROM alpine:3.18
COPY --from=build /out/prometheus-mcp-server /usr/local/bin/prometheus-mcp-server
EXPOSE 8080 8443
ENTRYPOINT ["/usr/local/bin/prometheus-mcp-server"]
Example systemd service unit:
[Unit]
Prometheus MCP Server
network.target
[Service]
/usr/local/bin/prometheus-mcp-server --sse --addr :8080 --log-level info
on-failure
prometheus
[Install]
multi-user.target
Available Tools / Resources
- GitHub repository: https://github.com/tjhop/prometheus-mcp-server
- Use the binary flags
--helpto enumerate supported transports, TLS options, and logging:- Example:
./prometheus-mcp-server --help
- Example:
- Logs are typically emitted to stdout/stderr for easy collection with container logging drivers or systemd journal
API surface (typical endpoints and transport mappings — concrete routes may vary; consult --help output):
| Transport | Typical Endpoint | Notes |
|---|---|---|
| STDIO | stdin / stdout | Useful for chaining processes or running as a sidecar |
| SSE | /sse or /stream | Long-lived HTTP streaming clients should use curl -N or EventSource |
| HTTP | /api/* | Request/response interactions and health checks |
Use Cases
- Sidecar integration with Prometheus exporters: Run the MCP server as a sidecar and connect via STDIO to supply model updates directly to a local exporter process.
- Central stream broker: Deploy the server as a central MCP broker using SSE to distribute model/context updates to many monitoring consumers across a cluster.
- CI / E2E testing: Use the STDIO mode to script synthetic model streams for automated tests, without needing a full networked stack.
- Hybrid deployments: Front the MCP server with an HTTP/SSE transport for remote clients while exposing STDIO for local administrative tooling.
- Secure edge deployments: Use the single binary with TLS on the SSE or HTTP transport to securely relay Prometheus-related model data from untrusted networks to trusted collectors.
Quick Examples
Subscribe to SSE stream with curl:
# Open a live SSE stream (replace path/port based on flags)
Post a model/context update over HTTP:
Pipe input via STDIO:
|
Notes for Developers
- Check the repository README and CLI
--helpfor exact flag names and route paths, as they can change between releases. - The single-binary design favors immutable deployments (containers or artifacts in CI). For dynamic configuration, wrap the binary with a small supervising process or systemd unit that adjusts flags and TLS artifacts.
- For production use, enable TLS for public-facing SSE/HTTP endpoints and integrate logging with your existing observability stack.
For code, issues, and updates, see the project on GitHub: https://github.com/tjhop/prometheus-mcp-server/