{
  "markdown": "# Prometheus MCP Server (Go)\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![npm version](https://img.shields.io/npm/v/mcp-prometheus)](https://www.npmjs.com/package/mcp-prometheus)\n[![Go](https://img.shields.io/badge/Go-1.25-00ADD8?logo=go)](https://go.dev/)\n[![GitHub release](https://img.shields.io/github/v/release/jeanlopezxyz/mcp-prometheus?sort=semver)](https://github.com/jeanlopezxyz/mcp-prometheus/releases/latest)\n\nA [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server for Prometheus integration. Native Go binary with built-in Kubernetes connectivity via client-go.\n\n## Installation\n\n### npx\n\n```bash\nnpx -y mcp-prometheus@latest\n```\n\n### MCP Client Configuration\n\nAdd to your MCP client configuration (VS Code, Cursor, Windsurf, etc.):\n\n```json\n{\n  \"mcpServers\": {\n    \"prometheus\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mcp-prometheus@latest\"],\n      \"env\": {\n        \"PROMETHEUS_URL\": \"http://localhost:9090\"\n      }\n    }\n  }\n}\n```\n\n### VS Code\n\n```shell\ncode --add-mcp '{\"name\":\"prometheus\",\"command\":\"npx\",\"args\":[\"-y\",\"mcp-prometheus@latest\"],\"env\":{\"PROMETHEUS_URL\":\"http://localhost:9090\"}}'\n```\n\n### Kubernetes Auto-Connect\n\nAutomatically connects to Prometheus running in OpenShift/Kubernetes via the K8S API service proxy. Uses native kubeconfig/in-cluster config via client-go. No `kubectl` or port-forwarding required.\n\nDefault: `openshift-monitoring/prometheus-operated:9090`\n\n```json\n{\n  \"mcpServers\": {\n    \"prometheus\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mcp-prometheus@latest\"]\n    }\n  }\n}\n```\n\n### Binary\n\nDownload from [GitHub Releases](https://github.com/jeanlopezxyz/mcp-prometheus/releases) or build from source:\n\n```bash\nmake build\n./mcp-prometheus\n```\n\n---\n\n## Configuration\n\n### Environment Variables\n\n| Variable | Description |\n|----------|-------------|\n| `PROMETHEUS_URL` | Direct Prometheus API URL (overrides K8S auto-connect) |\n\n### CLI Flags\n\n| Flag | Description | Default |\n|------|-------------|---------|\n| `--url` | Direct Prometheus URL | - |\n| `--namespace` | Kubernetes namespace | `openshift-monitoring` |\n| `--service` | Kubernetes service name | `prometheus-operated` |\n| `--service-port` | Kubernetes service port | `9090` |\n| `--service-scheme` | Service scheme (http/https) | `https` |\n| `--kubeconfig` | Path to kubeconfig file | auto-detect |\n\n**Precedence:** `--url` / `PROMETHEUS_URL` > K8S auto-connect\n\n**Connection strategy:**\n1. Direct URL (if `--url` or `PROMETHEUS_URL` is set)\n2. K8S API proxy (auto-detect kubeconfig or in-cluster config)\n\n---\n\n## Tools (11)\n\n### Basic Queries\n\n| Tool | Description |\n|------|-------------|\n| `query` | Execute a PromQL instant query |\n| `queryRange` | Execute a PromQL range query over time |\n| `getTargets` | Get scrape targets status |\n| `getRules` | Get alerting and recording rules |\n| `getPrometheusStatus` | Get server version and runtime info |\n\n### Cluster Diagnostics\n\n| Tool | Description |\n|------|-------------|\n| `getClusterHealthOverview` | Comprehensive cluster health overview |\n| `diagnoseNode` | Diagnose a specific node's health |\n| `diagnoseNamespace` | Diagnose a namespace's health |\n\n### Resource Analysis\n\n| Tool | Description |\n|------|-------------|\n| `getTopResourceConsumers` | Top CPU/memory/network consumers |\n| `investigatePod` | Deep investigation of a specific pod |\n| `compareTimeRanges` | Compare metrics between two time periods |\n\n---\n\n## Example Prompts\n\n```\n\"What's the current CPU usage across all nodes?\"\n\"Show me the cluster health overview\"\n\"Which pods are using the most memory?\"\n\"Diagnose node worker-1\"\n\"Are all scrape targets healthy?\"\n\"Compare CPU usage now vs 24 hours ago\"\n\"Investigate pod my-app in namespace production\"\n\"What alerting rules are defined?\"\n```\n\n---\n\n## Development\n\n### Build\n\n```bash\nmake build              # Build for current platform\nmake build-all-platforms # Cross-compile for all platforms\n```\n\n### Container\n\n```bash\npodman build -f Containerfile -t mcp-prometheus .\n```\n\n---\n\n## Kubernetes / OpenShift Deployment\n\n### Container Image\n\nThe container image is available on GitHub Container Registry:\n\n```\nghcr.io/jeanlopezxyz/mcp-prometheus:latest\n```\n\n### Helm Chart\n\nDeploy using the included Helm chart:\n\n```bash\n# Add the chart repository (or use local chart)\nhelm upgrade --install mcp-prometheus ./charts/mcp-prometheus \\\n  --namespace mcp-servers \\\n  --create-namespace \\\n  --set openshift=true\n```\n\n#### Helm Values\n\n| Parameter | Description | Default |\n|-----------|-------------|---------|\n| `image.registry` | Container registry | `ghcr.io` |\n| `image.repository` | Image repository | `jeanlopezxyz/mcp-prometheus` |\n| `image.version` | Image tag | `latest` |\n| `openshift` | Enable OpenShift Routes | `false` |\n| `service.port` | Service port | `8080` |\n| `prometheus.namespace` | Prometheus namespace | `openshift-monitoring` |\n| `prometheus.service` | Prometheus service name | `prometheus-operated` |\n| `rbac.useClusterReader` | Use cluster-reader role | `true` |\n\n#### Example with custom Prometheus\n\n```bash\nhelm upgrade --install mcp-prometheus ./charts/mcp-prometheus \\\n  --namespace mcp-servers \\\n  --set openshift=true \\\n  --set prometheus.url=http://prometheus.monitoring:9090\n```\n\n---\n\n## License\n\n[MIT](LICENSE)\n",
  "bytes": 5326,
  "sha": "5abd5f6b2b7e41f2829983539daeb949c9dfd0d0dec9a6ac80043684eca85ab6",
  "repo_slug": "jeanlopezxyz/mcp-prometheus",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_jeanlopezxyz_mcp_prometheus_93f4ec0f/readme"
}