MCP + MemoClaw: giving your tools persistent memory
Most MCP tools are stateless. Your agent calls a tool, gets a result, and that result vanishes the moment the context window rolls over. The agent has no way to remember what it learned from previous tool calls unless you manually wire up some persistence layer.
memoclaw-mcp fixes this by exposing MemoClaw’s memory as native MCP tools. Any MCP-compatible client — Claude Desktop, Cursor, OpenClaw, whatever speaks the protocol — gets store, recall, search, and other memory operations without writing any glue code.
I set this up a few weeks ago and it’s changed how I think about agent workflows. Here’s how to get it running.
What memoclaw-mcp gives you
When you add memoclaw-mcp to your MCP server config, your agent gets access to a full set of memory tools. The ones you’ll use most:
memoclaw_store— save a memory with tags, importance, and namespacememoclaw_recall— semantic search across stored memoriesmemoclaw_search— keyword search (free, no embedding cost)memoclaw_list— browse memories chronologicallymemoclaw_core_memories— get your highest-importance memories
There are also bulk operations (memoclaw_bulk_store, memoclaw_export), an ingestion pipeline (memoclaw_ingest, memoclaw_extract), relation tools (memoclaw_create_relation, memoclaw_graph), and namespace management. Full list is in the README.
The core loop is simple: store things worth remembering, recall them when relevant.
Installation
One npm install:
npm install -g memoclaw-mcp
You need a wallet private key. If you already use the MemoClaw CLI, you’ve got one. If not, generate one:
npm install -g memoclaw
memoclaw init
This creates ~/.memoclaw/config.json with your wallet and private key. memoclaw-mcp reads from the same config file, so there’s nothing extra to set up.
Configuring Claude Desktop
Add this to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"memoclaw": {
"command": "memoclaw-mcp",
"env": {
"MEMOCLAW_PRIVATE_KEY": "0xYOUR_PRIVATE_KEY"
}
}
}
}
Restart Claude Desktop. Your agent now has memory tools in every conversation.
Configuring Cursor
Same idea, different location. In Cursor’s MCP settings, add a new server with the command memoclaw-mcp and pass your private key as an env var. Cursor picks it up automatically.
Running as an HTTP server
The default transport is stdio, which works for local setups. If you need to connect remote clients or share a memory server across machines, switch to HTTP:
# Start the MCP server over HTTP
memoclaw-mcp --http
# Custom port
MEMOCLAW_PORT=8080 memoclaw-mcp --http
This exposes a Streamable HTTP endpoint at http://localhost:3100/mcp (following the MCP 2025-03-26 spec). Point your MCP client at that URL and you’re connected.
There’s built-in rate limiting: 60 requests/minute per IP by default, configurable via environment variables.
Using it with OpenClaw
If you’re on OpenClaw, you have two options. You can use memoclaw-mcp as a standalone MCP server, or you can use the MemoClaw skill directly (which calls the CLI, no MCP needed).
The MCP route makes sense if you’re already using MCP for other tools and want memory alongside them. The skill route is simpler if MemoClaw is your only external tool.
For the MCP approach, configure it the same way you add any MCP server to your OpenClaw setup. The agent then calls memoclaw_store and memoclaw_recall as tool calls, same as any other MCP tool.
What this looks like in practice
Concrete scenario. You’re using Claude Desktop with memoclaw-mcp configured, working through a codebase review.
Your agent reads through some files and identifies a pattern: “This codebase uses a custom error handling middleware that wraps all async route handlers.” Without memory, that observation dies when you close the conversation.
With memoclaw-mcp, your agent can call:
memoclaw_store({
content: "Codebase uses custom async error middleware in src/middleware/errorHandler.ts — wraps all route handlers automatically",
importance: 0.7,
tags: ["architecture", "error-handling"],
namespace: "code-review-projectx"
})
Next week, when you open a new conversation about the same project and ask “how does error handling work in this codebase?”, your agent calls:
memoclaw_recall({
query: "error handling architecture",
namespace: "code-review-projectx"
})
And gets back that stored memory with full context. No re-reading the code. No re-explaining.
Ingestion: the feature I didn’t expect to use so much
You can dump a whole conversation or document into memoclaw_ingest, and it uses GPT-4o-mini to extract discrete facts, deduplicate against existing memories, and create relations between related items.
This is useful at the end of a long working session. Instead of manually picking out what to remember, your agent calls ingest on the conversation transcript and MemoClaw figures out what’s worth keeping.
memoclaw_ingest({
text: "... full conversation text ...",
namespace: "project-atlas"
})
It costs $0.01 per call (after the free tier) because it runs an LLM extraction step. For a 2000-word conversation, that’s a fair tradeoff compared to storing individual memories by hand.
Namespaces keep things sane
If you’re using memory across multiple projects (and you probably should be), namespaces prevent cross-contamination. Every store and recall call accepts a namespace parameter. Memories in namespace A never appear in recalls against namespace B.
I use one namespace per project. General knowledge stays in the default namespace.
memoclaw_store({
content: "Project Atlas uses PostgreSQL 16 with pgvector for embeddings",
namespace: "atlas",
importance: 0.8,
tags: ["infrastructure", "database"]
})
The memoclaw_namespaces tool lists all your namespaces with memory counts, so you can see what’s accumulated where.
Pricing
Your wallet gets 100 free API calls. No credit card, no registration. After that, x402 micropayments kick in: $0.005 per store or recall, $0.01 for operations that use GPT-4o-mini (ingest, extract, consolidate). Operations like list, search, delete, and stats are free.
The x402 payments happen automatically using USDC on Base. Your wallet needs a small USDC balance once you’ve used the free tier.
Getting started
If you’re setting this up for the first time:
- Install
memoclaw-mcpand generate a wallet withmemoclaw init - Add the server to your Claude Desktop or Cursor config
- Start a conversation about a project you’re actively working on
- Let your agent use
memoclaw_storenaturally as it discovers things worth remembering - In your next session about that project, see if
memoclaw_recallsurfaces useful context
Don’t try to store everything. The best memories are specific decisions, architectural choices, and context that would be annoying to rediscover. “We chose PostgreSQL over MySQL because of pgvector support” is a good memory. “The project has a README” is not.
Once you’ve configured memoclaw-mcp, memory works across every session and every MCP client you connect. Set it up once, use it everywhere.