
Azure IoT Hub
io.github.nagarjunr由 GitHub 帳號 nagarjunr 發布v0.1.0更新於 Oct 24, 2026
MCP server for Azure IoT Hub: device registry, twins, methods, jobs, messaging.
概覽
面向 Azure IoT Hub 裝置管理的本機 MCP 伺服器,讓助理管理裝置與模組、讀寫對應項、呼叫直接方法、執行工作並傳送雲端到裝置訊息。
- 可以做什麼
- 列出、查詢、讀取、建立、更新和刪除裝置身分,刪除不可逆且需確認旗標
- 執行需求
- 以 Python 套件形式透過 uvx 在本機執行。需要在 AZURE_IOT_HUB_CONNECTION_STRING 中提供具 service 或 iothubowner 權限的 Azure IoT Hub 連接字串,並能連線至該中樞。選用 AZURE_IOT_HUB_AMQP_PORT、AZURE_IOT_HUB_AMQP_USE_TLS 與 AZURE_IOT_HUB_AMQP_HOSTNAME_OVERRIDE 可調整 AMQP 連線。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Azure IoT Hub,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Azure IoT Hub MCP Server
A Model Context Protocol (MCP) server for Azure IoT Hub — device registry, device twins, direct methods, jobs, and messaging.
Scoped to IoT Hub's service-side data plane (device management), not Azure Resource Manager. Microsoft's own official Azure MCP Server already covers the ARM-level "show me my IoT Hub resource" case — this server covers the actual device-management capability that Azure MCP doesn't.
Calls Azure IoT Hub's REST Service API directly via httpx with a hand-rolled SAS token generator, rather than the official azure-iot-hub PyPI package — that package hard-depends on uamqp, a C-extension that fails to build on modern Python/platforms (confirmed: it doesn't install on Python 3.12/arm64). Built with FastMCP.
Tools
Device registry
Modules
Device & module twins
Direct methods
Jobs (fleet-scale operations)
Messaging
Statistics
Important caveat: send_c2d_message is AMQP, not REST, and has no real-instance test coverage
Every other tool in this server wraps a documented REST endpoint. Cloud-to-device message sending is the one exception: Azure IoT Hub's REST API only exposes the feedback side of C2D messaging (delivery receipts); sending is AMQP-protocol-only (confirmed by reading the official azure-iot-hub SDK's source — it hands off to an AMQP client, not an HTTP call).
To support it without pulling in the broken uamqp dependency, send_c2d_message implements the CBS (Claims-Based Security) auth handshake and message send directly against python-qpid-proton (the standard AMQP 1.0 library, confirmed to install cleanly on modern Python). The protocol details (CBS field names, $cbs node, /messages/devicebound target address, to property format) were confirmed from Microsoft's own pure-Python AMQP implementation in azure-eventhub/azure-servicebus, not guessed.
This tool is not covered by real-instance testing. There's no free Azure IoT Hub emulator (see Testing below), and the test suite's respx HTTP mocking can't exercise AMQP at all. Tests instead run this against a local fake AMQP endpoint (also built with qpid-proton) that implements just enough of the CBS handshake and /messages/devicebound receiver to prove the wire protocol is well-formed — it does not validate genuine Azure IoT Hub business logic. Verify against a real hub before relying on this in production.
Safety conventions
Same as the rest of this repo: create_* defaults to overwrite=False (best-effort describe-then-create check — IoT Hub's If-Match header is for optimistic-concurrency on updates, not create-only semantics, so this isn't fully race-free like Ditto's If-None-Match). Every delete_*/cancel_* requires confirm=True.
Configuration
Running locally
See mcp.json for ready-to-use client configs (stdio and Docker).
Testing
This repo's design principles call for testing against a real instance rather than mocks. Azure IoT Hub has no official local emulator and no moto-equivalent exists for it. REST endpoints are tested with respx (httpx's dedicated mocking library, using realistic Azure response shapes); send_c2d_message is tested against a local fake AMQP endpoint (see caveat above).
License notes
No bundled deployment artifacts here (unlike eclipse-ditto/mqtt) since there's no local broker/service to run — Azure IoT Hub only exists as an Azure-hosted service.
來源:azure-iot-hub/README.md,提交 5a985b6
工具
0版本歷史
1- v0.1.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分