icon for mcp server

ThingsBoard

STDIOOfficial

MCP server providing natural language interface for ThingsBoard IoT platform management and operations

ThingsBoard MCP Server

License Trust Score

Table of Contents

Overview

The ThingsBoard MCP Server provides a natural language interface for LLMs and AI agents to interact with your ThingsBoard IoT platform.

You can ask questions such as “Get my devices of type 'Air Quality Sensor'” and receive structured results:

Get My Devices Example

You can request to simulate or save time-series data in ThingsBoard:

Generate Sample Data Example

Generated Data In ThingsBoard

Or, you can ask it to analyze your time-series data to find anomalies, spikes, or data gaps:

Analyze Data Example

Analyze Data Result

This server implements the Model Context Protocol (MCP), which enables AI systems to access and manipulate data in ThingsBoard through natural language commands. With this integration, you can:

  • Query entities (device, asset, customer, etc.) data and telemetry using conversational language
  • Manage entities through AI assistants
  • Analyze IoT data and create reports using AI tools
  • Automate ThingsBoard operations through AI-powered workflows

The server integrates seamlessly with MCP clients such as Claude Desktop, Cursor, and other AI applications that support the MCP protocol.

Requirements

Before you begin, ensure you have the following:

  • ThingsBoard instance - A running ThingsBoard instance that the MCP server can connect to. You can use any of the following options:
  • Authentication credentials - Valid username and password with appropriate permissions on the ThingsBoard instance

Quick Start Guide

  1. Configure your MCP client: Add the ThingsBoard MCP server to your client configuration (see Client Configuration)
  2. Start using natural language: Begin interacting with your ThingsBoard instance through your MCP client

Features

Entity Operations

  • Devices: Create, delete, view device details, credentials, and manage device relationships
  • Assets: Create, delete, view, and manage asset relationships
  • Customers: Create, delete, access customer information, titles, and manage customer relationships
  • Users: Create, delete, manage users, tokens, activation links, and user assignments
  • Entity Groups: Create, delete, view entity groups. Assign/unassign entities to specific group.

Telemetry Management

  • Attribute Access: Retrieve attribute keys and values by scope for any entity
  • Time-series Access: Get time-series data with various aggregation options
  • Telemetry Insert/Update: Save attributes or time-series data with optional TTL settings

Relations

Create, delete, discover, and navigate relationships between entities with direction-based queries.

Alarms

Create, delete, fetch alarms, alarm types, and severity information for specific entities.

Entity Data Query

Run complex queries over platform entities (devices, assets, customers, etc.) and retrieve their data (fields, attributes, telemetry) in a structured, paginated format.

Installation

This MCP server works with ThingsBoard IoT Platform or ThingsBoard Edge. You'll need your ThingsBoard instance or Edge URL and valid credentials for the installation.

ThingsBoard Account

Before installing the MCP server, ensure you have:

  1. Access to a ThingsBoard or Edge instance
  2. A user account with sufficient permissions
  3. The username and password for this account

Docker Image

The easiest way to get started is with the pre-built Docker image from Docker Hub.

Server Modes

The ThingsBoard MCP Server can run in two different modes:

  • STDIO Mode (Standard Input/Output): The server communicates directly through standard input/output streams
  • SSE Mode (Server-Sent Events): The server runs as an HTTP server that clients connect to

Running in STDIO Mode (Default)

For STDIO Mode, you must include the -i flag to keep stdin open:

docker pull thingsboard/mcp docker run --rm -i -e THINGSBOARD_URL=<your_thingsboard_url> -e THINGSBOARD_USERNAME=<your_username> -e THINGSBOARD_PASSWORD=<your_password> thingsboard/mcp

Running in SSE Mode

In SSE Mode, you must expose port 8000 using the -p flag and explicitly override the default settings :

docker pull thingsboard/mcp docker run --rm -p 8000:8000 -e THINGSBOARD_URL=<your_thingsboard_url> -e THINGSBOARD_USERNAME=<your_username> -e THINGSBOARD_PASSWORD=<your_password> -e SPRING_AI_MCP_SERVER_STDIO=false -e SPRING_WEB_APPLICATION_TYPE=servlet thingsboard/mcp

Download release binary

