mengram — Claude Code MCP server: long-term memory for agents
Keeps facts, past sessions and learned workflows across agent runs, so a coding session survives /clear and auto-compaction.
claude mcp add --transport http mengram https://mengram.io/mcpWhat mengram does
The server splits memory into three kinds: semantic facts about you and the repo, episodic records of earlier sessions, and procedures that get refined when a step failed. You can search them, ask a question and get a synthesized answer with citations, or list episodes and workflows. Queries work in Russian, Spanish or Chinese as well, because retrieval runs on multilingual embeddings with rerank.
In Claude the plugin wires hooks plus a skill. Session start loads your profile, each prompt triggers a recall search, and the reply is followed by a background save. A policy gate can stop a risky Bash command when it matches a procedure with a poor track record. Hook installers also exist for Codex and Cursor. Cursor has no per-prompt context hook, so recall mid-conversation goes through the MCP tools; session start and compaction stay automatic.
An API key from mengram.io is required. Store it once in ~/.mengram/config.json or hand it to the SDK constructor after pip install mengram-ai or npm install mengram-ai. Every fact carries the host and timestamp that wrote it, so a filesystem path learned on macOS stays out of a Linux session. No key, no memory: the server rejects the connection.
What it helps with
- keep project context between agent sessions
- restore working state after
/clearand auto-compaction - pick up an unfinished task on a repo branch
- pull a fact out of earlier conversations by query
- share one memory across Codex and Cursor
Example prompts for the agent
- Install Mengram following https://mengram.io/agent-install.txt, my email is [email protected]
- Give me back the working context from the last session on this branch
- Search my memory for how deploys are set up in this repo
How to install mengram
Platform CLI: remote server
claude mcp add --transport http mengram https://mengram.io/mcpPlatform CLI: remote server
codex mcp add mengram --url https://mengram.io/mcpConfig file
{
"mcpServers": {
"mengram": {
"url": "https://mengram.io/mcp"
}
}
}Config file
{
"servers": {
"mengram": {
"type": "http",
"url": "https://mengram.io/mcp"
}
}
}Platform CLI: remote server
gemini mcp add -t http mengram https://mengram.io/mcpStep by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about mengram
How to install mengram in Claude Code?
Run claude mcp add --transport http mengram https://mengram.io/mcp and put your key in ~/.mengram/config.json. For hooks and the skill use the plugin: claude plugin marketplace add alibaizhanov/mengram, then claude plugin install mengram@mengram.
What does mengram do?
It gives agents persistent memory of facts, episodes and procedures, fetched on demand and loaded when a session opens. Hooks write new knowledge in the background and rebuild context after compaction.
Can I try it without an API key?
mengram try runs entirely on your machine with no account and uploads nothing. Saving to the hosted memory needs a key.