PluginBench
MCP Server
Active
Apache-2.0

io.github.alibaizhanov/mengram MCP Server

io.github.alibaizhanov/mengram

Long-term memory for AI agents: semantic facts, episodic events, and procedural workflows that evolve from failures

What is the io.github.alibaizhanov/mengram MCP server?

Mengram is an MCP server that provides persistent, multi-type memory for AI agents. It stores semantic facts, episodic events, and procedural workflows that automatically improve when failures are reported, enabling agents to learn and adapt across sessions.

Mengram gives AI agents three types of memory: semantic (facts and preferences), episodic (events and decisions), and procedural (workflows that evolve from failures). It supports 23 languages natively, synthesizes answers with citations, and integrates with Claude Code, Claude Desktop, Cursor, LangChain, and CrewAI. Use it to build agents that remember what they learn and improve their workflows over time.

How to install io.github.alibaizhanov/mengram

Copy-paste configuration for popular MCP clients.

transport: http
Config generated by PluginBench — verify against the source before use.
Environment / auth
  • Authorization
    required
    secret

    Bearer <your Mengram API key> — free key at https://mengram.io

~/.cursor/mcp.json
{
  "mcpServers": {
    "mengram": {
      "url": "https://mengram.io/mcp"
    }
  }
}

Tools & capabilities

Tools this server exposes to the agent.

  • add — Add conversations, facts, or events to memory
  • search — Search across semantic, episodic, and procedural memory
  • search_all — Search all three memory types at once
  • ask — Get synthesized answers with citations from memory
  • episodes — Retrieve episodic memories (events and decisions)
  • procedures — Retrieve procedural workflows
  • procedure_feedback — Report procedure failures to trigger evolution and version updates
  • get_profile — Generate a cognitive profile from all memories for system prompts
  • add_file — Upload PDF, DOCX, TXT, or MD files to extract memories
  • job_status — Check status of async file processing jobs
  • create_webhook — Set up webhooks for memory change notifications
  • import — Import existing data from ChatGPT, Obsidian, or text files

Use cases

  • Build autonomous agents that improve their workflows after each failure
  • Store and recall customer context across support conversations
  • Maintain persistent agent memory across sessions and machine restarts
  • Import existing conversation history from ChatGPT or Obsidian to bootstrap memory
  • Generate personalized system prompts from cognitive profiles for multi-user agents

io.github.alibaizhanov/mengram MCP server FAQ

What is Mengram?

Mengram is an MCP server that provides persistent memory for AI agents. It stores three types of memory—semantic (facts), episodic (events), and procedural (workflows)—and automatically evolves procedures when failures are reported.

Is Mengram free?

Yes. Mengram offers a free tier with API key signup at mengram.io. Premium features include multilingual synthesis and advanced retrieval.

How do I install Mengram in Claude Desktop or Cursor?

Add the MCP server to your config: set the command to 'mengram', args to ['server', '--cloud'], and env var MENGRAM_API_KEY to your API key. Or paste the install prompt into any AI tool and it will configure everything automatically.

Does Mengram require authentication?

Yes. You need a free API key from mengram.io. Set it via MENGRAM_API_KEY environment variable or pass it to the client.

Can Mengram handle multiple users?

Yes. One API key can serve many users—each user_id sees only their own memories. Useful for multi-user agents and team handoffs.

What languages does Mengram support?

Mengram natively supports 23 languages for retrieval and synthesis. You can ask in Russian, Chinese, Spanish, Japanese, and more—it retrieves and answers across all stored languages.

README (reference)

Source of truth, from the repository.

<div align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/badge/Mengram-a855f7?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjAgMTIwIj48cGF0aCBkPSJNNjAgMTYgUTkyIDE2IDk2IDQ4IFExMDAgNzggNzIgODggUTUwIDk2IDM4IDc2IFEyNiA1OCA0NiA0NiBRNjIgMzggNzAgNTIgUTc2IDY0IDYyIDY4IiBmaWxsPSJub25lIiBzdHJva2U9IiNmZmYiIHN0cm9rZS13aWR0aD0iOCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+PGNpcmNsZSBjeD0iNjIiIGN5PSI2OCIgcj0iOCIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg=="> <img alt="Mengram" src="https://img.shields.io/badge/Mengram-a855f7?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjAgMTIwIj48cGF0aCBkPSJNNjAgMTYgUTkyIDE2IDk2IDQ4IFExMDAgNzggNzIgODggUTUwIDk2IDM4IDc2IFEyNiA1OCA0NiA0NiBRNjIgMzggNzAgNTIgUTc2IDY0IDYyIDY4IiBmaWxsPSJub25lIiBzdHJva2U9IiNmZmYiIHN0cm9rZS13aWR0aD0iOCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+PGNpcmNsZSBjeD0iNjIiIGN5PSI2OCIgcj0iOCIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg=="> </picture>

