IoTDB MCP 服务器のロゴ

IoTDB MCP 服务器

組織
apache

Apache IoTDB MCP Server

公開者apache
リポジトリiotdb-mcp-server
言語Python
フォーク
22
スター
39
利用可能なツール
0
通信方式stdio
カテゴリ
ライセンスApache-2.0
リンク
  • ツールをAIワークフローに接続

    IoTDB MCP 服务器は、対応するAIクライアントやAIエージェントから利用できるMCP機能を提供します。

  • 0個の利用可能なツール

    呼び出し可能なアクションを以下で確認できます。サーバーから提供されている場合は、名前や説明も表示されます。

  • コピーして使える設定

    セットアップ用の設定例を使って、お好みのMCPクライアントにこのサーバーを設定できます。

  • オープンソースの注目度

    リンク先のリポジトリには39件のスターと22件のフォークがあります。

IoTDB MCP Server

English | 中文

Overview

A Model Context Protocol (MCP) server implementation that provides database interaction and business intelligence capabilities through IoTDB. This server enables running SQL queries and interacting with IoTDB using different SQL dialects (Tree Model and Table Model).

Components

Resources

The server doesn't expose any resources.

Prompts

The server doesn't provide any prompts.

Permission Model

IoTDB MCP permissions are advisory by default. The server reports the required permission, risk level, and confirmation parameter for SQL actions, while the host agent system owns user approval. Use inspect_sql_permission before executing DDL/DML or destructive SQL when the tool is available.

Long-running hosted agents can provide full-permission defaults with environment variables such as IOTDB_SQL_DRIVER_MODE=full and TIMESEEK_MCP_PERMISSION_ENFORCEMENT=advisory. Set TIMESEEK_MCP_PERMISSION_ENFORCEMENT=strict only when the MCP server itself should hard-block disallowed operations.

Session policy changes are bounded by a deployment policy frozen at startup (process environment > MCP configuration > defaults). Narrowing applies immediately; widening within that ceiling requires out-of-band administrator approval by default. IOTDB_SESSION_POLICY_APPROVAL_MODE=allow explicitly permits in-ceiling widening without approval. Neither setting allows tools to change enforcement switches, SQL classification prefixes, or the deployment ceiling. Reset and replace follow the same rules. See session policy administration for configuration, approval commands, and the required host isolation.

Tools

The server offers different tools for IoTDB Tree Model and Table Model. You can choose between them by setting the "IOTDB_SQL_DIALECT" configuration to either "tree" or "table".

Dialect-specific identifier semantics:

  • Tree dialect:
    • FROM targets use explicit root... paths.
    • Projection expressions should usually use measurement names instead of full root... paths.
    • IOTDB_DATABASE is only a connection/session hint; tree SQL still needs explicit root paths.
  • Table dialect:
    • FROM targets use table names in the current database.
    • Projection expressions use column names.

