Skip to content

Installing mcp-victoriametrics

This guide describes how to install and configure mcp-victoriametrics, the VictoriaMetrics Model Context Protocol (MCP) server.

The MCP server exposes VictoriaMetrics read-only APIs and embedded VictoriaMetrics documentation to MCP-compatible clients, such as Claude Desktop, Claude Code, Cursor, and other tools that support MCP.

This guide uses upstream distributions for local installation with Docker, a binary, or source code. In-cluster Helm installation uses the Qubership Monitoring Operator chart and its victoriametrics.mcp values. Upstream Helm chart values use a different schema and cannot be copied into the monitoring chart.

Table of Contents

Prerequisites

Before installation, prepare the following:

  • An operator-managed VictoriaMetrics backend: normally VMSingle with victoriametrics.vmSingle.install: true, or VMCluster with victoriametrics.vmCluster.install: true.
  • An MCP-compatible client.

Choose VictoriaMetrics Endpoint

mcp-victoriametrics must be able to reach the root VictoriaMetrics API.

For MCP installed inside the same Kubernetes cluster, use the internal VMSingle service, usually http://vmsingle-k8s.monitoring.svc:8428 for the monitoring namespace.

Upstream mcp-victoriametrics documentation describes VM_INSTANCE_ENTRYPOINT as the root URL of vmsingle or vmselect. In this operator setup, the external VMAuth URL can be used for local MCP only because VMAuth acts as a transparent proxy to the same VMSingle API.

This is expected to work with the operator-generated VMAuth configuration: VMAuth proxies VictoriaMetrics API paths such as /api/v1/query.*, /api/v1/label.*, /api/v1/series.*, /api/v1/metadata.*, and /api/v1/status.* to http://vmsingle-k8s.monitoring.svc:8428. It also contains a root route to VMSingle, so the external VMAuth URL behaves as the VictoriaMetrics API entrypoint for MCP.

You can verify the generated VMAuth config with:

kubectl get secret vmauth-config-k8s -n monitoring -o jsonpath='{.data.config\.yaml\.gz}' | base64 -d | gunzip

Example with Ingress:

victoriametrics:
  vmAuth:
    install: true
    ingress:
      install: true
      host: vmauth.example.com

Example with HTTPRoute:

victoriametrics:
  vmAuth:
    install: true
    httpRoute:
      install: true
      hostnames:
        - vmauth.example.com

For these examples, local MCP configuration should use:

export VM_INSTANCE_ENTRYPOINT="https://vmauth.example.com"
export VM_INSTANCE_TYPE="single"

If VMAuth requires Basic Auth, pass the credentials either in the URL:

export VM_INSTANCE_ENTRYPOINT="https://<username>:<password>@vmauth.example.com"
export VM_INSTANCE_TYPE="single"

or with an explicit Authorization header:

export VM_INSTANCE_ENTRYPOINT="https://vmauth.example.com"
export VM_INSTANCE_TYPE="single"
export VM_INSTANCE_HEADERS="Authorization=Basic <base64-username-password>"

<base64-username-password> is the base64-encoded <username>:<password> string. For example, for admin:admin:

printf 'admin:admin' | base64

The result is:

YWRtaW46YWRtaW4=

So the header value is:

export VM_INSTANCE_HEADERS="Authorization=Basic YWRtaW46YWRtaW4="

Self-Signed Certificates

If the external API Gateway, HTTPRoute, or Ingress for VMAuth or VMSingle uses a self-signed certificate, local mcp-victoriametrics will not connect to it unless the certificate is trusted by the environment where the MCP server runs.

The upstream MCP server configuration and current source code do not provide an insecure-skip-verify option. For local installation, add the issuing CA certificate to the operating system trust store, or run the MCP server with a CA bundle that contains this certificate.

For a local binary, one option is to use SSL_CERT_FILE env variable, e.g.:

