Skip to content

Replace SSE with REST API for web UI - #14

Merged
aniongithub merged 2 commits into
mainfrom
refactor/strip-sse
May 4, 2026
Merged

Replace SSE with REST API for web UI#14
aniongithub merged 2 commits into
mainfrom
refactor/strip-sse

Conversation

@aniongithub

Copy link
Copy Markdown
Owner

Summary

Replace MCP-over-SSE with a plain REST API for the web UI. Agents use stdio, browsers use REST.

What changed

Server (cmd/mind-map/main.go)

  • Removed mcp.NewSSEHandler and /mcp endpoint
  • Added REST endpoints:
    • GET /api/context -- wiki overview
    • GET /api/pages?prefix=... -- list pages
    • GET /api/pages/{path} -- get page
    • POST /api/pages -- create page
    • PUT /api/pages/{path} -- update page
    • DELETE /api/pages/{path} -- delete page
    • GET /api/search?q=... -- full-text search
    • GET /api/backlinks/{path} -- backlinks
  • go-sdk/mcp import now only used for stdio transport

Web UI (webui/src/mcp.ts)

  • Rewrote from SSE/JSON-RPC client (EventSource, session handshake, pending request map, reconnect logic) to plain fetch() REST calls
  • Dropped from 154 lines to 85 lines

Architecture

Transport Users Protocol
stdio Agents (Copilot, Claude, etc.) MCP JSON-RPC
HTTP Web UI (browser) REST

Why

  • SSE required multi-step handshake (EventSource -> session endpoint -> JSON-RPC POST) that smaller models struggled with
  • stdio is more reliable for agent use and is natively supported by all MCP clients
  • REST is simpler for the web UI -- no reconnection logic, no session state, no protocol negotiation
  • Reduced web UI bundle size

Testing

  • go vet clean
  • All Go tests pass
  • WebUI builds successfully

Remove MCP-over-SSE from the HTTP server. The serve command is now a
plain HTTP server with REST endpoints for the web UI:

  GET    /api/context          - wiki overview
  GET    /api/pages?prefix=... - list pages
  GET    /api/pages/{path}     - get page
  POST   /api/pages            - create page
  PUT    /api/pages/{path}     - update page
  DELETE /api/pages/{path}     - delete page
  GET    /api/search?q=...     - full-text search
  GET    /api/backlinks/{path} - get backlinks

Web UI client rewritten from SSE/JSON-RPC MCPClient (EventSource,
session handshake, pending request map) to plain fetch() REST calls.
No more reconnection logic, session management, or protocol
negotiation.

Agents use stdio (mind-map with no args). The go-sdk/mcp import
is now only used by the stdio transport in runStdio.
README: rewrite architecture section to show stdio for agents, REST
for web UI. Remove all SSE/MCP-over-HTTP references. Update diagram,
mode table, MCP client config (now just {command: mind-map}), and
feature list (SQLite locking, git sync).

install.sh: remove USE_SSE flag and SSE MCP config. Always configure
clients with stdio ({command: mind-map}). Service is HTTP-only for
web UI. Remove MCP endpoint from service output.

install.ps1: same changes as install.sh for Windows.
@aniongithub
aniongithub merged commit 12ba927 into main May 4, 2026
1 check passed
@aniongithub
aniongithub deleted the refactor/strip-sse branch May 4, 2026 07:03
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