Tree Model

  • metadata_query
    • Execute SHOW/COUNT queries to read metadata from the database
    • Input:
      • query_sql (string): The SHOW/COUNT SQL query to execute
    • Supported query types:
      • SHOW DATABASES [path]
      • SHOW TIMESERIES [path]
      • SHOW CHILD PATHS [path]
      • SHOW CHILD NODES [path]
      • SHOW DEVICES [path]
      • COUNT TIMESERIES [path]
      • COUNT NODES [path]
      • COUNT DEVICES [path]
    • Returns: Query results as array of objects
  • select_query
    • Execute SELECT queries to read data from the database
    • Input:
      • query_sql (string): The SELECT SQL query to execute (using TREE dialect, time using ISO 8601 format, e.g. 2017-11-01T00:08:00.000)
    • Supported functions:
      • SUM, COUNT, MAX_VALUE, MIN_VALUE, AVG, VARIANCE, MAX_TIME, MIN_TIME, etc.
    • Returns: Query results as array of objects
  • sql_executor_batch
    • Execute multiple readonly SQL statements in parallel and store each result in ResultStore
    • Input:
      • sqls (array): Explicit single SQL statements, or
      • sql_template + param_sets: Repeated SQL template with parameter objects
      • max_concurrency (integer): Concurrent statement limit, default 4
      • worker_pool_size (integer): Thread worker pool size, default follows concurrency and is capped by IOTDB_SQL_EXECUTOR_BATCH_MAX_WORKER_POOL_SIZE (default 16)
      • per_item_timeout_ms (integer): Per-statement wait timeout, default 60000
      • batch_timeout_ms (integer): Whole-batch wait timeout, default 300000
      • max_result_rows_per_item / max_result_bytes_per_item: Per-statement result quota, defaults 10000 rows and 16 MiB
      • max_batch_result_rows / max_batch_result_bytes: Whole-batch result quota, defaults 100000 rows and 64 MiB
    • Template placeholders:
      • {{name}} for SQL literals, {{name:path}} for IoTDB paths, {{name:identifier}} for SQL identifiers
    • Returns: Batch summary plus per-statement result_id, row count, preview rows, and paging metadata
  • read_result_pages
    • Read multiple ResultStore pages in one MCP call
    • Input:
      • pages (array): Page request objects with result_id plus optional cursor, offset, limit, and owner_session_id
      • default_limit (integer): Default page size for items without limit
      • max_pages / max_total_rows: Per-call quotas, defaults 32 pages and 10000 rows
      • continue_on_error (boolean): Return per-item errors instead of aborting, default true
    • Returns: Batch page summary plus per-page rows, cursors, and errors
  • export_query
    • Execute a query and export the results to a CSV or Excel file
    • Input:
      • query_sql (string): The SQL query to execute (using TREE dialect)
      • format (string): Export format, either "csv" or "excel" (default: "csv")
      • filename (string): Optional filename for the exported file. If not provided, a unique filename will be generated.
    • Returns: Information about the exported file and a preview of the data (max 10 rows)
  • model_inference
    • Execute AINode CALL INFERENCE(...) SQL and return the result set
    • Input:
      • inference_sql (string): A single Tree-dialect SQL statement starting with CALL INFERENCE
    • Validates model id, quoted input SELECT SQL, explicit non-wildcard columns, and supported parameters (generateTime, outputLength) before execution
    • Permission metadata: model management is reported through the advisory MCP policy layer. In strict mode, IOTDB_ENABLE_MODEL_MANAGEMENT=true and IOTDB_MODEL_ALLOWED_USERS are enforced.
  • prepare_model_inference_request
    • Build and validate AINode CALL INFERENCE(...) SQL from structured fields
    • Input:
      • model_id (string): Registered AINode model id
      • input_sql (string): Bounded Tree-dialect SELECT query used as model input
      • output_length (int): Forecast output length (default: 96)
      • generate_time (bool): Whether to request a Time column (default: false)

UDF Tools

  • list_udf_functions
    • Execute SHOW FUNCTIONS for the selected IoTDB target.
  • prepare_udf_query
    • Build a read-only UDF SELECT from structured inputs.
    • Tree form: SELECT UDF(measurement, "k"="v") FROM root.sg.d1 ...
    • Table form: SELECT UDF(column, "k"="v") FROM table ...
  • execute_udf_query
    • Execute the validated UDF query and return a ResultStore-backed preview.
  • export_udf_query
    • Execute the validated UDF query and export the result set to CSV or Excel.

UDF tools reject semicolons, SQL comments, and DDL/DML keywords in expressions and filter clauses. They are intended for read-only UDF calls such as data quality, profiling, repair planning, and anomaly scoring.

Table Model

Query Tools
  • read_query
    • Execute SELECT queries to read data from the database
    • Input:
      • query_sql (string): The SELECT SQL query to execute (using TABLE dialect, time using ISO 8601 format, e.g. 2017-11-01T00:08:00.000)
    • Returns: Query results as array of objects
Schema Tools
  • list_tables

    • Get a list of all tables in the database
    • No input required
    • Returns: Array of table names
  • describe_table

    • View schema information for a specific table
    • Input:
      • table_name (string): Name of table to describe
    • Returns: Array of column definitions with names and types
  • export_table_query

    • Execute a query and export the results to a CSV or Excel file
    • Input:
      • query_sql (string): The SQL query to execute (using TABLE dialect)
      • format (string): Export format, either "csv" or "excel" (default: "csv")
      • filename (string): Optional filename for the exported file. If not provided, a unique filename will be generated.
    • Returns: Information about the exported file and a preview of the data (max 10 rows)

Configuration Options

IoTDB MCP Server supports the following configuration options, which can be set via environment variables or command-line arguments:

OptionEnvironment VariableDefault ValueDescription
--hostIOTDB_HOST127.0.0.1IoTDB host address
--portIOTDB_PORT6667IoTDB port
--userIOTDB_USERrootIoTDB username
--passwordIOTDB_PASSWORDemptyIoTDB password
--databaseIOTDB_DATABASEtestTable dialect: current database name. Tree dialect: optional session/root scope hint; queries still use explicit root... paths.
--sql-dialectIOTDB_SQL_DIALECTtableSQL dialect: tree or table
--export-pathIOTDB_EXPORT_PATH/tmpPath for exporting query results

The target registry contains only connections that have completed a successful login. Call prepare_iotdb_target with non-secret fields, then pass explicitly user-supplied credentials to connect_iotdb_target for one authentication attempt. If credentials are absent, ask the user; never probe empty or default passwords. An explicitly supplied empty password remains valid input.