export SSL_CERT_FILE="/path/to/ca-bundle-with-api-gateway-ca.crt"
export VM_INSTANCE_ENTRYPOINT="https://vmauth.example.com"
export VM_INSTANCE_TYPE="single"
./mcp-victoriametrics

For Docker, mount the CA bundle and pass SSL_CERT_FILE to the container, for example:

docker run -d --name mcp-victoriametrics \
  -v /path/to/ca-bundle-with-api-gateway-ca.crt:/etc/ssl/certs/api-gateway-ca.crt:ro,z \
  -e SSL_CERT_FILE=/etc/ssl/certs/api-gateway-ca.crt \
  -e VM_INSTANCE_ENTRYPOINT=https://vmauth.example.com \
  -e VM_INSTANCE_TYPE=single \
  -e MCP_SERVER_MODE=http \
  -e MCP_LISTEN_ADDR=:8080 \
  -p 127.0.0.1:8080:8080 \
  ghcr.io/victoriametrics/mcp-victoriametrics

The z suffix is required on SELinux-enabled systems when the certificate is mounted from the host filesystem. It relabels the file so the container process can read it.

If the certificate is signed by a company or cluster CA, use that CA certificate, not the leaf server certificate.

For an operator-managed VMSingle or VMSelect endpoint, the monitoring chart handles this connection automatically. When victoriametrics.tlsEnabled=true and victoriametrics.mcp.vm.entrypoint is empty, it generates an HTTPS URL, projects only ca.crt from the selected backend TLS Secret, and sets SSL_CERT_FILE to the mounted file:

victoriametrics:
  tlsEnabled: true
  clusterIssuerName: monitoring-ca
  vmSingle:
    install: true
  mcp:
    install: true
    vm:
      type: single

The CA key defaults to ca.crt. Set victoriametrics.mcp.vm.tls.caSecret.key if the Secret uses another key, or set victoriametrics.mcp.vm.tls.useBackendCA: false when the backend certificate is already trusted through the container system trust store.

For an explicit endpoint that uses a private CA, identify its Secret directly:

victoriametrics:
  mcp:
    vm:
      entrypoint: https://vmauth-monitoring.example.com
      tls:
        caSecret:
          name: vmauth-ca
          key: ca.crt

The chart does not mount tls.crt or tls.key from this Secret.

The same rule applies to the opposite connection direction: if an MCP client connects to the MCP server through an HTTPRoute or Ingress with a self-signed certificate, the CA must be trusted by the machine where the MCP client runs. Do not put this CA only into the mcp-victoriametrics container: that affects only outbound requests from MCP to VMAuth or VMSingle, not inbound requests from Claude Desktop, Codex, Cursor, or another client to the MCP server URL.

For Linux workstations, add the API Gateway or Ingress CA to the system trust store. For RHEL, Fedora, or CentOS:

sudo cp api-gateway-ca.crt /etc/pki/ca-trust/source/anchors/
sudo update-ca-trust extract

For Debian or Ubuntu:

sudo cp api-gateway-ca.crt /usr/local/share/ca-certificates/api-gateway-ca.crt
sudo update-ca-certificates

Most MCP clients do not provide a portable per-server insecure-skip-verify setting. Prefer trusting the CA or using a certificate issued by a CA already trusted by the client machine. For temporary local debugging, expose the MCP server on http://localhost:8080/mcp with Docker or kubectl port-forward instead of using a self-signed HTTPS route.

Installation

Helm with Monitoring Chart

Use the Qubership Monitoring Operator Helm chart when the MCP server should run in the same Kubernetes cluster as the operator-managed VictoriaMetrics backend. The MCP server is installed as part of the VictoriaMetrics subchart and is not a standalone Helm release.

The values in this section belong to the Qubership Monitoring Operator chart. They are not compatible with the values of the upstream vm/victoria-metrics-mcp chart.

Add and adjust the following example parameters in the monitoring chart values file:

