store_memory
Store a memory for later retrieval.
The memory-mcp platform is currently in development. The Self-hosted Community Edition is available now!
Memory MCP exposes a set of tools for storing, retrieving, and managing persistent memory. Each memory is built from three simple primitives — understanding them makes every tool click.
These tools can be accessed by any MCP client connected to the Memory MCP endpoint.
The memory itself. Free-form text — a conversation exchange, a decision, a note, a summary. There are no structural requirements. Store what’s meaningful, in whatever form makes sense for your use case.
When retrieving, the query field searches against content semantically — by meaning, not keyword match. “database connection issue” will surface memories about PostgreSQL errors even if those exact words don’t appear.
Short topic tags that describe what a memory is about. Labels are substring-matched (case-insensitive), so plugin will match plugin-dev and plugin-development. The search term must appear within the label, not the reverse.
Multiple labels can be applied to a single memory, and queries can combine includes and excludes:
labels="memory-system,plugin" # matches either (OR) — sorted by recency and best match
labels="memory-system,!cron" # matches memory-system but not cron
Labels power the trending_labels tool — tokens extracted from labels across all memories build a popularity index that reflects what’s been discussed recently.
A free-form identifier for where a memory came from. Fuzzy-matched like labels, and supports the same include/exclude syntax.
Common patterns:
| Pattern | Example | Use case |
|---|---|---|
| Agent identity | agent:sonnet:main | Per-agent memory isolation |
| Category prefix | personal or work | Topic-based separation |
| Provenance | summary:42 | Mark derived/generated memories |
| URL | https://example.com/page | Web content attribution |
Source is purely convention — Memory MCP doesn’t enforce any format.
The three primitives combine to make precise queries without needing exact text:
# Semantic search within a specific agent's memories
query="what did we decide about authentication"
source="agent:sonnet:main"
# Recent memories on either topic, excluding noise
labels="plugin-dev,!cron"
# Everything from a specific agent
source="agent:sonnet:main"
Any combination is valid. Fields left empty are not filtered on.
Store a memory for later retrieval.
Retrieve memories with flexible filtering — semantic search, label filtering, source filtering, or any combination.
Retrieve a specific memory by ID, including its full metadata and related memory map.
Permanently delete a memory by ID.
Add labels to an existing memory without replacing existing ones.
Remove specific labels from a memory without affecting others.
Atomically replace one or more labels with one or more new labels in a single operation.
Retrieve a random memory, optionally filtered by labels or source.
Return memory counts and matched label or source lists for a namespace.
Get currently trending labels based on recent token activity and synaptic decay.