Alternatively, you can download the release binary (JAR file) and use it with the LLM Agent. Run the following command to download the binary to your PC:

wget https://github.com/thingsboard/thingsboard-mcp/releases/download/v2.0.0/thingsboard-mcp-server-2.0.0.jar

Build from Sources

You can also build the JAR file from sources and run the ThingsBoard MCP Server directly.

Prerequisites

  • Java 17 or later
  • Maven 3.6 or later

Build Steps

  1. Clone this repository
  2. Build the project:
mvn clean install -DskipTests
  1. The JAR file will be available in the target folder:
./target/thingsboard-mcp-server-2.0.0.jar
  1. Run the server using the JAR file:
# For STDIO Mode java -jar ./target/thingsboard-mcp-server-2.0.0.jar
# For SSE Mode java -Dspring.ai.mcp.server.stdio=false Dspring.main.web-application-type=servlet -jar ./target/thingsboard-mcp-server-2.0.0.jar

Client Configuration

To launch the server as a container when your MCP client starts (e.g., Claude Desktop), you need to add the appropriate configuration to your client's settings.

Docker Configuration

If you're using the Docker image, use this configuration in your claude_desktop_config.json:

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

Binary Configuration

If you've built the JAR file from sources, use this configuration in your claude_desktop_config.json:

{ "mcpServers": { "thingsboard": { "command": "java", "args": [ "-jar", "/absolute/path/to/thingsboard-mcp-server-2.0.0.jar" ], "env": { "THINGSBOARD_URL": "<thingsboard_url>", "THINGSBOARD_USERNAME": "<thingsboard_username>", "THINGSBOARD_PASSWORD": "<thingsboard_password>", "LOGGING_PATTERN_CONSOLE": "" } } } }

Environment Variables

The MCP server requires the following environment variables to connect to your ThingsBoard instance:

VariableDescriptionDefault
THINGSBOARD_URLThe base URL of your ThingsBoard instance
THINGSBOARD_USERNAMEUsername used to authenticate with ThingsBoard
THINGSBOARD_PASSWORDPassword used to authenticate with ThingsBoard
THINGSBOARD_LOGIN_INTERVAL_SECONDSLogin session refresh interval in seconds1800
SPRING_WEB_APPLICATION_TYPESpring application type (none or servlet)none
SPRING_AI_MCP_SERVER_STDIOEnable/disable standard I/O communicationtrue
SPRING_AI_MCP_SERVER_SSE_ENDPOINTServer-Sent Events (SSE) endpoint URL/sse
SPRING_AI_MCP_SERVER_SSE_MESSAGE_ENDPOINTServer-Sent Events message endpoint URL/mcp/message
LOGGING_PATTERN_CONSOLELogback console log pattern
SERVER_PORTHTTP server port number8080

These variables can be set either:

  • Directly via Docker command line using the -e flag
  • Or through the env configuration block in your MCP client setup

Available Tools

The ThingsBoard MCP Server provides a wide range of tools that can be used through natural language commands. These tools are organized by category.

Device Tools

ToolDescription
saveDeviceCreate or update the device object.
deleteDeviceDelete the device by id.
getDeviceByIdFetch the Device object based on the provided Device Id.
getDeviceCredentialsByDeviceIdGet device credentials by device id. If during device creation there wasn't specified any credentials, platform generates random 'ACCESS_TOKEN' credentials.
getTenantDevicesReturns a page of devices owned by tenant.
getTenantDeviceGet tenant device by name. Device name is a unique property of device.
getCustomerDevicesReturns a page of devices objects assigned to customer.
getUserDevicesReturns a page of device objects available for the current user.
getDevicesByIdsGet Devices By Ids. Requested devices must be owned by tenant or assigned to customer.
getDevicesByEntityGroupIdReturns a page of device objects that belongs to specified Entity Group Id.

Asset Tools

ToolDescription
saveAssetCreate or update the asset object.
deleteAssetDelete the asset by id.
getAssetByIdGet the Asset object based on the provided Asset Id.
getTenantAssetsReturns a page of assets owned by tenant.
getTenantAssetGet tenant asset by name. Asset name is a unique property of asset.
getCustomerAssetsReturns a page of assets objects assigned to customer.
getUserAssetsReturns a page of assets objects available for the current user.
getAssetsByIdsGet Assets By Ids. Requested assets must be owned by tenant or assigned to customer.
getAssetsByEntityGroupIdReturns a page of asset objects that belongs to specified Entity Group Id.