victoriametrics:
  vmOperator:
    install: true
  vmSingle:
    install: true
  mcp:
    install: true
    vm:
      type: single
    httpRoute:
      install: true
      hostnames:
        - mcp-vm.example.com
      parentRefs:
        - name: gateway
          namespace: istio-system
          sectionName: default

This snippet is an example, not a set of universal values. Adjust it for your cluster:

  • For VMSingle, use victoriametrics.mcp.vm.type: single. The MCP entrypoint defaults to the operator-managed VMSingle Service, using HTTPS when victoriametrics.tlsEnabled=true and HTTP otherwise.
  • For VMCluster, enable victoriametrics.vmCluster.install, disable victoriametrics.vmSingle.install, and use victoriametrics.mcp.vm.type: cluster. The entrypoint then defaults to the operator-managed VMSelect Service with the same scheme selection.
  • Set victoriametrics.mcp.vm.entrypoint only to override the generated in-cluster URL, for example when MCP must connect through VMAuth.
  • For an automatically generated TLS endpoint, the chart trusts ca.crt from the selected backend TLS Secret. Configure victoriametrics.mcp.vm.tls when the CA comes from another Secret or is already in the system trust store.
  • Upstream mcp-victoriametrics v1.20.2 does not support token or headers files. vm.bearerTokenSecret and vm.headersSecret hide values from the Deployment but expose them to the MCP process through environment variables; inline vm.bearerToken and vm.headers also expose values in the Deployment. When file-based secret handling is mandatory, leave static credentials empty and configure passthroughHeaders so MCP clients provide request-time authentication.
  • victoriametrics.mcp.httpRoute.hostnames must contain the desired MCP server host, and parentRefs must point to the Gateway used by the cluster.
  • Use victoriametrics.mcp.ingress instead of victoriametrics.mcp.httpRoute when the cluster exposes applications through Ingress.

See the complete VictoriaMetrics MCP Helm parameters reference before configuring authentication, forwarded headers, metrics, or advanced pod settings.

Apply the values through the normal monitoring chart installation or upgrade process. For a source checkout and a release named monitoring-operator:

helm upgrade --install monitoring-operator \
  charts/qubership-monitoring-operator \
  -f values.yaml \
  -n monitoring \
  --create-namespace

Check the deployed resources:

kubectl get deployment,service,httproute -n monitoring | grep mcp-victoriametrics

The streamable HTTP endpoint for the example is:

https://mcp-vm.example.com/mcp

When the monitoring chart is obtained from a Helm repository instead of a source checkout, replace charts/qubership-monitoring-operator with the chart reference used by your environment.

The MCP server requires victoriametrics.vmOperator.install: true and a backend matching victoriametrics.mcp.vm.type. Setting only victoriametrics.mcp.install: true does not create a standalone MCP deployment.

The upstream vm/victoria-metrics-mcp chart remains an option for a standalone deployment, but it has a different values schema and is outside the scope of this monitoring chart example.

Binaries

Use a downloaded binary when you want local stdio mode without Docker, or when the host should run a standalone HTTP MCP server.

Download the binary for your operating system and architecture from the upstream releases page:

https://github.com/VictoriaMetrics/mcp-victoriametrics/releases

Then make it executable and place it somewhere stable, for example:

chmod +x ./mcp-victoriametrics
sudo mv ./mcp-victoriametrics /usr/local/bin/mcp-victoriametrics

For stdio usage, do not start the binary manually. Configure the MCP client with command: /usr/local/bin/mcp-victoriametrics and the required environment variables. The client will start the process itself.

The listener binds 127.0.0.1, so only the workstation reaches the MCP endpoint. Bind a routable address only when the deployment puts authentication in front of MCP.

For standalone local HTTP usage, start the binary explicitly:

export VM_INSTANCE_ENTRYPOINT="https://vmauth.example.com"
export VM_INSTANCE_TYPE="single"
export MCP_SERVER_MODE="http"
export MCP_LISTEN_ADDR="127.0.0.1:8080"

mcp-victoriametrics

After startup, the streamable HTTP endpoint is available at:

http://localhost:8080/mcp

Docker

Use Docker when the MCP server should run locally or as a standalone HTTP/SSE service. For local usage, VM_INSTANCE_ENTRYPOINT should point to the external VMAuth URL that proxies to VMSingle or if VMAuth is disabled then VMSingle ingress or http route host.

These examples publish the port on 127.0.0.1, so only the workstation reaches the MCP endpoint. The listener inside the container stays on :8080 because Docker forwards the published port to it. Publish a routable address only when the deployment puts authentication in front of MCP.

docker run -d --name mcp-victoriametrics \
  -e VM_INSTANCE_ENTRYPOINT=https://vmauth.example.com \
  -e VM_INSTANCE_TYPE=single \
  -e MCP_SERVER_MODE=http \
  -e MCP_LISTEN_ADDR=:8080 \
  -p 127.0.0.1:8080:8080 \
  ghcr.io/victoriametrics/mcp-victoriametrics

If VMAuth requires Basic Auth, pass credentials with VM_INSTANCE_HEADERS:

docker run -d --name mcp-victoriametrics \
  -e VM_INSTANCE_ENTRYPOINT=https://vmauth.example.com \
  -e VM_INSTANCE_TYPE=single \
  -e MCP_SERVER_MODE=http \
  -e MCP_LISTEN_ADDR=:8080 \
  -e VM_INSTANCE_HEADERS="Authorization=Basic <base64-username-password>" \
  -p 127.0.0.1:8080:8080 \
  ghcr.io/victoriametrics/mcp-victoriametrics

Replace <base64-username-password> with base64-encoded <username>:<password>, for example YWRtaW46YWRtaW4= for admin:admin.

After startup, the streamable HTTP endpoint is available at:

http://localhost:8080/mcp

The server also exposes:

  • / - setup page and tool inspection in HTTP mode
  • /metrics - MCP server metrics in Prometheus format
  • /health/liveness - liveness probe
  • /health/readiness - readiness probe

Source

Use source installation when you need to build the MCP server yourself. The source build requires a Go toolchain compatible with the current mcp-victoriametrics repository.

Clone the repository:

git clone https://github.com/VictoriaMetrics/mcp-victoriametrics.git
cd mcp-victoriametrics

Build the binary:

make build

For stdio usage, do not start the binary manually. Configure the MCP client with the path to the built mcp-victoriametrics binary and the required environment variables. The client will start the process itself when it needs the MCP server.

If you want to run the built binary as a standalone local HTTP server instead, use the same approach as in the Docker section, but pass the environment variables to the binary directly and set MCP_SERVER_MODE=http.

Configuration Parameters

mcp-victoriametrics is configured with environment variables. These are upstream server runtime parameters used directly by local, Docker, and source installations. The monitoring Helm chart maps its victoriametrics.mcp values to these variables; use the VictoriaMetrics MCP Helm parameters reference when configuring an in-cluster deployment.

Variable Description Required
VM_INSTANCE_ENTRYPOINT Root URL of the VictoriaMetrics API. For in-cluster MCP use the direct VMSingle URL. For local MCP, the external VMAuth or VMSingle HTTPRoute or Ingress URL can be used. If VMCluster is installed, then VMSelect HTTPRoute or Ingress URL can be used. Yes
VM_INSTANCE_TYPE VictoriaMetrics type. Use single in most cases and cluster if VMCluster is deployed. Yes
VM_INSTANCE_BEARER_TOKEN Bearer token sent to the configured VictoriaMetrics entrypoint, for example vmauth or an API Gateway. No
VM_INSTANCE_HEADERS Custom headers sent to the configured entrypoint, comma-separated as Header=Value. No
MCP_PASSTHROUGH_HEADERS Headers forwarded from incoming MCP requests to the configured entrypoint in sse or http mode. No
MCP_SERVER_MODE MCP transport mode: stdio, sse, or http. Defaults to stdio. No
MCP_LISTEN_ADDR Listen address for sse or http mode. Defaults to localhost:8080. No
MCP_DISABLED_TOOLS Comma-separated list of tools to disable. No
MCP_LOG_LEVEL Log level: debug, info, warn, or error. No

