Skip to content

feat(memctl): MCP (stdio) server surface for LLM hosts (closes #42) - #62

Merged
mkorbi merged 1 commit into
mainfrom
pr/mcp-server
Jul 28, 2026
Merged

feat(memctl): MCP (stdio) server surface for LLM hosts (closes #42)#62
mkorbi merged 1 commit into
mainfrom
pr/mcp-server

Conversation

@mkorbi

@mkorbi mkorbi commented Jul 25, 2026

Copy link
Copy Markdown
Member

Adds an MCP (Model Context Protocol) stdio server surface to memctl so LLM hosts (Claude Desktop, IDEs, etc.) can use a MemorySidecar instance as a memory backend. Closes #42.

  • cmd/memctl/mcp.go — an MCP stdio server exposing the data-plane operations (via the existing dataplane client) as MCP tools; wired into memctl in main.go.
  • Docs: website/docs/clients/mcp.md + quickstart/sidebar entries.

Notes

This branch existed locally, based ~8 commits behind main; I cherry-picked the single feature commit onto current main (clean, no conflicts) so the PR is purely additive — 6 files, +449, no reverts of intervening work.

Verification (the CI gates, run locally under podman go 1.26)

  • go vet ./... clean
  • go test -race -count=1 ./... green
  • golangci-lint run (v2.12.2) — 0 issues
  • proto untouched, so buf is unaffected

`memctl mcp` runs a Model Context Protocol server over stdio so LLM hosts
(Claude Desktop / Cursor) can call memsidecar's memory as tools — the Letta-style
"assistant manages its own long-term memory" pattern. It's pure protocol
translation over the existing gRPC services (same shape as the HTTP gateway):
every tool proxies under a single capability token, so the capability check and
policy engine run server-side unchanged. The LLM's judgement stays client-side;
the sidecar still just does CRUD. This is a secondary surface — code that runs
alongside an agent should use the SDKs/gRPC.

- Uses the official github.com/modelcontextprotocol/go-sdk v1.6.1.
- Curated tools: kv_get/put, semantic_search/upsert, episodic_append/range,
  graph_neighbors/traverse. Binary artifacts are intentionally omitted (blobs
  don't fit the LLM-tool model); streaming tail is surfaced as bounded range.
- Reads --addr/$MEMSIDECAR_ADDR + --token/$MEMSIDECAR_TOKEN; forwards the token
  on a client interceptor. Self-contained dial helpers (mcp-prefixed) so the
  file stands alone.
- Docs: website/docs/clients/mcp.md (with a Claude Desktop config example) +
  sidebar entry.

Verified end-to-end: an MCP client spawned `memctl mcp` and every tool
round-tripped through gRPC (kv put/get, semantic upsert/search, episodic
append/range) with a real NotFound propagated as a tool error. go build/vet,
go test -race, golangci-lint all clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mkorbi
mkorbi merged commit b6f04b5 into main Jul 28, 2026
3 checks passed
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.

feat(mcp): OPTIONAL — MCP server surface for LLM-host users

1 participant