feat: add MCP server config, session labels, and HTTP tools#629
feat: add MCP server config, session labels, and HTTP tools#629jeremyeder wants to merge 6 commits intoambient-code:mainfrom
Conversation
Add four new features to the platform UI and backend: - Session labels: editable labels on AgenticSessions with backend support for PATCH via the operator - MCP server config: per-project MCP server configuration stored in the ambient-mcp-config ConfigMap (mcp.json key) - HTTP tools: per-project HTTP tool definitions stored in the same ConfigMap (http-tools.json key) - Workflow designer: visual node-based workflow editor using ReactFlow Backend ConfigMap handlers are deduplicated via shared getConfigMapKey and updateConfigMapKey helpers. Frontend API routes use a shared createProxyRouteHandlers factory to eliminate duplication. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Backend: add POST /projects/:projectName/mcp-config/test endpoint that
spawns a temporary Pod using the runner image to perform an MCP protocol
handshake (initialize + initialized notification) and reports server
info on success or error details on failure. Pod is cleaned up via
deferred delete.
Frontend:
- Add Test Connection button in the MCP server dialog that gates Save
on a successful test. Shows spinner during test, green check on
success with server name/version, red X on failure with error. Any
config field change resets test status.
- Add Test action to per-server dropdown menu (results via toast).
- Add Import button accepting Claude Code .mcp.json format
({"mcpServers": {...}}) and native format ({"servers": {...}}).
Merges imported servers into existing config.
- Add Export button producing Claude Code-compatible JSON download.
New files:
- components/backend/handlers/mcp_test_server.go
- components/frontend/src/app/api/projects/[name]/mcp-config/test/route.ts
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Backend: - Use io.ReadAll instead of fixed-size buffer for pod log reading, preventing partial reads from truncating JSON output - Remove duplicate env var injection — user env vars are already passed via MCP_TEST_ENV JSON and applied by the Python script; injecting them directly as container env vars was redundant and could collide with test script vars - Add resource limits (500m CPU / 256Mi memory) to test pod to prevent misbehaving MCP servers from consuming unbounded resources Frontend: - Simplify handleExport to use servers object directly instead of reconstructing it field-by-field (McpServerConfig already matches the Claude Code format) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Import now auto-detects three formats by top-level key:
- Claude Code / Desktop: {"mcpServers": {"name": {command, args, env}}}
- Native: {"servers": {"name": {command, args, env}}}
- OpenCode: {"mcp": {"name": {type, command: [...], environment}}}
OpenCode uses a single command array instead of separate command/args
fields, and "environment" instead of "env". The toInternal() converter
handles this transparently.
Export now offers a format dropdown (Claude Code / OpenCode) instead
of a single button. Claude Code export produces .mcp.json compatible
with Claude Code, Claude Desktop, and project .mcp.json files.
OpenCode export produces opencode.json with the {type, command[],
environment} shape.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove the workflow designer UI (16 files), @xyflow/react dependency, and navigation link. This feature will be developed separately. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
Address code review findings from PR ambient-code#629: - Add SecurityContext (drop ALL caps, no privilege escalation) to MCP test pods - Add command allowlist validation to prevent arbitrary command execution - Add truncated raw data preview to JSON parse error logs - Add loading/error states to MCP servers and HTTP tools tabs - Log non-NotFound errors when fetching MCP ConfigMap in operator Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Claude Code ReviewSummaryThis PR adds MCP (Model Context Protocol) server configuration, session labels, and HTTP tools management to the Ambient Code Platform. The implementation spans backend API handlers, frontend React components, and operator integration. Overall code quality is good with strong adherence to established patterns, but there are several security and architecture concerns that should be addressed. Issues by Severity🚫 Blocker IssuesNone identified - No critical blockers that prevent merge. 🔴 Critical Issues
🟡 Major Issues
🔵 Minor Issues
Positive Highlights✅ Excellent User Token Authentication - All backend handlers correctly use ✅ SecurityContext Properly Set - MCP test pods have restrictive security settings (mcp_test_server.go:217-223) ✅ Clean React Query Integration - Frontend hooks follow established patterns (use-mcp-config.ts, use-http-tools.ts) ✅ Good Error Handling in Frontend - Skeleton loading states and error alerts implemented (mcp-servers-tab.tsx:177-196) ✅ Operator Integration Well-Designed - ConfigMap mount is optional and non-breaking (sessions.go:1228-1245) ✅ Export/Import Feature - Excellent UX for Claude Desktop and OpenCode format compatibility (mcp-servers-tab.tsx:134-175) ✅ Proper OwnerReferences Pattern - Although not shown in this PR, existing operator code follows best practices RecommendationsHigh Priority (Address Before Merge)
Medium Priority (Address in Follow-up PR)
Low Priority (Nice to Have)
Testing Verification NeededBefore merge, please verify:
Overall AssessmentCode Quality: 7.5/10
Security: 6/10
Performance: 8/10
Recommendation: Approve with changes - Address critical security issues (#1, #2) before merge. Other issues can be addressed in follow-up PRs. Generated by Claude Code Review - Loaded context: CLAUDE.md, backend-development.md, frontend-development.md, security-standards.md, k8s-client-usage.md, error-handling.md, react-query-usage.md 🔍 View AI decision process (logs available for 90 days) 📋 View memory system files loaded (click to expand)What Amber Loaded for Code ReviewAmber automatically loaded these repository standards from the memory system:
Impact: This review used your repository's specific code quality standards, security patterns, and best practices from the memory system (PRs #359, #360) - not just generic code review guidelines. |
Summary
Test plan
🤖 Generated with Claude Code