Files
Maven/docs/plans/06-mcp-support.md
T
kami 5fe8f228c1 feat(mavweb): /ecosystem page consuming Nexus/Praxis/Hexis + shell fixes
Add a read-only /ecosystem page that consumes the sibling services'
JSON APIs (Nexus entities, Praxis attention, Hexis capabilities),
fetched concurrently with honest per-panel error states. Siblings stay
headless — mavweb is their human surface (arch §16). Wired via mavweb
-nexus/-praxis/-hexis flags; mavweb joins the ecosystem compose network.

Fix mobile horizontal overflow across all pages: .content is a flex
child with default min-width:auto, so it refused to shrink below the
tables' intrinsic width. min-width:0 lets wide tables pan inside .scroll
instead of dragging the page sideways. Verified via CDP geometry check
(scrollWidth === clientWidth at 430px).

Also includes in-progress Ethos UI redesign, ecosystem deploy compose,
and planning docs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-19 22:04:23 +04:00

30 lines
2.3 KiB
Markdown

# Plan: MCP (Model Context Protocol) Integration
**Goal:** Maven acts as an MCP host — she can connect to external MCP servers (tools, data sources, file systems) via the Model Context Protocol, and expose those capabilities as tool verbs in her allowlist, or use them as context sources for routing/phrasing.
**Done when:**
- `internal/mcp/` package implements an MCP client — connects to MCP servers over stdio or TCP, negotiates protocol version, discovers tools/resources
- MCP-discovered tools are registered as proposed tools (`ProposeTool`) in the store
- User enables them on mavweb (existing `EnableTool` flow)
- MCP resource contents are available as context for the router's `LLMRouter` or the phraser's prompts
- Multiple MCP servers can be configured in `deploy/mavend.json`
- MCP connections are managed (reconnect on drop, timeout, graceful shutdown)
**Scope:**
- New `internal/mcp/` package — protocol client (`github.com/mark3labs/mcp-go` or raw JSON-RPC over stdio/TCP)
- New `cmd/mcphost/` or built into `cmd/mavend/` — MCP server manager goroutine
- Config extension: `mcp_servers` array in `config.Config``{name, command, args, env, enabled}`
- IPC extension: `MethodListMCPTools`, `MethodListMCPResources`, `MethodCallMCPTool`
- Reuses `internal/tool/Executor` and `internal/router` seams
**Steps:**
1. Research MCP protocol spec and pick a Go client library (`github.com/mark3labs/mcp-go` exists as of 2025, or implement raw JSON-RPC 2.0 over stdio/TCP)
2. Create `internal/mcp/client.go``Client` struct handling stdio subprocess lifecycle: spawn, negotiate protocol version (`initialize` handshake), `ListTools`, `CallTool`
3. Create `internal/mcp/manager.go``Manager` that reads `mcp_servers` config, starts/stops per-server clients, exposes a consolidated tool list
4. Wire MCP-discovered tools into `ProposeTool` (same flow as `cmd/mavend/voice.go:proposeGap`)
5. Add resource content fetching — `ReadResource` returns text content that can be injected into LLM prompts
6. Add IPC methods `MethodListMCPTools`, `MethodListMCPResources`, `MethodCallMCPTool` to `internal/ipc/api.go`
7. Expose MCP tools in mavweb UI — new `/tools/mcp` page
8. Add `mcp_servers` block to `config.Config` and `deploy/mavend.json`
9. Test with a local MCP demo server (e.g., `mcp-server-sqlite` or a custom echo server)