
A Prometheus Model Context Protocol Server.
概览
A Go-based MCP server that exposes Prometheus query capabilities via the Model Context Protocol. All flags can be set via environment variables: PROM_ADDR, MCP_ADDR, TRANSPORT, AUTH_TOKEN. Add the following config to your MCP client: Install the binary via go install github.com/yshngg/prometheus-mcp-server@latest or pull the Docker image with docker pull ghcr.io/yshngg/prometheus-mcp-server:latest. If you don't have the binary installed, use Docker: Then configure your client to use http://localhost:8080/mcp. For authenticated access, set AUTH_TOKEN: Your client must then include Authorization: Bearer my-token in requests to /mcp.
README
以下为原文 README 节选,完整内容请查看原文。
Prometheus MCP Server
A Go-based MCP server that exposes Prometheus query capabilities via the Model Context Protocol.
Installation
go install github.com/yshngg/prometheus-mcp-server@latest
Or pull the Docker image:
docker pull ghcr.io/yshngg/prometheus-mcp-server:latest
Usage
prometheus-mcp-server --prom-addr="http://localhost:9090"
Flags
| Flag | Default | Description |
|---|---|---|
-prom-addr |
http://localhost:9090 |
Prometheus server URL |
-mcp-addr |
localhost:8080 |
MCP server listen address |
-transport |
stdio |
stdio or http |
-auth-token |
`` | Bearer token for MCP endpoint authentication (optional) |
-version |
Print version |
Environment Variables
All flags can be set via environment variables: PROM_ADDR, MCP_ADDR, TRANSPORT, AUTH_TOKEN.
MCP Client Configuration
Add the following config to your MCP client:
{
"mcpServers": {
"prometheus": {
"command": "prometheus-mcp-server",
"args": ["--prom-addr", "http://localhost:9090"]
}
}
}
[!NOTE] Install the binary via
go install github.com/yshngg/prometheus-mcp-server@latestor pull the Docker image withdocker pull ghcr.io/yshngg/prometheus-mcp-server:latest.
If you don’t have the binary installed, use Docker:
{
"mcpServers": {
"prometheus": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"ghcr.io/yshngg/prometheus-mcp-server:latest",
"--prom-addr",
"http://host.docker.internal:9090"
]
}
}
}
Client-specific configuration
Add to opencode.json (guide):
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"prometheus": {
"type": "local",
"command": [
安装
docker run --rm -i ghcr.io/yshngg/prometheus-mcp-server:latest --prom-addr http://host.docker.internal:9090配置
{
"mcpServers": {
"prometheus": {
"command": "prometheus-mcp-server",
"args": ["--prom-addr", "http://localhost:9090"]
}
}
}