Give your AI agents memory that actually learns

GitHub stars PyPI npm License: Apache 2.0 PyPI Downloads Last commit

Website · Get API Key · Docs · Console · Examples

</div>
pip install mengram-ai   # or: npm install mengram-ai

mengram try              # see what memory would know about you — local only,
                         # no account, nothing leaves your machine
from mengram import Mengram
m = Mengram(api_key="om-...")           # Free key → mengram.io

m.add([{"role": "user", "content": "I use Python and deploy to Railway"}])
m.search("tech stack")                  # → facts
m.ask("what's my tech stack?")          # → synthesized answer + citations
m.episodes(query="deployment")          # → events
m.procedures(query="deploy")            # → workflows that evolve from failures

Native multilingual: ask in Russian, Chinese, Spanish, Japanese — Mengram retrieves and answers across 23 languages (Cohere multilingual embeddings + rerank).


Install in one prompt (any AI tool)

Paste this into Claude Desktop, Cursor, Codex, Claude Code, or Windsurf — the agent reads our setup guide, installs the SDK, configures the MCP server, and verifies the round-trip end-to-end. No terminal context-switching.

Install Mengram for me. Fetch the canonical install guide at
https://mengram.io/agent-install.txt and follow it precisely.
My email is YOUR_EMAIL_HERE.

Works in any agent with shell + file-edit + web-fetch tools. Prefer doing it manually? See the plain-text guide — it's structured for human eyes too.


Claude Code — Memory That Survives /clear AND Auto-Compaction

Persistent memory that survives /clear, auto-compaction, machine switches, and team handoffs — the SessionStart hook fires after every compact and re-injects your context. The summary can be lossy; the memory isn't.

# 1. Get a free key at https://mengram.io and save it once
mkdir -p ~/.mengram && echo '{"api_key": "om-your-key-here"}' > ~/.mengram/config.json

# 2. Install the plugin (hooks + MCP server + skill)
claude plugin marketplace add alibaizhanov/mengram
claude plugin install mengram@mengram

# 3. Skip the cold start — import your existing session history
#    (secrets are redacted on your machine before anything is uploaded)
mengram import claude-code

What happens:

Session Start  →  Loads your cognitive profile (fires after /clear, compaction, and restarts)
Every Prompt   →  Searches past sessions for relevant context (auto-recall)
After Response →  Saves new knowledge in background (auto-save)

No manual saves. No tool calls. Claude just knows what you worked on yesterday — even after compaction ate the transcript.

Prefer CLI-managed hooks instead of the plugin? pip install mengram-ai && mengram setup does the same via mengram hook install.


Why Mengram?

Every AI memory tool stores facts. Mengram stores 3 types of memory — and procedures evolve when they fail.

Mengramclaude-memMem0ZepLetta
Semantic memory (facts, preferences)YesYesYesYesYes
Episodic memory (events, decisions)YesPartialNoNoPartial
Procedural memory (workflows)YesNoNoNoNo
Procedures evolve from failuresYesNoNoNoNo
Cognitive ProfileYesNoNoNoNo
Native multilingual retrieval (23 languages)YesPartialNoNoNo
Ask & Citations (synthesized answer)YesNoNoNoNo
Multi-user isolationYesNoYesYesNo
Knowledge graphYesNoYesYesYes
Claude Code hooks (auto-save/recall)YesYesNoNoNo
MCP serverYesYesYesYesYes
LangChain + CrewAI integrationsYesNoPartialPartialPartial
Import Claude Code history / ChatGPT / ObsidianYesNoNoNoNo
PricingFree tierFree OSS (+cloud backup)$19-249/moEnterpriseSelf-host

Get Started in 30 Seconds

