InfluxDB 3

io.github.influxdatav1.4.2更新于 Oct 8, 2026

Official InfluxDB 3 MCP server: query, write and manage Core, Enterprise and Cloud databases.

概览

AI 生成的概览

让助手通过 MCP 工具查询、写入和管理 InfluxDB 3 Core、Enterprise 及 Cloud 时序数据库。

功能
提供用于 InfluxDB 3 的工具、资源和提示。只读工具包括 query_sql、query_influxql、list_databases、list_tables、describe_table、get_measurements、get_measurement_schema、investigate_database 和 health_check。写入与管理工具包括 write_line_protocol、create_database、update_database、delete_database,以及面向 Core、Enterprise 和 Cloud Dedicated 或 Clustered 的令牌管理工具。资源可暴露配置、状态、数据库列表和自定义上下文文件。
适用场景
适合让助手探索或查询 InfluxDB 3 时序数据、排查 InfluxQL 或 SQL 查询问题,或管理数据库与令牌。只读配置适合只需要发现和查询的分析人员和运维人员。
运行要求
通过 npm(Node.js v20.11+ 和 npm v9+)、npx 或 Docker 以 stdio 在本地运行。需要 InfluxDB 3 实例及环境变量:INFLUX_DB_PRODUCT_TYPE、INFLUX_DB_INSTANCE_URL 或 INFLUX_DB_CLUSTER_ID,以及 INFLUX_DB_TOKEN 或 INFLUX_DB_MANAGEMENT_TOKEN;Cloud Dedicated 还需 INFLUX_DB_ACCOUNT_ID。需要能访问该实例的网络。
安装前请注意
默认配置会暴露全部运维工具,包括写入、删除数据库以及创建、删除和重新生成令牌;可设置 INFLUX_MCP_TOOL_PROFILE=readonly 加以限制。密钥 INFLUX_DB_TOKEN 和 INFLUX_DB_MANAGEMENT_TOKEN 可访问数据库,应谨慎限定权限范围。工具调用遥测默认开启,可用 MCP_LOG_TOOL_CALLS=false 关闭。

安装

在 SourceWeft 中

  1. 打开 控制台中的 InfluxDB 3,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

InfluxDB 3 MCP Server

[CI]

[Trust Score]

Model Context Protocol (MCP) server for InfluxDB 3 integration. Provides tools, resources, and prompts for interacting with InfluxDB 3 Core and Enterprise, plus InfluxDB Cloud Dedicated, InfluxDB Clustered, and InfluxDB Cloud Serverless via MCP clients.


Prerequisites

  • InfluxDB 3 Instance: URL and token (Core/Enterprise/Cloud Serverless) or Cluster ID and tokens (Cloud Dedicated/Clustered)
  • Node.js: v20.11 or newer (for npm/npx usage)
  • npm: v9 or newer (for npm/npx usage)
  • Docker: (for Docker-based setup)

Read-only Agent Workflows

Set INFLUX_MCP_TOOL_PROFILE=readonly when you want an MCP client to explore and query InfluxDB 3 data without exposing write, admin, token-management, or host-level tools. In Enterprise deployments that use preview user auth, the same read-only flow works when the configured bearer credential is a JWT instead of an apiv3_ token.

Analyst explores an unfamiliar database

An analyst can connect an MCP client such as Claude Desktop, Cursor, Codex, or another agent harness and ask a question like:

text
Which sensors had the highest average temperature in the last 24 hours?

With the read-only profile, the agent can:

  1. Call list_databases to see accessible databases.
  2. Call list_tables and describe_table to discover measurements and columns.
  3. Treat uncertain tag and field categories as unknown.
  4. Build a bounded SQL query with db, q, and optional params.
  5. Call query_sql with structured JSON output.
  6. Return the result, row count, truncation status, warnings, and correlation metadata.

The user gets a grounded answer and a reusable query while the agent explores and queries data without access to mutation or administration tools.

Operator investigates an InfluxQL dashboard query

An operator can troubleshoot an existing InfluxQL dashboard panel and ask:

text
Why did this panel stop showing data after the deploy?

With the read-only profile, the agent can:

  1. Keep the user's query in InfluxQL and call query_influxql.
  2. Use SHOW queries and schema discovery to verify the measurement and referenced columns.
  3. Sample recent rows with bounded reads to distinguish missing data from a broken query.
  4. Reject unsafe follow-up attempts, such as SELECT INTO or destructive statements.
  5. Return request_id, query_id, and query_id_source so the operator can correlate the MCP result with system.queries.id when query history is available.
  6. Emit structured logs to stderr for stdio transports so stdout remains reserved for MCP protocol messages.