Customer Tools

ToolDescription
saveCustomerCreate or update the customer object.
deleteCustomerDelete the customer by id.
getCustomerByIdGet the Customer object based on the provided Customer Id.
getCustomersReturns a page of customers owned by tenant.
getTenantCustomerGet the Customer using Customer Title.
getUserCustomersReturns a page of customers available for the user.
getCustomersByEntityGroupIdReturns a page of Customer objects that belongs to specified Entity Group Id.

User Tools

ToolDescription
saveUserCreate or update the user object.
deleteUserDelete the user by id.
getUserByIdFetch the User object based on the provided User Id.
getUsersReturns a page of users owned by tenant or customer.
getTenantAdminsReturns a page of tenant administrator users assigned to the specified tenant.
getCustomerUsersReturns a page of users assigned to the specified customer.
getAllCustomerUsers (PE)Returns a page of users for the current tenant with authority 'CUSTOMER_USER'.
getUsersForAssignReturns page of user data objects that can be assigned to provided alarmId.
getUsersByEntityGroupId (PE)Returns a page of user objects that belongs to specified Entity Group Id.

Alarm Tools

ToolDescription
saveAlarmCreate or update the alarm object.
deleteAlarmDelete the alarm by id.
getAlarmByIdGet the Alarm object based on the provided alarm id.
getAlarmInfoByIdGet the Alarm info object based on the provided alarm id.
getAlarmsGet a page of alarms for the selected entity.
getAllAlarmsGet a page of alarms that belongs to the current user owner.
getHighestAlarmSeverityGet highest alarm severity by originator and optional status filters.
getAlarmTypesGet a set of unique alarm types based on alarms that are either owned by tenant or assigned to the customer.

Entity Group Tools (PE)

ToolDescription
saveEntityGroupCreate or update the entity group object.
deleteEntityGroupDelete the entity group by id.
getEntityGroupByIdFetch the Entity Group object based on the provided Entity Group Id.
getEntityGroupsByTypeFetch the list of Entity Group Info objects based on the provided Entity Type.
getEntityGroupByOwnerAndNameAndTypeFetch the Entity Group object based on the provided owner, type and name.
getEntityGroupsByOwnerAndTypeFetch the list of Entity Group Info objects based on the provided Owner Id and Entity Type.
getEntityGroupsForEntityReturns a list of groups that contain the specified Entity Id.
getEntityGroupsByIdsFetch the list of Entity Group Info objects based on the provided entity group ids list.

Relation Tools

ToolDescription
saveRelationCreate or update the relation object.
deleteRelationDelete a relation between two entities.
deleteRelationsDelete all relations (both 'from' and 'to' directions) for the specified entity within the COMMON relation group.
getRelationReturns relation object between two specified entities if present.
findByFromReturns list of relation objects for the specified entity by the 'from' direction.
findByFromWithRelationTypeReturns list of relation objects for the specified entity by the 'from' direction and relation type.
findInfoByFromReturns list of relation info objects for the specified entity by the 'from' direction.
findByToReturns list of relation objects for the specified entity by the 'to' direction.
findByToWithRelationTypeReturns list of relation objects for the specified entity by the 'to' direction and relation type.
findInfoByToReturns list of relation info objects for the specified entity by the 'to' direction.

Telemetry Tools

ToolDescription
getAttributeKeysGet all attribute keys for the specified entity.
getAttributeKeysByScopeGet all attribute keys for the specified entity and scope.
getAttributesGet attributes for the specified entity.
getAttributesByScopeGet attributes for the specified entity and scope.
getTimeseriesKeysGet all time-series keys for the specified entity.
getLatestTimeseriesGet the latest time-series values for the specified entity and keys.
getTimeseriesGet time-series data for the specified entity, keys, and time range.
saveDeviceAttributesSave device attributes.
saveEntityAttributesV1Save entity attributes (version 1).
saveEntityAttributesV2Save entity attributes (version 2).
saveEntityTelemetrySave entity telemetry data.
saveEntityTelemetryWithTTLSave entity telemetry data with time-to-live (TTL).

Entity Data Query Tools

