feat: add MCP server for AI agent device discovery#1410
Open
feat: add MCP server for AI agent device discovery#1410
Conversation
Implement the Shifu MCP Server as specified in docs/spec/shifu_mcp_spec.md. This provides a development-time knowledge layer that lets AI coding agents (Claude Code, Cursor, etc.) discover IoT devices and understand their interaction contracts to generate correct integration code. Changes: - Extend EdgeDevice CRD with optional `description` and `connectionInfo` fields - Extend DeviceShifuInstruction with `description`, `readWrite`, and `safe` fields - Add `pkg/deviceapi/` — reusable device resolution and API library - Add `pkg/mcp/server/` — MCP adapter with list_devices and get_device_desc tools - Add `cmd/shifu-mcp-server/` — entry point with Streamable HTTP transport - Add Dockerfile and example manifests for MQTT, NATS, and HTTP devices - Add comprehensive E2E tests covering all 3 spec example devices Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1410 +/- ##
==========================================
+ Coverage 34.81% 36.66% +1.85%
==========================================
Files 54 58 +4
Lines 4027 4219 +192
==========================================
+ Hits 1402 1547 +145
- Misses 2479 2514 +35
- Partials 146 158 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Adds a standalone install manifest that deploys the Shifu MCP Server on top of an existing Shifu installation. Includes RBAC for ConfigMap read access, a Deployment using the controller SA, and a LoadBalancer Service exposing port 8443. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fixes golangci-lint unused function error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This reverts commit dc0e155.
tomqin93
reviewed
Mar 16, 2026
Comment on lines
+48
to
+59
| connectionInfo: | ||
| description: ConnectionInfo is free-form markdown describing how apps | ||
| connect to the DeviceShifu service. | ||
| type: string | ||
| customMetadata: | ||
| additionalProperties: | ||
| type: string | ||
| type: object | ||
| description: | ||
| description: Description is a free-form markdown description of the | ||
| device. | ||
| type: string |
Contributor
There was a problem hiding this comment.
need to regenerate installation script to reflect these two fields
Comment on lines
+49
to
+53
| dep := &deployments.Items[i] | ||
| if matchesDevice(dep, deviceName) { | ||
| info := &deviceDeploymentInfo{ | ||
| ServiceName: dep.Name + "." + deviceShifuNamespace + ".svc.cluster.local", | ||
| } |
Contributor
There was a problem hiding this comment.
the name of the deployment and service may not be the same. need a way to link them
Contributor
|
@jajajhhz let's add an end 2 end testing for this feature |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cmd/shifu-mcp-server/) — Streamable HTTP server exposinglist_devicesandget_device_desctools for AI coding agents to discover IoT devices and understand their interaction contractspkg/deviceapi/) — reusable Go library for EdgeDevice CR → DeviceShifu Service/ConfigMap resolution, consumable byshifuctland other toolsEdgeDeviceSpec(description,connectionInfo) and three onDeviceShifuInstruction(description,readWrite,safe), fully backward-compatibleImplements shifu_mcp_spec.md.
Key design decisions
descriptionfields instead of typedhttpSpec/mqttSpecstructs; the AI agent reads prose perfectlyreadWrite(R/W/RW) andsafe(bool) for safety classificationTest plan
go test ./pkg/deviceapi/...— 9 tests (API + ConfigMap parsing)go test ./pkg/mcp/server/...— 13 tests (unit + E2E over Streamable HTTP)claude mcp add shifu)make test) will run all tests automatically🤖 Generated with Claude Code