Use stdio mode when the MCP client is configured with a command that points to the mcp-victoriametrics binary. In this mode the client starts the binary as a child process and exchanges MCP messages through standard input and standard output. There is no HTTP port and no /mcp URL.

Use http mode when mcp-victoriametrics is already running separately, for example as a Docker container, a manually started binary, or a Helm deployment in Kubernetes. In this mode the MCP client connects to an endpoint such as http://localhost:8080/mcp or https://mcp-vm.example.com/mcp.

Use sse mode only if the MCP client explicitly expects an SSE endpoint.

Configure MCP Clients

Claude Desktop

For local binary usage in stdio mode, add the server command to claude_desktop_config.json. In this case Claude Desktop starts mcp-victoriametrics itself:

{
  "mcpServers": {
    "victoriametrics": {
      "command": "/path/to/mcp-victoriametrics",
      "env": {
        "VM_INSTANCE_ENTRYPOINT": "https://vmauth.example.com",
        "VM_INSTANCE_TYPE": "single",
        "VM_INSTANCE_HEADERS": "Authorization=Basic <base64-username-password>"
      }
    }
  }
}

Claude Desktop starts only stdio servers from claude_desktop_config.json. The file has no setting that connects Claude Desktop directly to an HTTP MCP server. To use a separately running HTTP MCP server, choose one of these options:

  • Run the mcp-remote bridge as the stdio command. Claude Desktop starts the bridge on your workstation, and the bridge forwards MCP requests to the HTTP endpoint. Any URL that your workstation can reach works, including loopback, port-forwarded, VPN-only, and private-network URLs.
  • Add the endpoint as a custom connector in Claude. Claude connects to custom connectors from Anthropic's cloud, not from your workstation, so the endpoint must be reachable from the public internet. Loopback, port-forwarded, and private-network URLs do not work. Custom connectors can authenticate with OAuth or with fixed request headers. See Get started with custom connectors using remote MCP.

For Helm installation, point mcp-remote at the external HTTPRoute or Ingress URL:

{
  "mcpServers": {
    "victoriametrics": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp-vm.example.com/mcp"]
    }
  }
}

mcp-remote runs on Node.js, which uses its own CA bundle instead of the system trust store by default. If a private CA signs the gateway certificate, set NODE_EXTRA_CA_CERTS in env to the path of the CA file.

If the gateway requires a bearer token, pass it with the mcp-remote --header option and keep the token in env:

{
  "mcpServers": {
    "victoriametrics": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://mcp-vm.example.com/mcp",
        "--header",
        "Authorization: Bearer ${AUTH_TOKEN}"
      ],
      "env": {
        "AUTH_TOKEN": "<gateway-token>"
      }
    }
  }
}

For Docker installation running on the same workstation, use the local HTTP MCP endpoint. For a plain http:// URL, add the --allow-http option:

{
  "mcpServers": {
    "victoriametrics": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "http://localhost:8080/mcp", "--allow-http"]
    }
  }
}

For temporary local debugging of the Helm installation without HTTPRoute or Ingress, you can also use kubectl port-forward svc/mcp-victoriametrics -n monitoring 8080:8080 and use http://localhost:8080/mcp as the mcp-remote URL in the Docker example above.

Claude Code

For local source usage:

claude mcp add \
  --env VM_INSTANCE_ENTRYPOINT=https://vmauth.example.com \
  --env VM_INSTANCE_TYPE=single \
  --env VM_INSTANCE_HEADERS="Authorization=Basic <base64-username-password>" \
  --transport stdio \
  victoriametrics \
  -- /path/to/mcp-victoriametrics

Cursor

Add the server to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "victoriametrics": {
      "command": "/path/to/mcp-victoriametrics",
      "env": {
        "VM_INSTANCE_ENTRYPOINT": "https://vmauth.example.com",
        "VM_INSTANCE_TYPE": "single",
        "VM_INSTANCE_HEADERS": "Authorization=Basic <base64-username-password>"
      }
    }
  }
}

Codex

For local binary usage in stdio mode, add the server to ~/.codex/config.toml. In this mode Codex starts mcp-victoriametrics itself:

[mcp_servers.victoriametrics]
command = "/path/to/mcp-victoriametrics"

[mcp_servers.victoriametrics.env]
VM_INSTANCE_ENTRYPOINT = "https://vmauth.example.com"
VM_INSTANCE_TYPE = "single"
VM_INSTANCE_HEADERS = "Authorization=Basic <base64-username-password>"

Available Tools

The exact set of tools depends on the mcp-victoriametrics version, VictoriaMetrics instance type, and MCP_DISABLED_TOOLS configuration.

Commonly available tools are:

Tool Description Enabled by default
query Execute instant PromQL or MetricsQL queries. Yes
query_range Execute range PromQL or MetricsQL queries over a time period. Yes
metrics List available metric names. Yes
metrics_metadata Read stored metric metadata, such as type, help, and unit. Yes
labels List available label names. Yes
label_values List values for a specific label. Yes
series List available time series. Yes
rules View alerting and recording rules. Yes
alerts View current firing and pending alerts. Yes
metric_statistics Inspect metric usage in queries. Yes
active_queries View currently executing queries. Yes
top_queries View frequent or slow queries. Yes
tsdb_status Inspect TSDB cardinality statistics. Yes
tenants List tenants in a multi-tenant cluster setup. Mostly useful for VMCluster. Yes
documentation Search embedded VictoriaMetrics documentation without online access. Yes
prettify_query Format PromQL or MetricsQL queries. Yes
explain_query Parse and explain PromQL or MetricsQL queries. Yes
export Export raw time series data to JSON or CSV. No
flags View non-default VictoriaMetrics startup flags. No
metric_relabel_debug Debug Prometheus-compatible relabeling rules. No
downsampling_filters_debug Debug downsampling configuration. No
retention_filters_debug Debug retention filter configuration. No
test_rules Unit-test alerting and recording rules with vmalert. No

By default upstream disables several potentially heavier or more specialized tools, including export, flags, metric_relabel_debug, downsampling_filters_debug, retention_filters_debug, and test_rules. Override MCP_DISABLED_TOOLS only when the MCP clients really need these capabilities.

Useful tools for smoke testing are:

Tool Purpose
metrics Verify that MCP can authenticate to VictoriaMetrics and list metric names.
labels Verify access to label metadata.
label_values Verify access to values for a known label, for example job or namespace.
query Run a simple instant query, for example up.
tsdb_status Check cardinality statistics for troubleshooting.

VictoriaMetrics Cloud tools are intentionally not covered here because this operator setup uses a Kubernetes-hosted VictoriaMetrics stack, usually VMSingle.

Verify Installation

For HTTP or SSE mode, check the readiness endpoint:

curl http://localhost:8080/health/readiness

For stdio mode, there is no readiness URL because the MCP server is attached to the client's process through stdin/stdout. Restart the MCP client and check that the victoriametrics server appears in the client's MCP server list.

Run a simple prompt in the MCP client, for example:

List available VictoriaMetrics metrics and show the labels for the up metric.

Uninstall

For Docker:

docker rm -f mcp-victoriametrics

For an MCP server installed with the monitoring chart, set victoriametrics.mcp.install: false and upgrade the monitoring release. Do not uninstall the monitoring release only to remove MCP.

For binary or source installation, remove the local mcp-victoriametrics binary if it is no longer needed. For source installation, remove the cloned source directory as well.

References