The user gets a practical diagnosis, such as missing data, renamed schema, a wrong time predicate, or a query failure. The investigation is traceable without logging full query text by default.


Available Tools

Tool NameDescriptionAvailability
load_database_contextLoad optional custom database context and documentationAll versions
get_helpGet help and troubleshooting guidance for InfluxDB operationsAll versions
write_line_protocolWrite data using InfluxDB line protocolAll versions
create_databaseCreate a new database (with cloud-specific config options)All versions
update_databaseUpdate database configuration (retention for all; maxTables/maxColumns for Cloud Dedicated/Clustered)All versions
delete_databaseDelete a database by name (irreversible)All versions
execute_queryRun a SQL query against a database (supports multiple formats)All versions
query_sqlRun bounded read-only SQL with structured response metadataAll versions
query_influxqlRun bounded read-only InfluxQL with structured response metadataAll versions
get_measurementsList all measurements (tables) in a databaseAll versions
get_measurement_schemaGet schema (columns/types) for a measurement/tableAll versions
list_tablesList tables, also called measurements, in a databaseAll versions
describe_tableDescribe table schema with conservative column categoriesAll versions
investigate_databaseRun high-level read-only database discovery and samplingAll versions
create_admin_tokenCreate a named admin token with an optional expirationCore/Enterprise only
list_admin_tokensList all admin tokens (with optional filtering)Core/Enterprise only
create_resource_tokenCreate a resource token for specific DBs and permissionsEnterprise only
list_resource_tokensList all resource tokens (with filtering and ordering)Enterprise only
delete_tokenDelete a token by nameCore/Enterprise only
regenerate_operator_tokenRegenerate the operator token (dangerous/irreversible)Core/Enterprise only
cloud_list_database_tokensList all database tokens for Cloud-Dedicated/Clustered clusterCloud Dedicated/Clustered
cloud_get_database_tokenGet details of a specific database token by IDCloud Dedicated/Clustered
cloud_create_database_tokenCreate a new database token for Cloud-Dedicated/Clustered clusterCloud Dedicated/Clustered
cloud_update_database_tokenUpdate an existing database tokenCloud Dedicated/Clustered
cloud_delete_database_tokenDelete a database token from Cloud-Dedicated/Clustered clusterCloud Dedicated/Clustered
list_databasesList all available databases in the instanceAll versions
health_checkCheck InfluxDB connection and health statusAll versions

Available Resources

Resource NameDescription
influx-configRead-only access to InfluxDB configuration
influx-statusReal-time connection and health status
influx-databasesList of all databases in the instance
context-fileCustom user-provided database context and documentation

Available Prompts

Prompt NameDescription
list-databasesGenerate a prompt to list all available databases
check-healthGenerate a prompt to check InfluxDB health status
load-contextLoad custom database context and documentation

Setup & Integration Guide

1. Environment Variables

For Core/Enterprise InfluxDB:

