Long-term memory for a coding agent
Connect the coding agent to Mirabase over MCP with one command. It then reads what is already known before a task, and saves documents as files and lasting statements as memories, so the next session starts from them.
Set it up
- Sign in to the console and create an API key. Give the agent a key of its own, not your root key: see Set up an Agent.
- Add the MCP server.
export MIRABASE_API_KEY="mb_live_..."
# Claude Code
claude mcp add --transport http mirabase https://api.mirabase.io/mcp \
--header "Authorization: Bearer $MIRABASE_API_KEY"
# Codex
codex mcp add mirabase --url https://api.mirabase.io/mcp \
--bearer-token-env-var MIRABASE_API_KEY
- Check the key.
curl https://api.mirabase.io/v2/whoami \
-H "Authorization: Bearer $MIRABASE_API_KEY"
The response lists the key's capabilities and the Spaces it can read and write. Any other MCP client that supports Streamable HTTP and can send a header connects the same way: see Connect an Agent.
What the agent does with it
| When | Tool | Effect |
|---|---|---|
| Before a task | mira.context | Returns a pack of relevant files and memories within a token budget |
| Looking for something specific | mira.search | Returns passages that match by words and by meaning |
| Saving a document, notes or a plan | mira.files.write | Writes a file at a path; every write keeps a version |
| Recording a statement that stays true | mira.memory.remember | Stores a memory, such as a decision or a preference |
| Fixing a wrong memory | mira.memory.correct | Replaces the memory and keeps the old statement as history |
The server tells the model what each tool is for in the instructions of its handshake. The recommended order is in Recommended call order.
Limits
https://api.mirabase.io/mcp/leanoffers six tools for agents that only need memory and files. See Toolsets.- Writing a project memory requires the
memory:confirmcapability. Without it, use files, or ask the Space owner to grant it. mira.memory.forgeterases a memory permanently. Usemira.memory.correctto fix one.- A tool call counts as two requests against the rate limit: the MCP call and the API request it makes.
- An agent that changes a file it does not own creates a proposal for review unless the Space owner has set its write mode to
direct. See Agent write mode.