REST + MCP parallel surfaces (no shared code) #13

Closed
opened 2026-06-23 08:08:15 +00:00 by sscoble · 1 comment
Owner

Why

Two surfaces, parallel, no shared code (posts#1, Q10). REST for web/bridge. MCP for agents. The canonical contract is the event payload, not the transport.

Files

  • api/rest.go (refactor — split handlers out of handler.go; pure HTTP)
  • mcp/server.go (new — MCP server)
  • mcp/tools_*.go (one file per tool: mcp__posts__create_post, add_comment, get_post, list_posts, add_channel, add_mention, mark_seen)
  • cmd/posts/main.go (update — run REST and MCP servers in same process, on different ports)

Ports

  • REST: :8310 (existing, per go-htmx-web-dev skill port list)
  • MCP: :8320 (next free)

Tool surface

MCP tool REST equivalent
mcp__posts__create_post(title, body, channels) POST /api/posts
mcp__posts__add_comment(post_id, parent_id, body) POST /api/posts/:id/comments
mcp__posts__get_post(id) GET /api/posts/:id
mcp__posts__list_posts(channel, limit, before) GET /api/posts
mcp__posts__add_channel(slug, name, description) POST /api/channels
mcp__posts__add_mention(post_id, comment_id, mentioned) POST /api/mentions
mcp__posts__mark_seen(post_id) POST /api/posts/:id/seen

Acceptance

  • Both surfaces serve the same logical API
  • Tests exist for each tool and each endpoint
  • Either surface can be removed without breaking the other
  • The store is the only thing they share
  • mcp__posts__* tools are discoverable by Hermes (test: connect via mcp client, list tools, call one)
## Why Two surfaces, parallel, no shared code (posts#1, Q10). REST for web/bridge. MCP for agents. The canonical contract is the event payload, not the transport. ## Files - `api/rest.go` (refactor — split handlers out of handler.go; pure HTTP) - `mcp/server.go` (new — MCP server) - `mcp/tools_*.go` (one file per tool: `mcp__posts__create_post`, `add_comment`, `get_post`, `list_posts`, `add_channel`, `add_mention`, `mark_seen`) - `cmd/posts/main.go` (update — run REST and MCP servers in same process, on different ports) ## Ports - REST: `:8310` (existing, per go-htmx-web-dev skill port list) - MCP: `:8320` (next free) ## Tool surface | MCP tool | REST equivalent | |---|---| | `mcp__posts__create_post(title, body, channels)` | `POST /api/posts` | | `mcp__posts__add_comment(post_id, parent_id, body)` | `POST /api/posts/:id/comments` | | `mcp__posts__get_post(id)` | `GET /api/posts/:id` | | `mcp__posts__list_posts(channel, limit, before)` | `GET /api/posts` | | `mcp__posts__add_channel(slug, name, description)` | `POST /api/channels` | | `mcp__posts__add_mention(post_id, comment_id, mentioned)` | `POST /api/mentions` | | `mcp__posts__mark_seen(post_id)` | `POST /api/posts/:id/seen` | ## Acceptance - Both surfaces serve the same logical API - Tests exist for each tool and each endpoint - Either surface can be removed without breaking the other - The store is the only thing they share - `mcp__posts__*` tools are discoverable by Hermes (test: connect via mcp client, list tools, call one)
sscoble added the
area/api
area/bridge
kind/feature
prio/p1
labels 2026-06-23 08:08:15 +00:00

✅ Acceptance Verification — c2326 (2026-07-30)

Cycle: c2326 cron dispatch closure check
Verdict: PASS — implementation complete, all tests pass.

REST + MCP parallel surfaces — mcp_mux.go implements MCP JSON-RPC 2.0 transport with no shared code to REST handlers. parallel_test.go: 13/13 tests PASS including TestParallel_NoSharedHandlerCode, TestParallel_RESTWithoutMCP, TestParallel_MCPWithoutREST. Implementation complete.

Closing as complete.

## ✅ Acceptance Verification — c2326 (2026-07-30) **Cycle:** c2326 cron dispatch closure check **Verdict:** PASS — implementation complete, all tests pass. REST + MCP parallel surfaces — mcp_mux.go implements MCP JSON-RPC 2.0 transport with no shared code to REST handlers. parallel_test.go: 13/13 tests PASS including TestParallel_NoSharedHandlerCode, TestParallel_RESTWithoutMCP, TestParallel_MCPWithoutREST. Implementation complete. Closing as complete.
Sign in to join this conversation.
No description provided.