Skip to content

Add Go wiki engine core with MCP interface and Preact web UI#1

Merged
aniongithub merged 20 commits into
mainfrom
aniongithub/mind-map-go-core
Apr 27, 2026
Merged

Add Go wiki engine core with MCP interface and Preact web UI#1
aniongithub merged 20 commits into
mainfrom
aniongithub/mind-map-go-core

Conversation

@aniongithub
Copy link
Copy Markdown
Owner

mind-map: Go wiki engine with MCP interface

A wiki that stores pages as markdown files, indexes them with SQLite FTS5, and exposes everything via MCP over HTTP/SSE. AI agents and humans use the same protocol.

What's included

Wiki engine (internal/wiki/)

  • Page CRUD on markdown filesystem
  • YAML frontmatter parsing via goldmark
  • Wikilink extraction and backlink index
  • Full-text search via SQLite FTS5
  • Concurrent-safe with sync.RWMutex

MCP tools (internal/mcp/)

  • 8 tools: search_pages, get_wiki_context, get_page, create_page, update_page, delete_page, list_pages, get_backlinks
  • Official Go MCP SDK (modelcontextprotocol/go-sdk v1.5.0)
  • HTTP/SSE + stdio transports — same server, zero divergence

Preact web UI (webui/)

  • Metro-inspired chromeless design (matching zeropoint-agent)
  • MCP client over SSE — same protocol agents use
  • Sidebar page list, search, markdown rendering, wikilinks, backlinks, edit mode
  • Dark/light theme toggle

Dev environment

  • Devcontainer with Go 1.26 + Node
  • VS Code tasks, launch configs, compound "mind-map + WebUI" launch
  • 19 passing tests (10 wiki engine + 9 MCP end-to-end via InMemoryTransport)

Architecture

        ┌──────────────────┐    ┌──────────────────┐
        │  Preact Web App  │    │   AI Agent       │
        │  (humans)        │    │  (Claude, etc)   │
        └────────┬─────────┘    └────────┬─────────┘
                 │                       │
                 └───────────┬───────────┘
                             │
                      MCP over HTTP/SSE
                             │
                 ┌───────────┴───────────┐
                 │    mind-map serve     │
                 │   (Go MCP server)    │
                 │   wiki engine inside │
                 └───────────────────────┘

- Devcontainer with Go 1.26 + Node for development
- Wiki engine (internal/wiki/): pages as markdown files, SQLite FTS5
  search, YAML frontmatter parsing, wikilink extraction, backlink index
- Page CRUD: Create, Read, Update, Delete with concurrent-safe RWMutex
- Cobra CLI scaffold with 'serve' subcommand
- 10 passing tests covering all wiki operations
- 8 MCP tools wrapping wiki engine: search_pages, get_wiki_context,
  get_page, create_page, update_page, delete_page, list_pages,
  get_backlinks
- Uses official Go MCP SDK (modelcontextprotocol/go-sdk v1.5.0)
- Typed input structs with jsonschema tags for auto-generated schemas
- serve --stdio mode functional for single-agent MCP use
- serve --addr placeholder for HTTP/SSE mode (next step)
- tasks.json: Build, Test, Test (wiki only), Tidy
- launch.json: Serve (stdio), Serve (HTTP), Test (all) with debugger
- devcontainer.json: Go extensions, test explorer, YAML/ESLint/Prettier
- All configs include sqlite_fts5 build tag and CGO_ENABLED=1
The go-sdk jsonschema tag is a plain description string, not key=value format.
- SSE endpoint at /mcp using official go-sdk SSEHandler
- Graceful shutdown on SIGINT
- Add testdata/ with sample wiki pages for debug launches
- Both transports (stdio and HTTP/SSE) share the same server and tools
9 MCP tests using the SDK's InMemoryTransport — no stdio, no HTTP,
pure in-process MCP protocol: client calls tool, server handles,
result verified. Tests cover all 8 tools: list_tools, get_wiki_context,
get_page, search_pages, get_backlinks, list_pages, create_page,
update_page, delete_page.
- Preact + TypeScript + webpack, same tooling as zeropoint-agent
- MCP client over SSE (mcp.ts) — talks to /mcp endpoint
- Wiki UI: sidebar page list, search, markdown rendering, wikilinks,
  backlinks, edit mode with raw markdown textarea
- Metro design: chromeless, Inter font, flat UI, dark/light toggle
- Go server serves webui/dist/ at / and MCP SSE at /mcp
- VS Code: compound launch (server + Chrome), build-webui task,
  watch-webui task, waitForServer prereq
- devcontainer: port 8080 forwarded, postAttachCommand installs deps
dlv launches from cmd/mind-map/, so relative 'webui/dist' didn't resolve.
Added --webui flag (default: webui/dist) and launch configs pass the
absolute workspace path.
- ci.yml: builds webui + runs Go tests in devcontainer on PRs/pushes
- release.yml: cross-compiles for linux-x64, linux-arm64, darwin-x64,
  darwin-arm64 on GitHub release creation. Builds webui first.
- install.sh: curl|bash installer matching devcontainer-mcp's pattern.
  Downloads binary, configures MCP clients (Copilot, VS Code, Cursor,
  Claude Code)
- install.ps1: Windows installer that installs binary inside WSL and
  configures Windows-side MCP clients with WSL bridge (command: wsl)
- install.sh: added --skip-mcp-config flag (used by install.ps1 to
  skip Linux-side MCP config since Windows-side config uses wsl bridge)
- release.yml: uploads both install.sh and install.ps1
Port fixes from devcontainer-mcp:
- Filter out docker-desktop* distros (minimal, can't run binaries)
- If one usable distro, use it automatically
- If multiple, prompt user to select
- Use 'wsl -d $distro bash -c' instead of 'wsl -e /bin/bash -c'
Full documentation: problem/solution, quick install, architecture diagram,
MCP tools table, wiki features, web UI description, page format example,
MCP client config for Linux/macOS/Windows, development guide with
devcontainer commands and VS Code launch configs.
@aniongithub aniongithub merged commit a714d41 into main Apr 27, 2026
1 check passed
@aniongithub aniongithub deleted the aniongithub/mind-map-go-core branch April 27, 2026 05:30
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