使用说明
InfluxDB MCP服务器
模型上下文协议服务器为LLM提供对InfluxDB v2的只读访问。允许通过Flux查询和模式发现查询时间序列数据。
安装
独立使用uv+python
# Clone and install
git clone <repository-url>
cd influxdb-mcp
uv sync
# Run
uv run python -m influxdb_mcp
使用Docker
# Build and run
docker build -t influxdb-mcp .
docker run -d -p 5001:5001 --env-file .env influxdb-mcp
# Or use docker-compose
docker-compose up -d
配置
环境变量
| 变量 | 描述 | 默认值 | 必填 |
|---|---|---|---|
| InfluxDB设置 | |||
INFLUXDB_TOKEN |
身份验证令牌 | - | 是 |
INFLUXDB_ORG |
组织 | - | 是 |
INFLUXDB_HOST |
InfluxDB主机名 | localhost |
没有 |
INFLUXDB_PORT |
InfluxDB端口 | 8086 |
没有 |
INFLUXDB_USE_SSL |
使用HTTPS | false |
没有 |
INFLUXDB_VERIFY_SSL |
验证SSL证书 | true |
没有 |
INFLUXDB_TIMEOUT |
请求超时(ms) | 10000 |
没有 |
| MCP设置 | |||
MCP_LISTEN_HOST |
服务器绑定地址 | 127.0.0.1 |
没有 |
MCP_LISTEN_PORT |
服务器端口 | 5001 |
没有 |
MCP_TRANSPORT |
传输协议 | streamable-http |
没有 |
.env示例
# InfluxDB Configuration
INFLUXDB_HOST=influxdb.example.com
INFLUXDB_PORT=8086
INFLUXDB_TOKEN=your-token-here
INFLUXDB_ORG=your-org
# MCP Configuration
MCP_LISTEN_HOST=0.0.0.0
MCP_LISTEN_PORT=8000
可用工具
test_connection-测试InfluxDB连接和返回状态list_buckets-列出所有可用桶list_measurements(bucket)-在桶中列出测量值execute_flux_query(query)-执行自定义Flux查询
可用资源
influxdb://buckets-带有元数据的Live bucket列表influxdb://measurements/{bucket}-铲斗的实时测量influxdb://status-当前连接状态flux://templates/daily-hourly-average/{bucket}/{measurement}/{field}-每小时平均值flux://templates/recent-data/{bucket}/{measurement}/{field}/{duration}-最近的数据flux://templates/threshold-alerts/{bucket}/{measurement}/{field}/{threshold}-阈值监控flux://templates/correlation/{bucket}/{measurement1}/{field1}/{measurement2}/{field2}-相关性分析
服务器在上运行 http://127.0.0.1:5001/mcp/ 默认情况下。
作者
由开发 迈克尔·卢德维格 以及他的人工智能助手。