You must provide:

  • INFLUX_DB_INSTANCE_URL (e.g. http://localhost:8181/)
  • INFLUX_DB_TOKEN
  • INFLUX_DB_PRODUCT_TYPE (core or enterprise)

Example .env:

env
INFLUX_DB_INSTANCE_URL=http://localhost:8181/INFLUX_DB_TOKEN=your_influxdb_token_hereINFLUX_DB_PRODUCT_TYPE=core
For Cloud Serverless InfluxDB:

You must provide:

  • INFLUX_DB_INSTANCE_URL (e.g. https://us-east-1-1.aws.cloud2.influxdata.com)
  • INFLUX_DB_TOKEN
  • INFLUX_DB_PRODUCT_TYPE (cloud-serverless)

Example .env:

env
INFLUX_DB_INSTANCE_URL=https://us-east-1-1.aws.cloud2.influxdata.comINFLUX_DB_TOKEN=your_influxdb_token_hereINFLUX_DB_PRODUCT_TYPE=cloud-serverless
For Cloud Dedicated InfluxDB:

You must provide INFLUX_DB_PRODUCT_TYPE=cloud-dedicated and INFLUX_DB_CLUSTER_ID, plus one of these token combinations:

Option 1: Database Token Only (Query/Write operations only):

env
INFLUX_DB_PRODUCT_TYPE=cloud-dedicatedINFLUX_DB_CLUSTER_ID=your_cluster_id_hereINFLUX_DB_TOKEN=your_database_token_here

Option 2: Management Token Only (Database management only):

env
INFLUX_DB_PRODUCT_TYPE=cloud-dedicatedINFLUX_DB_CLUSTER_ID=your_cluster_id_hereINFLUX_DB_ACCOUNT_ID=your_account_id_hereINFLUX_DB_MANAGEMENT_TOKEN=your_management_token_here

Option 3: Both Tokens (Full functionality):

env
INFLUX_DB_PRODUCT_TYPE=cloud-dedicatedINFLUX_DB_CLUSTER_ID=your_cluster_id_hereINFLUX_DB_ACCOUNT_ID=your_account_id_hereINFLUX_DB_TOKEN=your_database_token_hereINFLUX_DB_MANAGEMENT_TOKEN=your_management_token_here
For Clustered InfluxDB:

You must provide INFLUX_DB_PRODUCT_TYPE=clustered and INFLUX_DB_INSTANCE_URL, plus one of these token combinations:

Option 1: Database Token Only (Query/Write operations only):

env
INFLUX_DB_PRODUCT_TYPE=clusteredINFLUX_DB_INSTANCE_URL=https://your_cluster_host.comINFLUX_DB_TOKEN=your_database_token_here

Option 2: Management Token Only (Database management only):

env
INFLUX_DB_PRODUCT_TYPE=clusteredINFLUX_DB_INSTANCE_URL=https://your_cluster_host.comINFLUX_DB_MANAGEMENT_TOKEN=your_management_token_here

Option 3: Both Tokens (Full functionality):

env
INFLUX_DB_PRODUCT_TYPE=clusteredINFLUX_DB_INSTANCE_URL=https://your_cluster_host.comINFLUX_DB_TOKEN=your_database_token_hereINFLUX_DB_MANAGEMENT_TOKEN=your_management_token_here

See corresponding env.<instancetype>.example for examples and detailed info.

Optional MCP tool profile and telemetry

Use INFLUX_MCP_TOOL_PROFILE=readonly to expose only read-only tools. If unset, the server uses the full operator tool profile.

env
INFLUX_MCP_TOOL_PROFILE=readonly

Tool-call telemetry is enabled by default and writes structured JSON lines to stderr, which keeps stdout reserved for MCP stdio protocol messages. To disable telemetry:

env
MCP_LOG_TOOL_CALLS=false

To write telemetry to a file, configure the file backend:

env
MCP_LOG_BACKEND=fileMCP_LOG_FILE=/logs/influxdb-mcp.jsonl

The telemetry log includes tool name, request ID, query ID, duration, database, row count, truncation state, success state, and error code. It does not log API tokens, request headers, tool arguments, or query text. Sample harness profiles live in harness-profiles/; for approval settings and repeatable E2E prompts, see AGENT_E2E_TESTS.md.


2. Integration with MCP Clients

A. Local (npm install & run)
  1. Install dependencies:
    bash
    npm install
  2. Build the server:
    bash
    npm run build
  3. Configure your MCP client to use the built server. Example (see example-local.mcp.json):
    json
    {  "mcpServers": {    "influxdb": {      "command": "node",      "args": ["/path/to/influx-mcp-standalone/build/index.js"],      "env": {        "INFLUX_DB_INSTANCE_URL": "http://localhost:8181/",        "INFLUX_DB_TOKEN": "<YOUR_INFLUXDB_TOKEN>",        "INFLUX_DB_PRODUCT_TYPE": "core"      }    }  }}
B. Local (npx, no install/build required)
  1. Run directly with npx (after publishing to npm, won't work yet):
    json
    {  "mcpServers": {    "influxdb": {      "command": "npx",      "args": ["-y", "@influxdata/influxdb3-mcp-server"],      "env": {        "INFLUX_DB_INSTANCE_URL": "http://localhost:8181/",        "INFLUX_DB_TOKEN": "<YOUR_INFLUXDB_TOKEN>",        "INFLUX_DB_PRODUCT_TYPE": "core"      }    }  }}
C. Docker

Before running the Docker integration, you must build the Docker image:

bash
# Option 1: Use docker compose (recommended)docker compose build# Option 2: Use npm scriptnpm run docker:build

a) Docker with remote InfluxDB instance (see example-docker.mcp.json):

json
{  "mcpServers": {    "influxdb": {      "command": "docker",      "args": [        "run",        "--rm",        "-i",        "-e",        "INFLUX_DB_INSTANCE_URL",        "-e",        "INFLUX_DB_TOKEN",        "-e",        "INFLUX_DB_PRODUCT_TYPE",        "mcp/influxdb"      ],      "env": {        "INFLUX_DB_INSTANCE_URL": "http://remote-influxdb-host:8181/",        "INFLUX_DB_TOKEN": "<YOUR_INFLUXDB_TOKEN>",        "INFLUX_DB_PRODUCT_TYPE": "core"      }    }  }}

b) Docker with InfluxDB running in Docker on the same machine (see example-docker.mcp.json):

Use host.docker.internal as the InfluxDB URL so the MCP server container can reach the InfluxDB container:

json
{  "mcpServers": {    "influxdb": {      "command": "docker",      "args": [        "run",        "--rm",        "-i",        "--add-host=host.docker.internal:host-gateway",        "-e",        "INFLUX_DB_INSTANCE_URL",        "-e",        "INFLUX_DB_TOKEN",        "-e",        "INFLUX_DB_PRODUCT_TYPE",        "influxdb-mcp-server"      ],      "env": {        "INFLUX_DB_INSTANCE_URL": "http://host.docker.internal:8181/",        "INFLUX_DB_TOKEN": "<YOUR_INFLUXDB_TOKEN>",        "INFLUX_DB_PRODUCT_TYPE": "enterprise"      }    }  }}

Example Usage

  • Use your MCP client to call tools, resources, or prompts as described above.
  • Custom Context: Edit the provided context/database-context.md file or remove it and create your own context file with "context" in the name (.json, .txt, .md) to provide database documentation. Use the load_database_context tool or load-context prompt to access it.
  • See the example-*.mcp.json files for ready-to-use configuration templates:
    • example-local.mcp.json - Local development setup
    • example-npx.mcp.json - NPX-based setup
    • example-docker.mcp.json - Docker-based setup
    • example-cloud-dedicated.mcp.json - Cloud Dedicated with all variables
    • example-clustered.mcp.json - Clustered with all variables
    • example-cloud-serverless.mcp.json - Cloud Serverless configuration
  • See the env.example, env.cloud-dedicated.example, env.clustered.example, and env.cloud-serverless.example files for environment variable templates.
  • See AGENT_E2E_TESTS.md for MCP harness tips, read-only profile runs, and telemetry correlation checks.

Run Cloud Serverless integration tests

The Cloud Serverless test command accepts Claire's INFLUXDB3_CLOUD_* variables and maps them to the MCP server's runtime variables. The command sets INFLUX_TEST_ENABLED=true and INFLUX_DB_PRODUCT_TYPE=cloud-serverless.

For local tests with 1Password, store only op:// references in ~/.config/claire/cloud-serverless.env:

env
INFLUXDB3_CLOUD_URL=op://VAULT/ITEM/hostnameINFLUXDB3_CLOUD_TOKEN=op://VAULT/ITEM/tokenINFLUXDB3_CLOUD_BUCKET=op://VAULT/ITEM/bucketINFLUXDB3_CLOUD_ORG=op://VAULT/ITEM/org

Run the live tests through 1Password so the token exists only in the test process environment:

bash
op run --env-file ~/.config/claire/cloud-serverless.env -- \  npm run test:integration:cloud-serverless

You can instead copy env.cloud-serverless.example to the ignored .env.cloud-serverless.local file and set the MCP runtime variables there. Then run npm run test:integration:cloud-serverless directly.

To use another plaintext credentials file, set INFLUX_TEST_ENV_FILE:

bash
INFLUX_TEST_ENV_FILE=/path/to/serverless.env npm run test:integration:cloud-serverless

GitHub Actions runs the same command with the existing URL and token secrets from the cloud-serverless environment. The workflow selects the mcp-ci-tests bucket explicitly.

Database Retention Policy Examples

Core/Enterprise - Set 90-day Retention
typescript
// Set 90-day retention policy on Enterprise instanceawait mcp.update_database({  name: "my_database",  retentionPeriod: 7776000000000000, // 90 days in nanoseconds});
Cloud Dedicated - Update Multiple Settings
typescript
// Update retention, maxTables, and maxColumnsPerTableawait mcp.update_database({  name: "my_database",  retentionPeriod: 7776000000000000, // 90 days  maxTables: 1000,  maxColumnsPerTable: 250,});
Common Retention Periods
DurationNanoseconds
7 days604,800,000,000,000
30 days2,592,000,000,000,000
90 days7,776,000,000,000,000
180 days15,552,000,000,000,000
1 year31,536,000,000,000,000

Support & Troubleshooting

  • Use the get_help tool for built-in help and troubleshooting.
  • For connection issues, check your environment variables and InfluxDB instance status.
  • For advanced configuration, see the comments in the example .env and MCP config files.

Write errors

write_line_protocol surfaces InfluxDB's own error text, not a generic message. If InfluxDB rejects a write — a duplicate tag key, an unauthenticated token, a payload over the size limit — the tool error includes the specific reason, for example:

Bad request: invalid line protocol - multiple instances of 'region' tag found

A 503 reaching this server is phrased as retryable (Service temporarily unavailable, retry the write: ...) — safe to retry the write. Any other status is not.

InfluxDB 3.11 compatibility

Verified against InfluxDB 3.11.5 Core and Enterprise, including a multi-node Enterprise cluster). Core and Enterprise write through POST /api/v3/write_lp, which 3.11's write-availability changes for the legacy /api/v2/write endpoint do not affect; only clustered calls /api/v2/write. Query and schema-discovery tools behave the same whether the target database is on Parquet (Core, or Enterprise before an upgrade) or PachaTree (Enterprise 3.11+ by default, or after --upgrade-pacha-tree) — new system.pt_* tables are excluded from get_measurements/get_measurement_schema results by the same table_schema = 'iox' filter that already excludes other system tables.

Core and Enterprise create named admin tokens through POST /api/v3/configure/token/named_admin. Named admin tokens accept an optional expiration in seconds. Only Enterprise supports resource tokens, so the MCP server doesn't advertise resource-token tools for Core connections.


Publishing to the MCP Registry

Stable GitHub releases publish the npm package first, then register io.github.influxdata/influxdb3-mcp-server in the official MCP Registry. The registry stores metadata; clients install the server from npm. GitHub OIDC authenticates the release job using id-token: write, so no additional registry secret is needed. Releases marked as prereleases or with - in their tag skip registry publishing.

Before tagging a release, update package.json, src/config.ts, the latest CHANGELOG.md entry, and both version fields in server.json together. Keep package.json's mcpName equal to server.json's name. Check locally:

sh
node scripts/check-versions.jsbash scripts/install-mcp-publisher.sh /tmp/mcp-publisher/tmp/mcp-publisher validate

The installer pins and verifies the Linux amd64 publisher used in CI. The validate command contacts the registry and checks metadata without publishing. CI runs these checks, and the npm release job also checks the versions and tag. The first registry release must use a freshly published npm version containing mcpName; an existing npm version cannot be updated to add it.

After publishing, verify the release at each destination:

  • npm: The exact package version must exist and include the expected mcpName.
  • Docker Hub: The image tagged with the release version must be available.
  • MCP Registry: The exact version endpoint must return the expected server name and version. The registry release job automates this check.

From the release checkout, verify npm and the registry manually:

sh
version="$(node -p "require('./package.json').version")"npm view "@influxdata/influxdb3-mcp-server@$version" version mcpNamedocker manifest inspect "influxdata/influxdb3-mcp-server:$version"curl --fail --silent --show-error \  "https://registry.modelcontextprotocol.io/v0.1/servers/io.github.influxdata%2Finfluxdb3-mcp-server/versions/$version" \  | jq --exit-status --arg version "$version" \    '.server.name == "io.github.influxdata/influxdb3-mcp-server" and .server.version == $version'

With valid database environment variables configured, also smoke-test the exact published npm version using MCP Inspector:

sh
npx @modelcontextprotocol/inspector --cli \  npx -y "@influxdata/influxdb3-mcp-server@$version" --method tools/list

Metadata validation checks the registry description; the smoke test checks that the published package initializes and advertises tools. Keep the release-note verification checklist unchecked until the corresponding checks pass.

If registry publishing fails after npm succeeds, rerun only the failed registry job; rerunning the successful npm job would try to publish an existing version.

License

MIT

来源:README.md,提交 ba932f7

工具

0
工具元数据尚未被收录。

版本历史

1
  1. v1.4.2最新Oct 8, 2026