1. Install

pip install mengram-ai

2. Setup — one command does everything: account, Claude Code hooks, MCP configs for detected tools (Cursor, Claude Desktop, Windsurf), history import, and a round-trip check

mengram setup

Or get a key manually at mengram.io and export MENGRAM_API_KEY=om-...

3. Use

from mengram import Mengram

m = Mengram(api_key="om-...")

# Add a conversation — auto-extracts facts, events, and workflows
m.add([
    {"role": "user", "content": "Deployed to Railway today. Build passed but forgot migrations — DB crashed. Fixed by adding a pre-deploy check."},
])

# Search across all 3 memory types at once
results = m.search_all("deployment issues")
# → {semantic: [...], episodic: [...], procedural: [...]}
<details> <summary><b>File Upload (PDF, DOCX, TXT, MD)</b></summary>
# Upload a PDF — auto-extracts memories using vision AI
result = m.add_file("meeting-notes.pdf")
# → {"status": "accepted", "job_id": "job-...", "page_count": 12}

# Poll for completion
m.job_status(result["job_id"])
// Node.js — pass a file path
await m.addFile('./report.pdf');

// Browser — pass a File object from <input type="file">
await m.addFile(fileInput.files[0]);
# REST API
curl -X POST https://mengram.io/v1/add_file \
  -H "Authorization: Bearer om-..." \
  -F "file=@meeting-notes.pdf" \
  -F "user_id=default"
</details> <details> <summary><b>JavaScript / TypeScript</b></summary>
npm install mengram-ai
const { MengramClient } = require('mengram-ai');
const m = new MengramClient('om-...');

await m.add([{ role: 'user', content: 'Fixed OOM by adding Redis cache layer' }]);
const results = await m.searchAll('database issues');
// → { semantic: [...], episodic: [...], procedural: [...] }
</details> <details> <summary><b>REST API (curl)</b></summary>
# Add memory
curl -X POST https://mengram.io/v1/add \
  -H "Authorization: Bearer om-..." \
  -H "Content-Type: application/json" \
  -d '{"messages": [{"role": "user", "content": "I prefer dark mode and vim keybindings"}]}'

# Search all 3 types
curl -X POST https://mengram.io/v1/search/all \
  -H "Authorization: Bearer om-..." \
  -d '{"query": "user preferences"}'
</details>

3 Memory Types

Semantic — facts, preferences, knowledge

m.search("tech stack")
# → ["Uses Python 3.12", "Deploys to Railway", "PostgreSQL with pgvector"]

Episodic — events, decisions, outcomes

m.episodes(query="deployment")
# → [{summary: "DB crashed due to missing migrations", outcome: "resolved", date: "2025-05-12"}]

Procedural — workflows that evolve

Week 1:  "Deploy" → build → push → deploy
                                         ↓ FAILURE: forgot migrations
Week 2:  "Deploy" v2 → build → run migrations → push → deploy
                                                          ↓ FAILURE: OOM
Week 3:  "Deploy" v3 → build → run migrations → check memory → push → deploy ✅

This happens automatically when you report failures:

m.procedure_feedback(proc_id, success=False,
                     context="OOM error on step 3", failed_at_step=3)
# → Procedure evolves to v3 with new step added

Every failure-driven revision records which assumption turned out false — not just which step broke — and derives a precondition that travels with the procedure at recall time:

{
  "version": 3,
  "violated_assumption": "the build container had enough memory for a full build",
  "preconditions": ["check available memory before building"],
  "success_count": 11, "fail_count": 2
}

An agent loading v3 doesn't repeat the two mistakes that produced it — and knows what to verify before trusting the workflow.

Or fully automatic — just add conversations and Mengram detects failures and evolves procedures:

m.add([{"role": "user", "content": "Deploy failed again — OOM on the build step"}])
# → Episode created → linked to "Deploy" procedure → failure detected → v3 created

Ask Your Memory (RAG built-in)

m.ask() returns a synthesized answer with citations — not a raw fact list. Mengram embeds your query, retrieves the top relevant facts, and uses Cohere Chat to write a grounded answer with native source attribution.

result = m.ask("what programming languages do I use?")

print(result["answer"])
# 'You use Python and Rust. Python is your daily language [1] and
#  Rust is your favorite [2]. You also know Java for enterprise
#  systems [3].'

