LoRaWAN网络管理MCP服务器

ThingPark Enterprise MCP Server 是一个将 LoRaWAN 网络设备、网关和网络运维能力开放给 AI 代理的 MCP 服务,适用于通过自然语言对话管理和监控 LoRaWAN 网络。

  • by andresmallada
  • Python
  • 混合部署
  • 更新于
在 GitHub 查看 andresmallada/actility-thingpark-mcp

使用说明

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_id and client_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 filters
  • get_device — Get device details by DevEUI or UID
  • create_device_otaa — Create a new LoRaWAN OTAA device
  • create_device_abp — Create a new LoRaWAN ABP device
  • update_device — Update an existing device
  • delete_device — Delete a device
  • get_device_frames — Get uplink/downlink frame history
  • get_device_locations — Get geolocation history
  • get_device_alarms — Get active device alarms
  • get_device_counters — Get device counts by health state
  • list_device_profiles — List available device profiles

Gateways (9)

  • list_gateways — List gateways with optional filters
  • get_gateway — Get gateway details
  • create_gateway — Create a new gateway
  • update_gateway — Update an existing gateway
  • delete_gateway — Delete a gateway
  • get_gateway_alarms — Get active gateway alarms
  • get_gateway_counters — Get gateway counts by health state
  • reboot_gateway — Full hardware reboot
  • restart_gateway — Restart LRR software only

Network (4)

  • get_all_device_frames — Get aggregated frame statistics for all devices
  • get_subscription_info — Get subscription details
  • list_connectivity_plans — List available connectivity plans
  • get_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)