InfluxDB MCP Server

Integrations

  • Provides templates and execution capabilities for Flux queries, which is the query language for InfluxDB, allowing for data querying and transformation operations.

  • Exposes access to an InfluxDB instance using the InfluxDB OSS API v2, allowing for organization and bucket management, measurement data access, writing time-series data, and executing Flux queries against the database.

InfluxDB MCP サーバー

InfluxDB OSS API v2を使用してInfluxDBインスタンスへのアクセスを公開するモデルコンテキストプロトコル(MCP)サーバー。主にClaude Codeによって構築されています。

特徴

この MCP サーバーは以下を提供します。

  • リソース: 組織、バケット、測定データへのアクセス
  • ツール: データの書き込み、クエリの実行、データベース オブジェクトの管理
  • プロンプト: 一般的な Flux クエリとラインプロトコル形式のテンプレート

リソース

サーバーは次のリソースを公開します。

  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、クエリ
  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 (オプション): 特定の操作のデフォルトの組織名

インストール

オプション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 - バケット作成ツール
      • createOrgTool.js - 組織作成ツール
    • prompts/ - プロンプトテンプレート
      • fluxQueryExamplesPrompt.js - Flux クエリの例
      • lineProtocolGuidePrompt.js - ラインプロトコルガイド

この構造により、保守性が向上し、テストが容易になり、関心の分離が明確になります。

テスト

リポジトリには、次のような包括的な統合テストが含まれています。

  • InfluxDB で Docker コンテナを起動する
  • サンプルデータを入力する
  • すべてのMCPサーバー機能をテストする

テストを実行するには:

npm test

ライセンス

マサチューセッツ工科大学

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

Claude に InfluxDB 時系列データベース インスタンスへのアクセスを提供し、自然言語によるデータの書き込み、クエリ、組織およびバケットの管理を可能にするモデル コンテキスト プロトコル サーバー。

  1. Features
    1. Resources
      1. Tools
        1. Prompts
          1. Configuration
            1. Installation
              1. Option 1: Run with npx (recommended)
              2. Option 2: Install globally
              3. Option 3: From source
            2. Integration with Claude for Desktop
              1. Using npx (recommended)
              2. If installed locally
            3. Code Structure
              1. Testing
                1. License
                  ID: 9bo1fbiook