feat: add MCP server for AI agent device discovery#1418
Open
feat: add MCP server for AI agent device discovery#1418
Conversation
…eShifu instructions Add optional fields for AI agent consumption and device documentation: - EdgeDeviceSpec: description, connectionInfo (free-form markdown) - DeviceShifuInstruction: description, readWrite (R/W/RW), safe (bool) Regenerate shifu_install.yml to include new CRD fields. Update all existing device examples with the new metadata fields. Add mcp-demo example YAMLs showcasing full field usage. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cover the Description and ConnectionInfo deepcopy paths in zz_generated.deepcopy.go to satisfy codecov patch coverage. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
aecf8c8 to
bbc8f9e
Compare
…rite, rename safe, move connectionInfo Address @tomqin93's review comments on PR #1417: 1. Remove unused argumentPropertyList (DeviceShifuInstructionProperty) — was only used for logging. Fix nil pointer bug in MQTT config exposed by removal. 2. Make ReadWrite a typed enum (ReadWriteMode) with R/W/RW constants. 3. Replace ambiguous `safe` bool with `hasSideEffects` (bool) + `riskLevel` enum (RequireAttention, RequireConfirmation, RequireManagerConsent). 4. Move connectionInfo from EdgeDevice CRD to ConfigMap — non-HTTP protocols (MQTT, NATS) need broker/connection info that instructions alone don't convey. Regenerated CRD manifests and shifu_install.yml. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ction fields Address follow-up review: - Move connectionInfo back to EdgeDevice CRD (endpoint URLs are per-device, can't be shared via ConfigMap). Strip device-specific URLs from content — only protocol-level connection patterns (auth, QoS, encoding). - Remove hasSideEffects and riskLevel from DeviceShifuInstruction — safety can be inferred from ReadWrite mode + description. Keep only ReadWrite (typed enum) and Description. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update spec to reflect: - connectionInfo stays on EdgeDevice CRD, no device-specific URLs - Remove safe/hasSideEffects/riskLevel — safety inferred from readWrite + description - Remove argumentPropertyList references - ReadWrite is now a typed enum (ReadWriteMode) - Update all JSON response examples and YAML examples Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add Streamable HTTP MCP server exposing list_devices and get_device_desc tools for AI coding agents to discover IoT devices and understand their interaction contracts. Components: - pkg/deviceapi/ — reusable Go library for EdgeDevice CR, Deployment, Service, and ConfigMap resolution - pkg/mcp/server/ — MCP server implementation with 22 tests - cmd/shifu-mcp-server/ — binary entry point - dockerfiles/Dockerfile.mcpServer — container image Fix service name resolution: use label-selector-based Service lookup instead of assuming deployment name equals service name. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove Safe field from Interaction type and all test assertions. Cast ReadWriteMode to string in configmap parser. Update all test ConfigMap YAML fixtures to remove safe: fields. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
bbc8f9e to
6ddf494
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1418 +/- ##
==========================================
+ Coverage 34.81% 37.20% +2.38%
==========================================
Files 54 58 +4
Lines 4027 4231 +204
==========================================
+ Hits 1402 1574 +172
- Misses 2479 2489 +10
- Partials 146 168 +22 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
pkg/mcp/server/) — Streamable HTTP server exposinglist_devicesandget_device_desctools for AI agents to discover IoT devices and their interaction contractspkg/deviceapi/) — reusable Go library for EdgeDevice CR → Service/ConfigMap resolutionDepends on #1417 (CRD field additions). Will retarget to
mainafter #1417 merges.Key changes from original #1410
findServiceForDeployment()matches Service selectors against Deployment pod template labelsTest plan
go test ./pkg/deviceapi/...— 9 tests pass (API + ConfigMap parsing + service resolution)go test ./pkg/mcp/server/...— 13 tests pass (unit + E2E over Streamable HTTP)-deploymentsuffix)🤖 Generated with Claude Code