Skip to content

feat(go): full endpoint editability via MCP, with validation - #238

Merged
rado0x54 merged 3 commits into
go-backendfrom
go-mcp-endpoint-validation
Jul 12, 2026
Merged

feat(go): full endpoint editability via MCP, with validation#238
rado0x54 merged 3 commits into
go-backendfrom
go-mcp-endpoint-validation

Conversation

@rado0x54

@rado0x54 rado0x54 commented Jul 12, 2026

Copy link
Copy Markdown
Owner

What

Makes shellwatch_manage_endpoints create/update accept every REST-editable field — userVerification, agentForward, label, host, port, username, description — with proper validation, in both backends. Full endpoint editability via MCP is the intended contract; the tool schema silently stripping userVerification/agentForward was a bug, not the spec.

Go changes

  • internal/agent/session.goUpdateEndpoint now takes a typed EndpointPatch (nil = keep, DescriptionSet tri-state for null-clears) instead of map[string]any, keeping MCP wire shape out of the session-isolation type.
  • internal/mcp/tools_endpoints.go — new endpointPatchFromWire decode/validate layer (the zod equivalent): userVerification enum, agentForward boolean, description ≤1000 chars or null, field type checks. Tool data input schema now declares the properties (incl. the enum) so agents can discover them.
  • Create parity fix — MCP create previously inserted agentForward=false; it now defaults true like the Node repo and REST. Explicit userVerification/agentForward on create are honored (validated), defaults unchanged (required/true/port 22).

Node changes

  • src/mcp/tools/endpoints.ts — the zod data schema gains userVerification (enum) and agentForward (boolean); create passes them through (repo defaults required/true still apply when absent). Update needed no repo changes — the repository already accepted the fields; only the tool schema stripped them.

Docs

  • docs/api/mcp-tools.md documents the full data shape, create defaults, and validation-rejects behavior.
  • docs/api/README.md item C notes the former stripping as a resolved bug in both backends.

Tests

  • internal/mcp/tools_endpoints_test.go — decode/validation unit tests (valid full patch, null-clear, enum/type/length rejections).
  • internal/agent/session_endpoint_test.go — typed patch merge incl. userVerification + description set/clear.
  • internal/httpserver/mcp_test.go::TestMCPEndpointFullEdit — Go end-to-end over the real streamable-HTTP transport: create with non-default fields, update them, invalid enum rejected without mutating the row, create defaults verified.
  • src/mcp/server.test.ts — Node end-to-end: create/update with the new fields, read-back, invalid enum rejected without writing.

go vet ./..., go test ./..., pnpm typecheck, pnpm lint (changed files), pnpm vitest run src/mcp/server.test.ts, pnpm spdx:check all pass; mcp-* goldens untouched (create/update were never golden-pinned).

rado0x54 added 3 commits July 12, 2026 11:13
…endpoints create/update accept userVerification/agentForward (Node's schema stripped them); typed EndpointPatch replaces map[string]any; enum/bool/description-cap validation; create now defaults agentForward=true (Node repo parity)
… too — zod schema no longer strips them; both backends now match the full-editability contract
@rado0x54
rado0x54 merged commit d0b8fcb into go-backend Jul 12, 2026
20 checks passed
@rado0x54
rado0x54 deleted the go-mcp-endpoint-validation branch July 12, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant