InfluxDB v2 MCP Server is a Model Context Protocol (MCP) server that provides access to InfluxDB v2 instances through the InfluxDB OSS API v2. This project was mainly built using Claude Code.
Main Capabilities
The server provides the following three types of functionality:
Resources
- Organization List:
influxdb://orgsDisplays all organizations in the InfluxDB instance. - Bucket List:
influxdb://bucketsDisplays all buckets and their metadata. - Measurements in a Bucket:
influxdb://bucket/{bucketName}/measurementsLists all measurements in the specified bucket. - Query Data:
influxdb://query/{orgName}/{fluxQuery}Executes a Flux query and returns the results as a resource.
Tools
- write-data: Writes time series data in line protocol format. Parameters: org, bucket, data, precision (optional).
- query-data: Executes a Flux query. Parameters: org, query.
- create-bucket: Creates a new bucket. Parameters: name, orgID, retentionPeriodSeconds (optional).
- create-org: Creates a new organization. Parameters: name, description (optional).
Prompt Templates
- flux-query-examples: Common Flux query examples.
- line-protocol-guide: InfluxDB line protocol format guide.
Usage
Environment Variables
The server requires the following environment variables:
INFLUXDB_TOKEN(required): Authentication token for the InfluxDB API.INFLUXDB_URL(optional): URL of the InfluxDB instance, defaults tohttp://localhost:8086。INFLUXDB_ORG(optional): Default organization name for some operations.
Installation
- Automatically install InfluxDB MCP Server for Claude Desktop via Smithery.
- Option 1: Run using npx (recommended).
- Option 2: Global installation.
- Option 3: Build from source.
Run Modes
influxdb-mcp-server uses stdio transport by default. You can explicitly use --stdio request, or via --http option (optional port number, defaults to 3000) to start the server with Streamable HTTP transport. This mode uses an internal Express.js server.
If it is already globally installed or using npx, you can run it.
Integration with Claude for Desktop
Add the server to claude_desktop_config.json:
- Use npx (recommended).
- If installed locally.
Code Structure
The server code is organized into a modular structure:
src/index.js: Main server entry point.config/: Configuration file,env.jshandles environment variables.utils/: Utility functions,influxClient.jsis the InfluxDB API client,loggerConfig.jsis the console log configuration.handlers/: Resource and tool handlers, includingorganizationsHandler.js、bucketsHandler.js、measurementsHandler.js、queryHandler.js、writeDataTool.js、queryDataTool.js、createBucketTool.js、createOrgTool.js。prompts/: Prompt templates,fluxQueryExamplesPrompt.jsandlineProtocolGuidePrompt.js.
This structure improves maintainability, ease of testing, and clearly separates concerns.
Testing
The repository contains comprehensive integration tests:
- Starts a Docker container with InfluxDB.
- Populates sample data.
- Tests all MCP server features.
The command to run the tests is not provided yet.