Successful login atomically publishes the target and records its per-target last_known_good_credential. Any connection-layer failure consumes the candidate or evicts the published target. A retry requires a new candidate and user_confirmed_retry=true after explicit user instruction. Public target responses redact both the active password and last-known-good password.

When TIMESEEK_IOTDB_TARGETS_FILE is configured, successful connections are persisted by default. The local Java CLI can reuse exactly that target through iotdb-target-cli:

bash
iotdb-target-cli --target-id cloud \
  --cli /opt/iotdb/sbin/start-cli.sh -- -e "SHOW VERSION"

The wrapper reloads the verified target on every invocation and supplies its host, port, dialect, username, and last-known-good password. It does not pass -db to start-cli.sh, because the Java CLI does not support that option; select a table database with SQL USE <database>. For import-data.sh and import-data.bat, which do support -db, a table target's database is injected automatically. A verified empty password is represented by omitting -pw, and command previews redact non-empty passwords. Calling start-cli.sh directly does not read the target registry.

Performance Optimizations

IoTDB MCP Server includes the following performance optimization features:

  1. Session Pool Management: Uses optimized session pool configurations, supporting up to 100 concurrent sessions
  2. Optimized Fetch Size: For queries, a fetch size of 1024 is set
  3. Connection Retry: Configured automatic retry mechanism for connection failures
  4. Timeout Management: Session wait timeout set to 5000 milliseconds for improved reliability
  5. Export Functionality: Support for exporting query results to CSV or Excel formats

Prerequisites

  • Python environment
  • uv package manager
  • IoTDB installation
  • MCP server dependencies

Development

bash
# Clone the repository
git clone https://github.com/apache/iotdb-mcp-server.git
cd iotdb-mcp-server

# Create virtual environment
uv venv
source venv/bin/activate  # or `venv\Scripts\activate` on Windows

# Install development dependencies
uv sync

Claude Desktop Integration

Configure the MCP server in Claude Desktop's configuration file:

macOS

Location: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows

Location: %APPDATA%/Claude/claude_desktop_config.json

You may need to put the full path to the uv executable in the command field. You can get this by running which uv on MacOS/Linux or where uv on Windows.

Claude Desktop Configuration Example

Add the following configuration to Claude Desktop's configuration file:

json
{
  "mcpServers": {
    "iotdb": {
      "command": "uv",
      "args": [
        "--directory",
        "/Users/your_username/iotdb-mcp-server/src/iotdb_mcp_server",
        "run",
        "server.py"
      ],
      "env": {
        "IOTDB_HOST": "127.0.0.1",
        "IOTDB_PORT": "6667",
        "IOTDB_USER": "root",
        "IOTDB_PASSWORD": "",
        "IOTDB_DATABASE": "test",
        "IOTDB_SQL_DIALECT": "table",
        "IOTDB_EXPORT_PATH": "/path/to/export/folder"
      }
    }
  }
}

Note: Make sure to replace the --directory parameter's path with your actual repository clone path.

Error Handling and Logging

IoTDB MCP Server includes comprehensive error handling and logging capabilities:

  1. Log Level: Logging level is set to INFO, allowing you to view server status in the console
  2. Exception Handling: All database operations include exception handling to ensure graceful handling and meaningful error messages when errors occur
  3. Session Management: Automatic closure of used sessions to prevent resource leaks
  4. Parameter Validation: Basic validation of user-input SQL queries to ensure only allowed query types are executed

Docker Support

You can build a container image for the IoTDB MCP Server using the Dockerfile in the project root:

bash
# Build Docker image
docker build -t iotdb-mcp-server .

# Run container
docker run -e IOTDB_HOST=<your-iotdb-host> -e IOTDB_PORT=<your-iotdb-port> -e IOTDB_USER=<your-iotdb-user> -e IOTDB_PASSWORD=<your-iotdb-password> iotdb-mcp-server

インストール

TypingMind
前提条件:

Node.js 18+

{
  "mcpServers": {
    "apache-iotdb-mcp-server": {
      "command": "",
      "args": []
    }
  }
}

IoTDB MCP 服务器のMCPを複数のAIモデルで活用

TypingMindはワークスペース単位でMCPツールに接続します。そのため、一度IoTDB MCP 服务器に接続すれば、モデルごとに個別に設定することなく、TypingMind内のさまざまなAIモデルで利用できます。 このMCPは、デバイス上のTypingMind MCPコネクタを通じてローカルで動作します。

ローカルコネクタのセットアップガイド

MCPサーバーが、お使いのコンピューター上のローカルファイル、アプリ、非公開リソースにアクセスする必要がある場合は、この方法を使います。

1

MCP設定を開く

TypingMindで「設定」、「詳細設定」、「MCP」の順に進み、「コネクタを設定」を選択してください。

  1. ブラウザでTypingMindを開いてください。
  2. 設定アイコンをクリックしてください。
  3. 「詳細設定」に移動してください。
  4. 「MCP」セクションを開いてください。
  5. 「コネクタを設定」をクリックし、「このデバイス」を選択してください。