ToolDescription
findEntityDataBySingleEntityFilterFind data for one entity by ID. Select entity fields, latest attributes/telemetry; optional key filters for expressions over fields/attributes/latest TS.
findEntityDataByEntityGroupFilter (PE)Find data for entities using an Entity Group filter (group type + id). Supports fields/latest values and optional key filters.
findEntityDataByEntityListFilterFind data for a list of entity IDs (same type). Supports fields/latest values and optional key filters.
findEntityDataByEntityNameFilterFind data by name starts-with filter (same type). Supports fields/latest values and optional key filters.
findEntityDataByEntityTypeFilterFind data by entity type (CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, EDGE, ENTITY_VIEW, etc.). Supports fields/latest values and optional key filters.
findEntityDataByEntityGroupListFilter (PE)Find data for multiple groups of the same type using group IDs. Supports fields/latest values and optional key filters.
findEntityDataByEntityGroupNameFilter (PE)Find data for groups by group type and group name starts-with. Supports fields/latest values and optional key filters.
findEntityDataByEntitiesGroupNameFilter (PE)Find data for entities that belong to a group (by type + group name). Supports fields/latest values and optional key filters.
findEntityDataByStateEntityOwnerFilterFind data for the owner (Tenant/Customer) of a specified entity. Supports fields/latest values and optional key filters.
findEntityDataByAssetTypeFilterFind assets by type and name starts-with. Supports fields/latest values and optional key filters.
findEntityDataByDeviceTypeFilterFind devices by type and name starts-with. Supports fields/latest values and optional key filters.
findEntityDataByEdgeTypeFilterFind edges by type and name starts-with. Supports fields/latest values and optional key filters.
findEntityDataByEntityViewTypeFilterFind entity views by type and name starts-with. Supports fields/latest values and optional key filters.
findEntityDataByRelationsQueryFilterFind entities related to a root entity (by relation query). Supports fields/latest values and optional key filters.
findEntityDataByAssetSearchQueryFilterFind assets related to a root entity (by relation type + allowed asset types). Supports fields/latest values and optional key filters.
findEntityDataByDeviceSearchQueryFilterFind devices related to a root entity (by relation type + allowed device types). Supports fields/latest values and optional key filters.
findEntityDataByEntityViewSearchQueryFilterFind entity views related to a root entity (by relation type + allowed view types). Supports fields/latest values and optional key filters.
findEntityDataByEdgeQueryFilterFind edges related to a root entity (by relation type + allowed edge types). Supports fields/latest values and optional key filters.

Entity Count Query Tools

ToolDescription
countBySingleEntityFilterCount results for a single entity by ID with optional key filters.
countByEntityGroupFilter (PE)Count results by Entity Group (group type + id) with optional key filters.
countByEntityListFilterCount results for a list of entity IDs (same type) with optional key filters.
countByEntityNameFilterCount results using name starts-with (same type) with optional key filters.
countByEntityTypeFilterCount results by entity type with optional key filters.
countByEntityGroupListFilter (PE)Count results for multiple groups (same type) using group IDs with optional key filters.
countByEntityGroupNameFilter (PE)Count results for groups by group type and group name starts-with with optional key filters.
countByEntitiesGroupNameFilter (PE)Count results for entities that belong to a group (by type + group name) with optional key filters.
countByStateEntityOwnerFilterCount results for owner (Tenant/Customer) of a specified entity with optional key filters.
countByAssetTypeFilterCount assets by type and name starts-with with optional key filters.
countByDeviceTypeFilterCount devices by type and name starts-with with optional key filters.
countByEdgeTypeFilterCount edges by type and name starts-with with optional key filters.
countByEntityViewTypeFilterCount entity views by type and name starts-with with optional key filters.
countByApiUsageStateFilterCount API usage rows (optionally scoped by customer) with optional key filters.
countByRelationsQueryFilterCount entities related to a root entity with optional key filters.
countByAssetSearchQueryFilterCount assets related to a root entity with optional key filters.
countByDeviceSearchQueryFilterCount devices related to a root entity with optional key filters.
countByEntityViewSearchQueryFilterCount entity views related to a root entity with optional key filters.
countByEdgeQueryFilterCount edges related to a root entity with optional key filters.

Be the First to Experience MCP Now