Skip to content
Try for free

ThingsBoard Cloud

Choose your data region

Your data stays in the region you choose, for residency and compliance. No credit card required.

Rather run it yourself? Install on your own servers

MCP Server

The ThingsBoard MCP Server connects your MCP-enabled LLM client to a live ThingsBoard instance via the Model Context Protocol. It exposes a comprehensive set of tools across multiple tool groups, letting you query, create, and manage platform data using natural language — no REST calls or dashboard clicks required.

Capabilities at a glance:

  • Devices & assets — create, search, update, and delete entities
  • Telemetry — read and write attributes and time-series data, with aggregation and TTL support
  • Alarms — create, acknowledge, clear, and query alarms by severity
  • Relations — create and navigate entity relationships
  • OTA packages — upload, download, and assign firmware/software to devices
  • Entity data queries — run complex filtered queries with attribute and telemetry filters
  • Customers & users — full CRUD and user management

Works with Claude Desktop, Cursor, VS Code Copilot, Claude Code, and any MCP-compatible client.

Before you begin, ensure that you have:

Pull the Docker image:

Terminal window
docker pull thingsboard/mcp

Choose your MCP client below. Each tab shows the configuration for API key authentication (recommended). For username/password authentication, see the Username & Password section below.

Edit the Claude Desktop config file (claude_desktop_config.json):

{
"mcpServers": {
"thingsboard": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "THINGSBOARD_URL",
"-e", "THINGSBOARD_API_KEY",
"thingsboard/mcp"
],
"env": {
"THINGSBOARD_URL": "<thingsboard_url>",
"THINGSBOARD_API_KEY": "<your_api_key>"
}
}
}
}

Replace <thingsboard_url> with your ThingsBoard host URL and <your_api_key> with your API key.

If you cannot use an API key (e.g., on ThingsBoard versions before 4.3), replace the API key environment variables with username and password. The example below shows Claude Desktop config — the same args and env pattern applies to all other clients.

{
"mcpServers": {
"thingsboard": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "THINGSBOARD_URL",
"-e", "THINGSBOARD_USERNAME",
"-e", "THINGSBOARD_PASSWORD",
"thingsboard/mcp"
],
"env": {
"THINGSBOARD_URL": "<thingsboard_url>",
"THINGSBOARD_USERNAME": "<thingsboard_username>",
"THINGSBOARD_PASSWORD": "<thingsboard_password>"
}
}
}
}

Once your client starts, you will see thingsboard tools available:

Here are some prompts to try once the MCP server is connected:

Devices — “Get all devices of type ‘Temperature Sensor’ and show their latest telemetry.”

Telemetry — “Generate sample temperature data for Sensor A1 for the last 7 days with a 30-minute sampling rate.”

Alarms — “Show all active alarms with CRITICAL severity and who they are assigned to.”

Anomaly detection — “Analyze the power consumption of Building 3 for the past week and flag any anomalies.”

Relations — “Show all devices related to asset ‘Factory Floor 1’ and their connection types.”

Entity queries — “Find all devices where the ‘firmware_version’ attribute is older than 2.0 and battery level is below 20%.”

OTA updates — “List all devices with outdated firmware and assign the latest OTA package to them.”

Here is a list of devices inside the ThingsBoard platform:

Using your MCP client, make requests in natural language:

Get devices of type 'Air Quality Sensor'

ThingsBoard MCP translates this into a ThingsBoard API query and returns structured results:

MCP can simulate (generate) telemetry for any device based on your request.

Generate sample data for Office #1 AQI Sensor for the last 3 days and save it as timeseries data. Use sampling rate as 1 hour

Once telemetry is available, request MCP to analyze it:

Analyze AQI of Office #1 AQI Sensor for anomalies in the last 3 days and show results in a table.

The MCP server provides tools organized into the following groups:

