---
title: Datahub Influx DB
slug: litmus-mcp-server/datahub-influx-db
docTags: 
createdAt: 2026-05-11T21:49:52.110Z
---

# InfluxDB / Time Series

Query historical time-series data from the Litmus Edge `tsdata` InfluxDB.

| Tool                                     | Description                                                                                         |
| ---------------------------------------- | --------------------------------------------------------------------------------------------------- |
| `get_historical_data_from_influxdb` `**` | Query historical time-series data by measurement and time range.                                    |
| `list_influxdb_measurements` `**`        | List all measurement names in `tsdata`. Use for discovery before more specific queries.             |
| `get_device_historical_data` `**`        | Fuzzy-match device names to InfluxDB measurements and pull historical data per match.               |
| `query_tag_data` `**`                    | Query historical data for a specific tag by resolving its output topic. Newest-first.               |
| `get_tag_statistics` `**`                | Aggregate stats for a tag: mean, min, max, stddev, count, plus baseline range (`mean +/- 2 sigma`). |
| `get_device_data_for_inference` `**`     | Composite payload for AI inference: device metadata, all tags, per-tag stats, and recent samples.   |

## When to use which

- **Discovery:** `list_influxdb_measurements` to see what's actually being recorded before querying.
- **By measurement (raw):** `get_historical_data_from_influxdb` if you already know the measurement name and time range.
- **By device (fuzzy):** `get_device_historical_data` when you have a human-readable device name and want everything related.
- **By tag:** `query_tag_data` for the per-tag time series.
- **Summary stats for a tag:** `get_tag_statistics`. Includes a `mean +/- 2 sigma` baseline range that's handy for anomaly checks.
- **AI inference input:** `get_device_data_for_inference` returns a composite payload (device + tags + stats + recent samples) suitable for handing to a model in one shot.

## Requirements

- `INFLUX_HOST`, `INFLUX_PORT` (default `8086`), `INFLUX_DB_NAME` (default `tsdata`), `INFLUX_USERNAME`, `INFLUX_PASSWORD`.
- Litmus Edge must allow port `8086/TCP` under **System -> Network -> Firewall**.
- For `query_tag_data` and similar tag-resolving tools, `EDGE_*` headers are also required to look up the tag's output topic from DeviceHub.

## Setting up firewall access

1. Navigate to **Litmus Edge -> System -> Network -> Firewall**.
2. Add a firewall rule to allow port **8086** on **TCP**.
3. Confirm InfluxDB is reachable from the MCP server host (`curl http://<edge>:8086/ping`).

## Related

- [DeviceHub, Tags](#) - current value vs. historical.
- [NATS Topics](#) - live streams (no persistence).
- `get_device_connection_status` in [DeviceHub, Devices](#) - uses InfluxDB recency to infer connection health.
