Skip to main content
Glama
idoru

InfluxDB MCP Server

by idoru

InfluxDB MCP 服务器

铁匠徽章

一个模型上下文协议 (MCP) 服务器,使用 InfluxDB OSS API v2 公开对 InfluxDB 实例的访问。主要使用 Claude 代码构建。

特征

该 MCP 服务器提供:

  • 资源:访问组织、存储桶和测量数据

  • 工具:写入数据、执行查询和管理数据库对象

  • 提示:常见 Flux 查询和线路协议格式的模板

Related MCP server: MCP Deep Web Research Server

资源

服务器公开以下资源:

  1. 组织列表influxdb://orgs

    • 显示 InfluxDB 实例中的所有组织

  2. 存储桶列表influxdb://buckets

    • 显示所有存储桶及其元数据

  3. 存储桶测量influxdb://bucket/{bucketName}/measurements

    • 列出指定存储桶内的所有测量值

  4. 查询数据influxdb://query/{orgName}/{fluxQuery}

    • 执行 Flux 查询并将结果作为资源返回

工具

服务器提供以下工具:

  1. write-data :以线路协议格式写入时间序列数据

    • 参数:org、bucket、data、precision(可选)

  2. query-data :执行 Flux 查询

    • 参数:org,query

  3. create-bucket :创建一个新的存储桶

    • 参数:name、orgID、retentionPeriodSeconds(可选)

  4. create-org :创建新组织

    • 参数:名称、描述(可选)

提示

服务器提供以下提示模板:

  1. flux-query-examples :常见的 Flux 查询示例

  2. line-protocol-guide :InfluxDB 线路协议格式指南

配置

服务器需要以下环境变量:

  • INFLUXDB_TOKEN (必需):InfluxDB API 的身份验证令牌

  • INFLUXDB_URL (可选): InfluxDB 实例的 URL (默认为http://localhost:8086 )

  • INFLUXDB_ORG (可选):某些操作的默认组织名称

安装

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 InfluxDB MCP 服务器:

npx -y @smithery/cli install @idoru/influxdb-mcp-server --client claude

选项 1:使用 npx 运行(推荐)

# Run directly with npx
INFLUXDB_TOKEN=your_token npx influxdb-mcp-server

选项 2:全局安装

# Install globally
npm install -g influxdb-mcp-server

# Run the server
INFLUXDB_TOKEN=your_token influxdb-mcp-server

选项 3:从源头

# 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

与 Claude for Desktop 集成

将服务器添加到您的claude_desktop_config.json

使用 npx(推荐)

{
  "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"
      }
    }
  }
}

代码结构

服务器代码被组织成模块化结构:

  • src/

    • index.js - 主服务器入口点

    • config/ ——配置相关文件

      • env.js - 环境变量处理

    • utils/ ——实用函数

      • influxClient.js - InfluxDB API 客户端

      • loggerConfig.js - 控制台记录器配置

    • handlers/ - 资源和工具处理程序

      • organizationsHandler.js - 组织列表

      • bucketsHandler.js - 存储桶列表

      • measurementsHandler.js - 测量列表

      • queryHandler.js - 查询执行

      • writeDataTool.js - 数据写入工具

      • queryDataTool.js - 查询工具

      • createBucketTool.js - Bucket创建工具

      • createOrgTool.js - 组织创建工具

    • prompts/ -提示模板

      • fluxQueryExamplesPrompt.js - Flux 查询示例

      • lineProtocolGuidePrompt.js - 线路协议指南

这种结构可以实现更好的可维护性、更容易的测试和更清晰的关注点分离。

测试

该存储库包括全面的集成测试:

  • 使用 InfluxDB 启动 Docker 容器

  • 使用示例数据填充

  • 测试所有 MCP 服务器功能

运行测试:

npm test

执照

麻省理工学院

Install Server
A
license - permissive license
D
quality
-
maintenance - not tested

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/idoru/influxdb-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server