使用说明
ThingPark Enterprise MCP Server
An MCP server that enables conversational management of a ThingPark Enterprise LoRaWAN network through an AI agent.
Built with FastMCP and Python, it exposes 24 tools over HTTP (StreamableHTTP) that any MCP-compatible client can use — including Windsurf, Claude Desktop, n8n, and more.
Requirements
- Python 3.10+
- uv (package manager)
- A ThingPark Enterprise Service Account with
client_idandclient_secret
Installation
uv sync
Configuration
Copy .env.example to .env and fill in your values:
cp .env.example .env
THINGPARK_HOSTNAME,THINGPARK_CLIENT_ID,THINGPARK_CLIENT_SECRET— your ThingPark Enterprise Service Account.MCP_AUTH_TOKEN— bearer token required to call the server. Set this to a long random value for any non-local deployment. Leave empty only for local development.
Authentication
When MCP_AUTH_TOKEN is set, every request must include the header:
Authorization: Bearer <token>
Requests without a valid token get 401 Unauthorized. Generate a token with:
openssl rand -hex 32
Running
Local
uv run python -m src.server
Docker
docker compose up -d
Or build and run manually:
docker build -t thingpark-mcp .
docker run -d --name thingpark-mcp -p 8000:8000 --env-file .env thingpark-mcp
The MCP server starts at http://localhost:8000/mcp using StreamableHTTP transport.
Deployment
Build the image from the included Dockerfile and run it behind a reverse proxy that terminates TLS and routes to container port 8000. Provide the ThingPark credentials and MCP_AUTH_TOKEN as environment variables (never commit them). The MCP endpoint is served at /mcp.
Available Tools (24)
Devices (11)
list_devices— List devices with optional filtersget_device— Get device details by DevEUI or UIDcreate_device_otaa— Create a new LoRaWAN OTAA devicecreate_device_abp— Create a new LoRaWAN ABP deviceupdate_device— Update an existing devicedelete_device— Delete a deviceget_device_frames— Get uplink/downlink frame historyget_device_locations— Get geolocation historyget_device_alarms— Get active device alarmsget_device_counters— Get device counts by health statelist_device_profiles— List available device profiles
Gateways (9)
list_gateways— List gateways with optional filtersget_gateway— Get gateway detailscreate_gateway— Create a new gatewayupdate_gateway— Update an existing gatewaydelete_gateway— Delete a gatewayget_gateway_alarms— Get active gateway alarmsget_gateway_counters— Get gateway counts by health statereboot_gateway— Full hardware rebootrestart_gateway— Restart LRR software only
Network (4)
get_all_device_frames— Get aggregated frame statistics for all devicesget_subscription_info— Get subscription detailslist_connectivity_plans— List available connectivity plansget_network_health_summary— Get combined device + gateway health summary
Connecting from an MCP Client
{
"mcpServers": {
"thingpark": {
"serverUrl": "https://<your-domain>/mcp",
"headers": { "Authorization": "Bearer <token>" }
}
}
}
Python
from fastmcp import Client
headers = {"Authorization": "Bearer <token>"}
async with Client("https://<your-domain>/mcp", headers=headers) as client:
tools = await client.list_tools()
result = await client.call_tool("list_devices", {})
print(result)
