Sign inSign up

allexd2010/thingsboard-mcp

By allexd2010

•Updated about 1 year ago

ThingsBoard MCP Server

Image
0

96

allexd2010/thingsboard-mcp repository overview

ā šŸš€ ThingsBoard MCP Server

Docker Pulls Docker Stars Docker Image Size License

Asynchronous MCP (Model Context Protocol) server for ThingsBoard API integration

ā šŸ“‹ Description

ThingsBoard MCP Server provides a comprehensive set of tools for working with ThingsBoard through the MCP protocol. The server supports all major operations with devices, assets, telemetry, alarms, and other ThingsBoard components.

⁠✨ Key Features
  • šŸ”§ 40+ MCP tools for ThingsBoard operations
  • šŸš€ Asynchronous architecture for high performance
  • šŸ“Š Real-time monitoring and telemetry
  • šŸ”” Alarm and notification management
  • šŸ“ˆ Data visualization and dashboards
  • šŸ” Security and authentication
  • 🐳 Ready-to-use Docker image for quick deployment

ā šŸ—ļø Architecture

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”    ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”    ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│   Cursor IDE    │    │  MCP Server      │    │  ThingsBoard    │
│   (Client)      │◄──►│  (FastMCP)       │◄──►│  (API Server)   │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜    ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜    ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                              │
                              ā–¼
                       ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
                       │  Tool Registry   │
                       │  (Categories)    │
                       ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

ā šŸš€ Quick Start

⁠1. Running with Docker Compose
# docker-compose.yml
version: '3.8'
services:
  thingsboard-mcp:
    image: allexd2010/thingsboard-mcp:latest
    container_name: thingsboard-mcp
    environment:
      TB_HOST: your-thingsboard-host
      TB_PORT: 9090
      TB_USERNAME: [email protected]
      TB_PASSWORD: yourpassword
      TB_SSL: false
      TB_TIMEOUT: 30
      FASTMCP_HOST: 0.0.0.0
      FASTMCP_PORT: 8000
      FASTMCP_LOG_LEVEL: INFO
    ports:
      - "8000:8000"
    restart: unless-stopped
⁠2. Running with Docker
docker run -d \
  --name thingsboard-mcp \
  -p 8000:8000 \
  -e TB_HOST=your-thingsboard-host \
  -e TB_PORT=9090 \
  -e [email protected] \
  -e TB_PASSWORD=yourpassword \
  -e FASTMCP_HOST=0.0.0.0 \
  -e FASTMCP_PORT=8000 \
  allexd2010/thingsboard-mcp:latest
⁠3. Verifying Operation
# Check status
docker ps

# View logs
docker logs thingsboard-mcp

# Test availability
curl http://localhost:8000/sse

ā šŸ”§ Configuration

⁠Environment Variables
VariableDescriptionDefault Value
TB_HOSTThingsBoard hostlocalhost
TB_PORTThingsBoard port9090
TB_USERNAMEUsername[email protected]
TB_PASSWORDPasswordtenant
TB_SSLUse SSL connectionfalse
TB_TIMEOUTConnection timeout30
FASTMCP_HOSTMCP server host0.0.0.0
FASTMCP_PORTMCP server port8000
FASTMCP_LOG_LEVELLogging levelINFO
⁠Configuration Examples
⁠Local ThingsBoard
docker run -d \
  --name thingsboard-mcp \
  -p 8000:8000 \
  -e TB_HOST=localhost \
  -e TB_PORT=9090 \
  -e [email protected] \
  -e TB_PASSWORD=tenant \
  allexd2010/thingsboard-mcp:latest
⁠ThingsBoard Cloud
docker run -d \
  --name thingsboard-mcp \
  -p 8000:8000 \
  -e TB_HOST=demo.thingsboard.io \
  -e TB_PORT=443 \
  -e [email protected] \
  -e TB_PASSWORD=yourpassword \
  -e TB_SSL=true \
  allexd2010/thingsboard-mcp:latest

ā šŸ› ļø MCP Tools

ā šŸ“‚ Tool Categories
ā šŸ”§ Entities
  • Devices - create, update, delete devices
  • Assets - manage assets and their properties
  • Customers - work with ThingsBoard customers
  • Users - manage users and roles
ā šŸ“Š Data
  • Telemetry - receive and send telemetry data
  • Attributes - work with device and asset attributes
  • Events - process events and notifications
ā šŸ”” Monitoring
  • Alarms - create and manage alarms
  • Notifications - notification system
  • Audit - audit and security logs
ā šŸ“ˆ Visualization
  • Dashboards - create and manage dashboards
  • Widgets - configure widgets and charts
  • Reports - generate reports
ā āš™ļø System
  • Rules - rule chains and data processing
  • Profiles - device and asset profiles
  • Configuration - system settings
ā šŸ“‹ Available Tools List
# Get categories list
docker exec thingsboard-mcp python src/app.py --list-categories

# Get services list
docker exec thingsboard-mcp python src/app.py --list-services

# Run with specific categories
docker exec thingsboard-mcp python src/app.py --categories entities monitoring

ā šŸ” Diagnostics

⁠Status Check
# Container status
docker ps thingsboard-mcp

# Server logs
docker logs thingsboard-mcp

# Environment variables
docker exec thingsboard-mcp env | grep -E "(TB_|FASTMCP_)"

# Test ThingsBoard connection
docker exec thingsboard-mcp curl -I http://$TB_HOST:$TB_PORT
⁠Monitoring
# Real-time logs
docker logs -f thingsboard-mcp

# Resource usage
docker stats thingsboard-mcp

# Error search
docker logs thingsboard-mcp | grep -i error

⁠🐳 Docker Images

⁠Available Tags
TagDescription
latestLatest stable version
1.0Version 1.0
devDevelopment version
⁠Image Sizes
  • Base image: python:3.11-slim
  • Final size: ~200MB
  • Layers: Optimized for caching
⁠Security
  • āœ… Non-root user in container
  • āœ… Minimal permissions
  • āœ… Vulnerability scanning
  • āœ… Regular updates

ā šŸ“š Usage Examples

⁠Cursor IDE Integration
  1. MCP Configuration in Cursor
// mcp-config.json
{
  "mcpServers": {
    "thingsboard-mcp": {
      "command": "docker",
      "args": ["exec", "-i", "thingsboard-mcp", "python", "src/app.py", "--categories", "monitoring"],
      "env": {
        "PYTHONPATH": "/app"
      }
    }
  }
}
  1. Usage in Chat
User: "Show all devices"
Cursor: [Uses MCP tool to get device list]

User: "Create new device named 'Sensor001'"
Cursor: [Uses MCP tool to create device]

Tag summary

Content type

Image

Digest

sha256:aba883f4d…

Size

142.9 MB

Last updated

about 1 year ago

docker pull allexd2010/thingsboard-mcp:1.0