freshcrate
Skin:/
Home > MCP Servers > mengram

mengram

Human-like memory for AI agents โ€” semantic, episodic & procedural. Experience-driven procedures that learn from failures. Free API, Python & JS SDKs, LangChain, CrewAI & OpenClaw integrations.

Why this rank:Strong adoptionRecent releaseHealthy release cadence

Description

Human-like memory for AI agents โ€” semantic, episodic & procedural. Experience-driven procedures that learn from failures. Free API, Python & JS SDKs, LangChain, CrewAI & OpenClaw integrations.

README

pip install mengram-ai   # or: npm install mengram-ai
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.episodes(query="deployment")          # โ†’ events
m.procedures(query="deploy")            # โ†’ workflows that evolve from failures

Claude Code โ€” Zero-Config Memory

Two commands. Claude Code remembers everything across sessions automatically.

pip install mengram-ai
mengram setup              # Sign up + install hooks (interactive)

Or manually: export MENGRAM_API_KEY=om-... โ†’ mengram hook install

What happens:

Session Start  โ†’  Loads your cognitive profile (who you are, preferences, tech stack)
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.

mengram hook status     # check what's installed
mengram hook uninstall  # remove all hooks

Why Mengram?

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

Mengram claude-mem Mem0 Zep Letta
Semantic memory (facts, preferences) Yes Yes Yes Yes Yes
Episodic memory (events, decisions) Yes Partial No No Partial
Procedural memory (workflows) Yes No No No No
Procedures evolve from failures Yes No No No No
Cognitive Profile Yes No No No No
Multi-user isolation Yes No Yes Yes No
Knowledge graph Yes No Yes Yes Yes
Claude Code hooks (auto-save/recall) Yes Yes No No No
LangChain + CrewAI + MCP Yes No Partial Partial Partial
Import ChatGPT / Obsidian Yes No No No No
Pricing Free tier Free / OSS $19-249/mo Enterprise Self-host

Get Started in 30 Seconds

1. Install

pip install mengram-ai

2. Setup (creates account + installs Claude Code hooks)

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: [...]}
File Upload (PDF, DOCX, TXT, MD)
# 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"
JavaScript / TypeScript
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: [...] }
REST API (curl)
# 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"}'

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

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

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

Claude Code โ€” Auto-memory hooks

mengram hook install

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

Docs

MCP Server โ€” Claude Desktop, Cursor, Windsurf

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

29 tools for memory management.

LangChain โ€” pip install langchain-mengram

from langchain_mengram import (
    MengramRetriever,
    MengramChatMessageHistory,
)

retriever = MengramRetriever(api_key="om-...")
docs = retriever.invoke("deployment issues")

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)

OpenClaw

openclaw plugins install openclaw-mengram

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

GitHub ยท npm

CLI โ€” Full command-line interface

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

Docs

Claude Managed Agents โ€” MCP memory for hosted agents

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

29 memory tools via MCP. Docs

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

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:

Template Stack What it shows
DevOps Agent Python SDK Procedures that evolve from deployment failures
Customer Support CrewAI Agent with 5 memory tools, remembers returning customers
Personal Assistant LangChain Cognitive 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.

Model Parameters Works?
llama3.1:8b 8B Yes
mistral:7b 7B Yes
gemma2:9b 9B Yes
llama3.1:70b 70B Best
phi4-mini:3.8b 3.8B No โ€” context too small

API Reference

Endpoint Description
POST /v1/add Add memories (auto-extracts all 3 types)
POST /v1/add_text Add memories from plain text
POST /v1/add_file Upload file (PDF, DOCX, TXT, MD) โ€” vision AI extraction
POST /v1/search Semantic search
POST /v1/search/all Unified search (semantic + episodic + procedural)
GET /v1/episodes/search Search events and decisions
GET /v1/procedures/search Search workflows
PATCH /v1/procedures/{id}/feedback Report outcome โ€” triggers evolution
GET /v1/procedures/{id}/history Version history + evolution log
GET /v1/profile Cognitive Profile
GET /v1/triggers Smart Triggers (reminders, contradictions, patterns)
POST /v1/agents/run Memory agents (Curator, Connector, Digest)
GET /v1/me Account info

Full interactive docs: mengram.io/docs

Quota Headers

Every authenticated response includes usage headers:

Header Description
X-Quota-Add-Used Add calls used this month
X-Quota-Add-Limit Add calls allowed this month
X-Quota-Search-Used Search calls used this month
X-Quota-Search-Limit Search 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

License

Apache 2.0 โ€” free for commercial use.


Release History

