Skip to content

feat(mcp): expose the frozen 6 tools locally - stdio + daemon /mcp (M3)#219

Merged
vreshch merged 2 commits into
masterfrom
feature/m3-local-mcp
Jul 6, 2026
Merged

feat(mcp): expose the frozen 6 tools locally - stdio + daemon /mcp (M3)#219
vreshch merged 2 commits into
masterfrom
feature/m3-local-mcp

Conversation

@vreshch

@vreshch vreshch commented Jul 6, 2026

Copy link
Copy Markdown
Member

M3 - Local MCP exposure

Exposes the frozen 6-tool MCP contract (memory__search/read/list/write/edit/delete) to on-machine AI clients over two transports, both over the same local engine the CLI verbs and daemon already use:

  • agentage mcp - stdio MCP server (for clients that spawn a process: Cursor, Windsurf, Zed).
  • POST /mcp on the daemon - stateless Streamable HTTP (JSON), for clients that connect to a URL. Localhost only, no auth (same loopback trust as the rest of the daemon). GET/DELETE /mcp return 405.

Contract fidelity - wrap, don't copy

The contract layer is reused verbatim from @agentage/server-memory@^0.0.2 (MIT): createLocalMemoryServer wraps its exported createMemoryServer builder, so tool names, descriptions, inputSchema, annotations, per-connection instructions and dual-channel output (content[].text rendered markdown plus structuredContent) are byte-identical by construction - zero drift. A CI contract test builds the local server and diffs an in-process initialize + tools/list roundtrip against the canonical server built directly from the package (guards future drift; never compares against .mcpc.json).

The registry is filtered to offline (git working-copy) vaults, so the surface matches the DirectClient exactly and no network-backed vault is exposed over the no-auth socket. @<vault>/ routing flows through the shared engine's router: list with no folder shows the vault prefixes, read/write/edit/delete take @<vault>/<path>, search takes folder: "@<vault>".

Changes

  • src/mcp/local-server.ts - the shared builder (createLocalMemoryServer + loadLocalMemoryServer), wraps server-memory.
  • src/commands/mcp.ts - the agentage mcp stdio subcommand (in-process engine).
  • src/daemon/mcp-http.ts + src/daemon/server.ts - stateless POST /mcp (fresh server + transport per request, enableJsonResponse), mirrors the cloud endpoint.
  • src/daemon-entry.ts - wires buildMcpServer; fixes a stale "forked" comment (impl is a detached spawn).
  • R6 package guard grown by exactly the two added deps (@agentage/server-memory, @modelcontextprotocol/sdk); every other ban kept.
  • E2E: daemon /mcp tier (@p0) exercising all 6 tools + dual-channel over HTTP, and a stdio tier (@p0) with clean EOF shutdown.

Verification

  • npm run verify green (type-check + e2e type-check + lint + format + 165 unit tests + build).
  • New @p0 e2e green locally (daemon /mcp all 6 tools + stdio), plus the existing offline tiers (no regression).
  • Manual: isolated config - agentage mcp answers initialize/tools/list over stdio; daemon /mcp answers tools/list + write/search/read via curl with dual-channel output; multi-vault @main/@work routing round-trips.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🎉 PR Validation ✅ PASSED

Commit: 5ac2c449f70fae16049d84dcfa0d36c6f456995e
Branch: feature/m3-local-mcp

Checks:

  • ✅ Release guard (no version/changelog changes)
  • ✅ Dependencies installed
  • ✅ Type check passed
  • ✅ Linting passed
  • ✅ Format check passed
  • ✅ Tests + coverage passed
  • ✅ Build successful

Ready to merge!


🔗 View workflow run
⏰ Generated at: 2026-07-06T07:24:17.156Z

@vreshch vreshch marked this pull request as ready for review July 6, 2026 07:09
@vreshch vreshch merged commit 915f422 into master Jul 6, 2026
2 checks passed
@vreshch vreshch deleted the feature/m3-local-mcp branch July 6, 2026 07:23
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