# Apache IoTDB MCP server

> Run SQL queries and metadata reads against Apache IoTDB time-series databases and export results to CSV or Excel.

- Repository: https://github.com/apache/iotdb-mcp-server
- Page: https://hostedmcp.org/servers/apache/iotdb-mcp-server
- Transport: —
- Stars: 40
- License: Apache-2.0

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `IOTDB_DATABASE` | no | no |  |
| `IOTDB_EXPORT_PATH` | no | no |  |
| `IOTDB_HOST` | no | no |  |
| `IOTDB_PASSWORD` | no | no |  |
| `IOTDB_PORT` | no | no |  |
| `IOTDB_SQL_DIALECT` | no | no |  |
| `IOTDB_USER` | no | no |  |

## Tools (15)

- `metadata_query`
- `select_query`
- `sql_executor_batch`
- `read_result_pages`
- `export_query`
- `model_inference`
- `prepare_model_inference_request`
- `list_udf_functions`
- `prepare_udf_query`
- `execute_udf_query`
- `export_udf_query`
- `read_query`
- `list_tables`
- `describe_table`
- `export_table_query`

## FAQ

### Which SQL dialects does the IoTDB MCP server support?

It supports both the Tree Model and Table Model dialects, selected with the IOTDB_SQL_DIALECT setting.

### How do I connect the server to my IoTDB instance?

Configure host, port, user, password and database via environment variables or command-line arguments such as IOTDB_HOST and IOTDB_PORT.

### Can I export query results to a file?

Yes, the export tools write query results to CSV or Excel files and return a preview of up to 10 rows.

### What tools are available for reading metadata in the tree dialect?

The metadata_query tool runs SHOW and COUNT queries such as SHOW DATABASES, SHOW TIMESERIES, and COUNT DEVICES.

### Does the server let me run AI model inference on IoTDB?

Yes, model_inference executes AINode CALL INFERENCE statements, and prepare_model_inference_request builds and validates the SQL from structured fields.