for cit in result["citations"]:
    print(f'  "{cit["text"]}" → {cit["sources"][0]["fact"]}')
# "Python and Rust" → uses Python daily for backend development
# "favorite [2]"   → Rust is favorite language
# "Java"           → specializes in Java/Spring Boot

Multilingual: ask in any of 23 languages, get an answer in the same language with citations linking back to facts in the original language they were stored. Premium feature (Pro / Growth / Business).

Cognitive Profile

One API call generates a system prompt from all memories:

profile = m.get_profile()
# → "You are talking to Ali, a developer in Almaty. Uses Python, PostgreSQL,
#    and Railway. Recently debugged pgvector deployment. Prefers direct
#    communication and practical next steps."

Insert into any LLM's system prompt for instant personalization.

Import Existing Data

Kill the cold-start problem:

mengram import chatgpt ~/Downloads/chatgpt-export.zip --cloud   # ChatGPT history
mengram import obsidian ~/Documents/MyVault --cloud              # Obsidian vault
mengram import files notes/*.md --cloud                          # Any text/markdown

Integrations

<table> <tr> <td width="50%">

Claude Code — Auto-memory hooks

mengram hook install

3 hooks: profile on start, recall on every prompt, save after responses. Zero manual effort.

Docs

</td> <td width="50%">

MCP Server — Claude Desktop, Cursor, Codex, Windsurf, Cline

{
  "mcpServers": {
    "mengram": {
      "command": "mengram",
      "args": ["server", "--cloud"],
      "env": { "MENGRAM_API_KEY": "om-..." }
    }
  }
}

30 tools for memory management.

</td> </tr> <tr> <td width="50%">

LangChain — pip install langchain-mengram

from langchain_mengram import (
    MengramRetriever,
    MengramChatMessageHistory,
)

retriever = MengramRetriever(api_key="om-...")
docs = retriever.invoke("deployment issues")
</td> <td width="50%">

CrewAI

from integrations.crewai import create_mengram_tools

tools = create_mengram_tools(api_key="om-...")
# → 5 tools: search, remember, profile,
#   save_workflow, workflow_feedback

agent = Agent(role="Support", tools=tools)
</td> </tr> <tr> <td width="50%">

OpenClaw

openclaw plugins install openclaw-mengram

Auto-recall before every turn, auto-capture after. 12 tools, slash commands, Graph RAG.

GitHub · npm

</td> <td width="50%">

CLI — Full command-line interface

mengram search "deployment" --cloud
mengram profile --cloud
mengram import chatgpt export.zip --cloud
mengram hook install

Docs

</td> </tr> <tr> <td width="50%">

Claude Managed Agents — MCP memory for hosted agents

{
  "mcp_servers": [{
    "type": "url",
    "name": "mengram",
    "url": "https://mengram.io/mcp/sse"
  }]
}

30 memory tools via MCP. Docs

</td> <td width="50%">

n8n — HTTP nodes for any workflow

POST https://mengram.io/v1/add
POST https://mengram.io/v1/search

No code needed — drag and drop memory into any n8n workflow.

Docs

</td> </tr> </table>

Multi-User Isolation

One API key, many users — each sees only their own data:

m.add([...], user_id="alice")
m.add([...], user_id="bob")

m.search_all("preferences", user_id="alice")  # Only Alice's memories
m.get_profile(user_id="alice")                 # Alice's cognitive profile

Async Client

Non-blocking Python client built on httpx:

from mengram import AsyncMengram

async with AsyncMengram() as m:
    await m.add([{"role": "user", "content": "I use async/await"}])
    results = await m.search("async")
    profile = await m.get_profile()

Install with pip install mengram-ai[async].

Metadata Filters

Filter search results by metadata:

results = m.search("config", filters={"agent_id": "support-bot", "app_id": "prod"})

Webhooks

Get notified when memories change:

m.create_webhook(
    url="https://your-app.com/hook",
    event_types=["memory_add", "memory_update"],
)

Agent Templates

Clone, set API key, run in 5 minutes:

TemplateStackWhat it shows
DevOps AgentPython SDKProcedures that evolve from deployment failures
Customer SupportCrewAIAgent with 5 memory tools, remembers returning customers
Personal AssistantLangChainCognitive profile + auto-saving chat history
cd examples/devops-agent && pip install -r requirements.txt
export MENGRAM_API_KEY=om-...
python main.py

Use with AI Agents

Mengram works as a persistent memory backend for autonomous agents. Your agent stores what it learns, and recalls it on the next run — getting smarter over time.

from mengram import Mengram

m = Mengram(api_key="om-...")

# Agent completes a task → store what happened
m.add([
    {"role": "user", "content": "Apply to Acme Corp on Greenhouse"},
    {"role": "assistant", "content": "Applied successfully. Had to use React Select workaround for dropdowns."},
])
# → Extracts: fact ("applied to Acme Corp"), episode ("Greenhouse application"),
#   procedure ("React Select dropdown workaround")

# Next run → agent recalls what worked before
context = m.search_all("Greenhouse application tips")
# → Returns past procedures, failures, and successful strategies

# Report outcome → procedures evolve
m.procedure_feedback(proc_id, success=False,
                     context="Dropdown fix stopped working")
# → Procedure auto-evolves to a new version

Works with any agent framework — CrewAI, LangChain, AutoGPT, custom loops. The agent just calls add() after actions and search() before decisions.

Self-Hosted (Ollama)

When running locally with Ollama, use models with 8B+ parameters and 8K+ context window. The extraction prompt is ~4,000 tokens — smaller models will hallucinate or mix examples with real data.

ModelParametersWorks?
llama3.1:8b8BYes
mistral:7b7BYes
gemma2:9b9BYes
llama3.1:70b70BBest
phi4-mini:3.8b3.8BNo — context too small

API Reference

EndpointDescription
POST /v1/addAdd memories (auto-extracts all 3 types)
POST /v1/add_textAdd memories from plain text
POST /v1/add_fileUpload file (PDF, DOCX, TXT, MD) — vision AI extraction
POST /v1/searchSemantic search
POST /v1/search/allUnified search (semantic + episodic + procedural)
GET /v1/episodes/searchSearch events and decisions
GET /v1/procedures/searchSearch workflows
PATCH /v1/procedures/{id}/feedbackReport outcome — triggers evolution
GET /v1/procedures/{id}/historyVersion history + evolution log
GET /v1/profileCognitive Profile
GET /v1/triggersSmart Triggers (reminders, contradictions, patterns)
POST /v1/agents/runMemory agents (Curator, Connector, Digest)
GET /v1/meAccount info

Full interactive docs: mengram.io/docs

Quota Headers

Every authenticated response includes usage headers:

HeaderDescription
X-Quota-Add-UsedAdd calls used this month
X-Quota-Add-LimitAdd calls allowed this month
X-Quota-Search-UsedSearch calls used this month
X-Quota-Search-LimitSearch calls allowed this month

SDKs expose this via .quota:

m.search("test")
print(m.quota)  # {"add": {"used": 5, "limit": 30}, "search": {"used": 12, "limit": 100}}

Community

Star History

<a href="https://star-history.com/#alibaizhanov/mengram&Date"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=alibaizhanov/mengram&type=Date&theme=dark" /> <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=alibaizhanov/mengram&type=Date" /> <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=alibaizhanov/mengram&type=Date" /> </picture> </a>

License

Apache 2.0 — free for commercial use.


<div align="center">

Get your free API key · Built by Ali Baizhanov · mengram.io

</div>

Related MCP servers

Lossless context compression: 2-8x fewer tokens, byte-exact recovery, search inside payloads

6
Python
MIT
View repository →
TRTripwire logo

Tripwire

Active

MCP for Roblox Studio and Open Cloud: drive Studio, run headless tests, and review game security.

2
Rust
MIT
View repository →

Find Lumi Studio iOS apps by task across all 50 Apple locales, with direct App Store links.

0
HTML
MIT
View repository →

Secure audio transcription meets AI. Connect Alice recordings to Claude, ChatGPT, Gemini, and more.

2
MIT
View repository →
MAMarketNow logo

MarketNow

Active

Verify AI agent credentials, translate 9 formats, check scam domains, search 68k+ MCP servers.

0
JavaScript
View repository →

Animated b-roll overlays for short-form video. Paste a script, get an mp4. Free, MIT, local.

1
TypeScript
MIT
View repository →