Local-first memory for AI coding agents, exposed through the Model Context Protocol (MCP).
memd lets an AI assistant save and retrieve durable project context without
shipping that context to a hosted memory service.
memd is a personal tool that came from an OCD-ish annoyance: I wanted to clean
up old chats in the VS Code Codex extension without feeling like I was losing
useful context. It lets me save the parts worth keeping before deleting the noisy
session, so I can pull that context into another chat later.
Early development. The current server exposes a small MCP surface for creating and retrieving memories. The capture workflow is still evolving.
- Local-first: memories are stored on your machine.
- Agent-friendly: MCP tools give AI clients a direct integration point.
- Inspectable: data is stored in SQLite.
- Small core: persistence, application logic, and MCP transport stay separate.
memd runs as an MCP stdio server. An MCP-capable client, such as VS Code or
Codex, starts the server and discovers its tools.
Current tools:
create_memory: persist a finalized memory artifact.get_memory: retrieve a memory by its stable ID.
The MCP boundary automatically adds small provenance tags and metadata so saved memories can be traced back to how they were captured.
- Go
1.26or newer - An MCP-capable client for interactive use
Build and run the MCP server:
make runFor MCP clients, configure the server command as:
go run ./cmd/memdExample VS Code workspace config:
{
"servers": {
"memd": {
"type": "stdio",
"command": "go",
"args": ["run", "./cmd/memd"],
"cwd": "${workspaceFolder}"
}
}
}Example Codex local config:
[mcp_servers.memd]
command = "go"
args = ["run", "./cmd/memd"]
cwd = "/path/to/memd"Create a memory:
{
"project_key": "memd",
"title": "MCP smoke test",
"summary": "Testing that memd can persist and retrieve memories through MCP.",
"content": "This memory verifies the create/get round trip through the MCP server."
}Retrieve it:
{
"id": "mem_..."
}State is stored locally in SQLite. memd resolves its state directory from
MEMD_HOME, XDG_STATE_HOME, or the OS default.
make build
make run
make cimake buildruns formatting, vet, tests, and builds./.bin/memd.make runbuilds and starts the MCP server.make ciruns the stricter local CI path.
The code is split by responsibility:
cmd/memd: process entrypoint and build metadata.internal/app: application bootstrap and dependency wiring.internal/mcp: MCP transport, tool registration, and request/response shapes.internal/memory: memory domain types, service, and repository contract.internal/store: SQLite implementation and migrations.internal/db: SQLite opening and PRAGMA configuration.internal/paths: local state path resolution.
- Search/list tools are not implemented yet.
create_memoryexpects a finalized memory artifact.- The higher-level “save this chat context” drafting workflow is planned but not implemented yet.
- Metadata is intentionally small and currently focused on capture provenance.
- Add search backed by the existing FTS table.
- Add a higher-level context-capture workflow.
- Add confirmation/refinement flow for generated title and summary.
- Improve observability around MCP calls.
The Go Gopher was originally created by Renee French. Image sourced from egonelbre/gophers (CC0). Go and the Go Gopher are trademarks of Google LLC.
Licensed under the Apache License 2.0.
