feat(memctl): MCP (stdio) server surface for LLM hosts (closes #42) - #62
Merged
Conversation
`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>
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an MCP (Model Context Protocol) stdio server surface to
memctlso 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 existingdataplaneclient) as MCP tools; wired intomemctlinmain.go.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 currentmain(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 ./...cleango test -race -count=1 ./...greengolangci-lint run(v2.12.2) — 0 issuesbufis unaffected