by idoru
InfluxDB MCP Server is a Model Context Protocol (MCP) server that enables interaction with InfluxDB instances using the InfluxDB OSS API v2, facilitating querying, writing data, and managing database objects through a standardized interface.
InfluxDB MCP Server is a Model Context Protocol (MCP) server that provides access to an InfluxDB instance using the InfluxDB OSS API v2. It allows users to interact with InfluxDB for querying, writing data, and managing database objects through a standardized MCP interface.
InfluxDB MCP Server can be installed and run in several ways:
npx -y @smithery/cli install @idoru/influxdb-mcp-server --client claude
for automatic installation with Claude Desktop.INFLUXDB_TOKEN=your_token npx influxdb-mcp-server
.npm install -g influxdb-mcp-server
and then run INFLUXDB_TOKEN=your_token influxdb-mcp-server
.npm install
, and run with INFLUXDB_TOKEN=your_token npm start
.For integration with Claude for Desktop, configure mcpServers
in your claude_desktop_config.json
with the appropriate command and environment variables (e.g., INFLUXDB_TOKEN
, INFLUXDB_URL
, INFLUXDB_ORG
).
influxdb://orgs
: Displays all organizations.influxdb://buckets
: Shows all buckets with metadata.influxdb://bucket/{bucketName}/measurements
: Lists measurements within a specified bucket.influxdb://query/{orgName}/{fluxQuery}
: Executes a Flux query and returns results.write-data
: Writes time-series data in line protocol format.query-data
: Executes Flux queries.create-bucket
: Creates a new bucket.create-org
: Creates a new organization.flux-query-examples
: Provides common Flux query examples.line-protocol-guide
: Offers a guide to InfluxDB line protocol format.Q: What environment variables are required for InfluxDB MCP Server?
A: The INFLUXDB_TOKEN
is required for authentication. INFLUXDB_URL
(defaults to http://localhost:8086
) and INFLUXDB_ORG
are optional.
Q: How can I test InfluxDB MCP Server?
A: The repository includes comprehensive integration tests. You can run them using npm test
. These tests spin up a Docker container with InfluxDB, populate it with sample data, and test all MCP server functionality.
A Model Context Protocol (MCP) server that exposes access to an InfluxDB instance using the InfluxDB OSS API v2. Mostly built with Claude Code.
This MCP server provides:
The server exposes the following resources:
Organizations List: influxdb://orgs
Buckets List: influxdb://buckets
Bucket Measurements: influxdb://bucket/{bucketName}/measurements
Query Data: influxdb://query/{orgName}/{fluxQuery}
The server provides these tools:
write-data
: Write time-series data in line protocol format
query-data
: Execute Flux queries
create-bucket
: Create a new bucket
create-org
: Create a new organization
The server offers these prompt templates:
flux-query-examples
: Common Flux query examplesline-protocol-guide
: Guide to InfluxDB line protocol formatThe server requires these environment variables:
INFLUXDB_TOKEN
(required): Authentication token for the InfluxDB APIINFLUXDB_URL
(optional): URL of the InfluxDB instance (defaults to http://localhost:8086
)INFLUXDB_ORG
(optional): Default organization name for certain operationsTo install InfluxDB MCP Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @idoru/influxdb-mcp-server --client claude
# Run directly with npx
INFLUXDB_TOKEN=your_token npx influxdb-mcp-server
# Install globally
npm install -g influxdb-mcp-server
# Run the server
INFLUXDB_TOKEN=your_token influxdb-mcp-server
# Clone the repository
git clone https://github.com/idoru/influxdb-mcp-server.git
cd influxdb-mcp-server
# Install dependencies
npm install
# Run the server
INFLUXDB_TOKEN=your_token npm start
Add the server to your claude_desktop_config.json
:
{
"mcpServers": {
"influxdb": {
"command": "npx",
"args": ["influxdb-mcp-server"],
"env": {
"INFLUXDB_TOKEN": "your_token",
"INFLUXDB_URL": "http://localhost:8086",
"INFLUXDB_ORG": "your_org"
}
}
}
}
{
"mcpServers": {
"influxdb": {
"command": "node",
"args": ["/path/to/influxdb-mcp-server/src/index.js"],
"env": {
"INFLUXDB_TOKEN": "your_token",
"INFLUXDB_URL": "http://localhost:8086",
"INFLUXDB_ORG": "your_org"
}
}
}
}
The server code is organized into a modular structure:
src/
index.js
- Main server entry pointconfig/
- Configuration related files
env.js
- Environment variable handlingutils/
- Utility functions
influxClient.js
- InfluxDB API clientloggerConfig.js
- Console logger configurationhandlers/
- Resource and tool handlers
organizationsHandler.js
- Organizations listingbucketsHandler.js
- Buckets listingmeasurementsHandler.js
- Measurements listingqueryHandler.js
- Query executionwriteDataTool.js
- Data write toolqueryDataTool.js
- Query toolcreateBucketTool.js
- Bucket creation toolcreateOrgTool.js
- Organization creation toolprompts/
- Prompt templates
fluxQueryExamplesPrompt.js
- Flux query exampleslineProtocolGuidePrompt.js
- Line protocol guideThis structure allows for better maintainability, easier testing, and clearer separation of concerns.
The repository includes comprehensive integration tests that:
To run the tests:
npm test
MIT
Reviews feature coming soon
Stay tuned for community discussions and feedback