Group Description
Devices Create, update, delete, list, and search devices by name, type, or group
Assets CRUD operations, list by tenant or customer, search
Customers CRUD operations, list, and search by title
Users CRUD operations, admin and customer user management
Alarms Create, acknowledge, clear, delete, and query by severity
Telemetry Read/write attributes and time-series, aggregation, TTL support
Relations Create, delete, and navigate entity relationships
OTA packages Upload, download, and assign firmware/software to devices
Entity data query Complex filtered queries with attribute and telemetry filters
Entity groups Manage groups, assign and remove entities PE only

See the ThingsBoard MCP GitHub repository for a full tool reference.

Each tool group can be individually enabled or disabled via environment variables. All are enabled by default.

Environment variable Group Default
THINGSBOARD_TOOLS_DEVICE Devices true
THINGSBOARD_TOOLS_ASSET Assets true
THINGSBOARD_TOOLS_CUSTOMER Customers true
THINGSBOARD_TOOLS_USER Users true
THINGSBOARD_TOOLS_ALARM Alarms true
THINGSBOARD_TOOLS_TELEMETRY Telemetry true
THINGSBOARD_TOOLS_RELATION Relations true
THINGSBOARD_TOOLS_OTA OTA packages true
THINGSBOARD_TOOLS_EDQ Entity data query true
THINGSBOARD_TOOLS_GROUP Entity groups PE only true

For example, to enable only device and telemetry tools, set every other group to false:

{
"mcpServers": {
"thingsboard": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "THINGSBOARD_URL",
"-e", "THINGSBOARD_API_KEY",
"-e", "THINGSBOARD_TOOLS_ASSET",
"-e", "THINGSBOARD_TOOLS_CUSTOMER",
"-e", "THINGSBOARD_TOOLS_USER",
"-e", "THINGSBOARD_TOOLS_ALARM",
"-e", "THINGSBOARD_TOOLS_RELATION",
"-e", "THINGSBOARD_TOOLS_OTA",
"-e", "THINGSBOARD_TOOLS_EDQ",
"thingsboard/mcp"
],
"env": {
"THINGSBOARD_URL": "<thingsboard_url>",
"THINGSBOARD_API_KEY": "<your_api_key>",
Mode When to use Key environment variables
STDIO (default) Clients that launch the server as a subprocess (Claude Desktop, Cursor, Claude Code) SPRING_AI_MCP_SERVER_STDIO=true (default)
SSE HTTP-based clients or running the server as a standalone service SPRING_AI_MCP_SERVER_STDIO=false, SPRING_WEB_APPLICATION_TYPE=servlet

In SSE mode, the server listens on http://<HTTP_BIND_ADDRESS>:<HTTP_BIND_PORT>/sse (default: http://127.0.0.1:8000/sse).

Variable Description Default
THINGSBOARD_URL ThingsBoard instance base URL https://thingsboard.cloud
THINGSBOARD_API_KEY API key for authentication (4.3+) —
THINGSBOARD_USERNAME Username for legacy authentication —
THINGSBOARD_PASSWORD Password for legacy authentication —
THINGSBOARD_LOGIN_INTERVAL_SECONDS Session refresh interval (username/password mode) 1800
SPRING_AI_MCP_SERVER_STDIO Enable STDIO transport true
SPRING_WEB_APPLICATION_TYPE none for STDIO, servlet for SSE none
HTTP_BIND_ADDRESS SSE bind address 127.0.0.1
HTTP_BIND_PORT SSE bind port 8000

The ThingsBoard MCP Server extends beyond AQI anomaly detection. It applies to a wide range of scenarios:

Use case Description
Industrial IoT Detect unusual vibration, temperature, or pressure changes in machinery.
Energy management Identify consumption spikes in smart meters and optimize energy usage.
Environmental monitoring Detect sudden changes in air or water quality and trigger alerts.
Predictive maintenance Analyze equipment performance trends and anticipate failures.
Smart city Monitor traffic flow, street lighting, or waste collection anomalies.

By combining MCP’s natural language interface with ThingsBoard’s data visualization and alerting capabilities, you can rapidly prototype and deploy AI-driven IoT solutions across many industries.