「このデバイス」が選択されたTypingMindのMCPコネクタ設定画面
2

コネクタのコマンドを実行

「このデバイス」を選択し、TypingMindからコマンドをコピーしてターミナルで実行してください。MCPの使用中は、プロセスを実行したままにしてください。

  1. TypingMindに表示されるセットアップコマンドをコピーしてください。
  2. macOSではターミナルを、WindowsではWindows Terminalを開いてください。
  3. コマンドを貼り付けて実行してください。
  4. ターミナルで続行の確認を求められた場合は、パッケージのインストールを承認してください。
  5. MCPツールの使用中は、ターミナルウィンドウを開いたまま、プロセスの実行を継続してください。
3

IoTDB MCP 服务器をサーバーとして追加

コネクタのステータスが「準備完了」になったら、「サーバーを編集」をクリックし、MCPサーバーの設定を貼り付けてください。

  1. コネクタのステータスが「準備完了」になるまでお待ちください。
  2. 「サーバーを編集」をクリックしてください。
  3. IoTDB MCP 服务器のMCPサーバー設定を貼り付けてください。
  4. サーバー一覧を保存してください。
  5. コネクタが引き続き使用可能か確認するには、更新してください。
稼働中のサーバーと「サーバーを編集」ボタンが表示されたTypingMindのMCP設定画面
{
  "mcpServers": {
    "apache-iotdb-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "iotdb-mcp-server"
      ]
    }
  }
}
4

複数のモデルで同じ接続を使用

サーバー一覧を保存し、「プラグイン」を開いてIoTDB MCP 服务器のMCPツールを有効にしてください。その後、TypingMindで対応するAIモデルを選択し、チャットでツールを使うか、AIエージェントに割り当ててください。

  1. TypingMindの「プラグイン」ページを開いてください。
  2. IoTDB MCP 服务器のMCPツールを有効にしてください。
  3. チャットを開始し、使用するAIモデルを選択してください。
  4. MCPツールをチャットで使うか、AIエージェントに割り当ててください。
  5. MCPに再接続することなく、必要に応じて別のAIモデルに切り替えられます。
選択したAIモデルと有効なMCPツールを使用したTypingMindのチャット
IoTDB MCP 服务器を使ってこのタスクを手伝ってもらえますか?
IoTDB MCP 服务器
はい、読みました。
IoTDB MCP 服务器で調べた結果をお伝えします。

よくある質問

IoTDB MCP 服务器 MCPサーバーは何に使いますか?

IoTDB MCP 服务器は、対応するAIクライアントを外部ツールやコンテキストに接続するためのMCPサーバーです。TypingMindでは、このMCPサーバーを一度追加するだけで、AIワークスペース内でそのツールを利用できるようになります。

TypingMindでIoTDB MCP 服务器 MCPを複数のAIモデルと併用できますか?

はい。TypingMindはワークスペース単位でMCPツールに接続するため、モデルごとにMCPサーバーを設定する必要はありません。Claude、ChatGPT、Geminiや、TypingMindで設定したその他のAIモデルでIoTDB MCP 服务器を利用できます。

TypingMindでIoTDB MCP 服务器 MCPを使うメリットは何ですか?

TypingMindは、複数のAIモデル、プロンプト、プラグイン、AIエージェント、APIキー、MCPツールを1つのワークスペースにまとめられる、LLMチャット向けの優れたフロントエンドです。IoTDB MCP 服务器を接続すると、TypingMindでチャットのワークフローを整理しながら、お好みのモデルでそのMCPツールを利用できます。

IoTDB MCP 服务器 MCPをTypingMindに接続するにはどうすればよいですか?

IoTDB MCP 服务器はTypingMindのローカルMCPコネクタ経由で動作します。MCPサーバーがコンピューター上のローカルファイル、デスクトップアプリ、コマンドラインツール、プライベートリソースにアクセスする必要がある場合に最適です。

TypingMindでIoTDB MCP 服务器 MCPのどのようなツールを利用できますか?

IoTDB MCP 服务器はMCP機能を提供しています。TypingMindのプラグインページで有効にすると、チャットで使用したり、AIエージェントに割り当てたりできます。

IoTDB MCP 服务器 MCPを使うには、APIキーをTypingMindと共有する必要がありますか?

いいえ。TypingMindはローカルファーストの設計で、モデルプロバイダー、APIキー、プロンプト、MCP設定をご自身で管理できます。IoTDB MCP 服务器で認証が必要な場合は、接続の作成時に、そのMCPサーバーに必要なヘッダー、OAuth設定、またはローカル設定を追加してください。

関連するMCPサーバー

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