victoriametrics-mcp

victoriametrics-mcp

MCP server for querying VictoriaMetrics (PromQL/MetricsQL) and VictoriaLogs (LogsQL), also compatible with Prometheus, returning compact text summaries for LLM agents.

Category
访问服务器

README

victoriametrics-mcp

An MCP server that lets an LLM agent query VictoriaMetrics (PromQL/MetricsQL) and VictoriaLogs (LogsQL) over stdio.

Because it speaks the Prometheus HTTP API, it also works against Prometheus itself for the vm_* metric tools.

Built with Bun and TypeScript; compiles to a single self-contained binary with no runtime dependency.

Why another exporter-ish tool

Raw Prometheus JSON is a poor fit for a model's context window: a single range query easily returns tens of thousands of tokens of repeated label sets and float noise. Every tool here returns compact text instead:

  • series are rendered as metric{label="value"}, sorted and deduplicated;
  • values are rounded to 4 significant digits;
  • timestamps are second-precision UTC (2026-08-13T10:30:00Z);
  • range results are summarised (min/max/avg/last) and evenly subsampled;
  • results are bounded by explicit limit / max_series / max_points args, and truncation is always announced so the model knows to raise the limit;
  • log lines drop ANSI colour codes and Docker/Vector bookkeeping fields.

Install

bun install          # never npm
bun run build        # -> dist/victoriametrics-mcp

Or with just: just build.

Configuration

Everything is read from the environment, so one binary serves any deployment.

Variable Default Meaning
VM_URL http://127.0.0.1:8428 VictoriaMetrics (or Prometheus) base URL
VL_URL http://127.0.0.1:9428 VictoriaLogs base URL
VM_TIMEOUT_MS 30000 Per-request timeout, both backends
VM_BEARER_TOKEN / VL_BEARER_TOKEN — Sent as Authorization: Bearer …
VM_USER + VM_PASSWORD — HTTP basic auth (same for VL_*)

If a bearer token is set it takes precedence over basic auth.

Registering with a client

Claude Code, user scope:

claude mcp add --scope user victoriametrics -- /path/to/dist/victoriametrics-mcp

Any other MCP client, via mcpServers config:

{
  "mcpServers": {
    "victoriametrics": {
      "command": "/path/to/dist/victoriametrics-mcp",
      "env": { "VM_URL": "http://127.0.0.1:8428" }
    }
  }
}

Tools

Metrics — VictoriaMetrics

Tool Purpose Key arguments
vm_query Instant PromQL query — the current value per series query, time, limit
vm_query_range Range query — how a metric evolved query, start, end, step, max_series, max_points
vm_series Discover which series exist match[], start, end, limit
vm_label_values List values of a label (__name__ lists metric names) label, match[], start, end, limit
vm_targets Scrape target health — job, instance, health, last error only_unhealthy

Logs — VictoriaLogs

Tool Purpose Key arguments
vl_query Run a LogsQL query query, limit, max_message_chars

Time arguments

Every time / start / end argument accepts:

  • now (or empty),
  • a relative offset: -12h, -30m, -7d, -2w,
  • an epoch in seconds: 1786609796,
  • an RFC3339 timestamp: 2026-08-13T10:30:00Z.

step accepts a duration (30s, 1m, 1h) or bare seconds. When omitted, vm_query_range picks a step yielding roughly 60 points over the range.

Example output

vm_query with query=up:

10 series at 2026-08-13T08:33:49Z
up{cluster="mini-box",instance="traefik:8082",job="traefik"} = 1
up{cluster="mini-box",instance="localhost:8428",job="victoriametrics"} = 1
…

vm_query_range with query=sum(rate(node_cpu_seconds_total{mode="idle"}[5m])) by (instance):

range -2h → now, step 120s

2 series

{instance="mini-box"}
  min=11.01 max=11.64 avg=11.56 last=11.34 (5 of 61 points shown)
  2026-08-13T06:34:00Z  11.64
  …
  2026-08-13T08:34:00Z  11.34

vm_targets:

10 targets, 1 not up
DOWN    postgres-exporter / arcle_postgres-exporter:9187
UP      traefik / traefik:8082
…

Development

just dev          # run from source over stdio
just typecheck    # tsc --noEmit
just test         # unit tests (bun test)
just smoke        # build, then drive the binary with real MCP JSON-RPC

just smoke performs a genuine end-to-end check: it starts the compiled binary, sends initialize, notifications/initialized, tools/list and two tools/call requests on stdin, and prints the JSON-RPC replies. It needs a reachable VM_URL.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选