VersionChangesUrgencyDate
v2.25.3## Highlights ### Agent-native install paradigm Paste a single prompt into your coding agent (Claude Desktop, Cursor, Claude Code, Codex, Windsurf, Claude.ai web) โ€” the agent fetches a plain-text install guide written for LLMs, installs Mengram, configures the MCP server in the host, and runs an end-to-end verification round-trip. The full guide: https://mengram.io/agent-install.txt ``` Install Mengram for me. Fetch the canonical install guide at https://mengram.io/agent-install.txt and folloHigh5/14/2026
v2.23.0## Self-Hosting Improvements - **Signup without email verification** โ€” set `DISABLE_EMAIL_VERIFICATION=true` in Docker Compose to get API keys immediately, no Resend dependency needed - **`BASE_URL` env var** โ€” configures all OAuth redirects, email links, and dashboard URLs for your domain (default: `https://mengram.io`) - **`/health` endpoint alias** โ€” works alongside `/v1/health` for standard health check conventions - **Clipboard fallback** โ€” copy buttons now work on non-HTTPS contexts (DockHigh4/7/2026
v2.22.0## What's New ### Quota Usage Headers Every API response now includes `X-Quota-*` headers so SDKs can show usage proactively: ``` X-Quota-Add-Used: 47 X-Quota-Add-Limit: 1000 X-Quota-Search-Used: 312 X-Quota-Search-Limit: 10000 ``` Both Python and JS SDKs expose a `.quota` property: ```python m.search("test") print(m.quota) # {"add": {"used": 5, "limit": 30}, "search": {"used": 12, "limit": 100}} ``` ### Intelligence Dashboard - Value Mirror โ€” shows accumulated intelligence data on quota bannMedium4/5/2026
v2.21.2## What's Changed - **LangChain integration updated to v0.3.0** โ€” Pydantic v2 support, `BaseChatMessageHistory` compatibility - **Fix save hook activation** for new users (#15) - Sync version strings across all packages, fix OpenClaw episodic fieldMedium4/5/2026
v2.21.0## What's New ### Agent Mode - `agent_mode` parameter for `/v1/add` โ€” extract memories from all speakers (user + assistant). Auto-enabled when `agent_id` is present. ### Provenance Tracking - `source` and `metadata` parameters on all memory types โ€” track where memories came from (Slack, email, etc.). ### CrewAI Integration - `MengramMemory` drop-in backend for CrewAI agents. ### Recall Quality Overhaul - 8 search pipeline improvements: stricter relevance floor, dedup, auto-reclassify - Free-Medium4/5/2026
v2.20.0## What's New ### Features - **`add_file()` endpoint** โ€” upload PDFs, images, text files. GPT vision extracts content automatically - **Graph-first dashboard** โ€” redesigned with knowledge graph front and center, 4-group nav, Quick Add bar - **Interactive API playground** on landing page - **Onboarding checklist** โ€” guided 3-step flow for new users in dashboard - **Claude Code `mengram setup`** โ€” interactive CLI signup + auto-configure hooks - **Engagement drip emails** + direct checkout from 40Low3/20/2026

Dependencies & License Audit

Loading dependencies...

Similar Packages

Cognio๐Ÿง  Enhance AI conversations with Cognio, a persistent memory server that retains context and enables meaningful semantic search across sessions.main@2026-06-05
Ollama-Terminal-AgentAutomate shell tasks using a local Ollama model that plans, executes, and fixes commands without cloud or API dependencies.main@2026-06-04
dbt-mcpA MCP (Model Context Protocol) server for interacting with dbt.v1.20.0
agenticaAgentica: Lightweight async-first Python framework for AI agents. ่ฝป้‡็บงๅผ‚ๆญฅไผ˜ๅ…ˆ็š„AI Agentๆก†ๆžถ๏ผŒๆ”ฏๆŒๅทฅๅ…ท่ฐƒ็”จใ€RAGใ€ๅคšๆ™บ่ƒฝไฝ“ๅ’ŒMCPใ€‚v1.4.6
vmlxvMLX - Home of JANG_Q - Cont Batch, Prefix, Paged, KV Cache Quant, VL - Powers MLX Studio. Image gen/edit, OpenAI/Anthv1.5.54

More in MCP Servers

AstrBotAgentic IM Chatbot infrastructure that integrates lots of IM platforms, LLMs, plugins and AI feature, and can be your openclaw alternative. โœจ
agentscopeBuild and run agents you can see, understand and trust.
claude-plugins-officialOfficial, Anthropic-managed directory of high quality Claude Code Plugins.
langchain4jLangChain4j is an open-source Java library that simplifies the integration of LLMs into Java applications through a unified API, providing access to popular LLMs and vector databases. It makes impleme