Memory MCP
Provides AI agents with persistent, searchable memory using semantic search, auto-linking, and categorization, with zero-config local setup or production-ready external providers.
README
Memory MCP
Persistent memory for AI agents. Plug-and-play with zero infrastructure.
A Model Context Protocol (MCP) server that gives your AI agents persistent, searchable memory. Works out of the box with zero configuration using local embeddings and file-based storage.
Features
- 🔍 Semantic Search - Find memories by meaning, not keywords
- 🔗 Auto-Linking - Related memories are automatically connected
- 🏷️ Auto-Categorization - Memories are categorized by type (knowledge, decision, pattern, etc.)
- ⭐ Importance Scoring - Automatic priority based on content
- 🔌 Pluggable Embeddings - Transformers.js (default), OpenAI, Ollama, or custom
- 📦 Zero Config - No database or API keys required to start
- 🤖 Agent Instructions - Agents automatically learn when and how to use memory tools via MCP protocol
Web Dashboard
Browse and search your memories in the browser with memory-mcp-dashboard — cyberpunk-themed UI, neural graph visualization, same storage.
Quick Start
Start the server immediately with zero configuration.
# Run using npx (requires Node 18+)
npx @aalokjha/mem-aj
Or install locally:
npm i @aalokjha/mem-aj
How it works by default:
- Embeddings: Uses in-process Transformers.js (
all-MiniLM-L6-v2, 384 dimensions). No external server or Python needed. - Storage: Uses a local JSON vector store at
~/.memory-mcp/. - Initialization: The first run downloads a ~90MB model file. Every run after that is instant.
MCP Client Configuration
Add Memory MCP to your favorite AI tools by adding these configurations.
OpenCode / Claude Desktop / Cursor
{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "@aalokjha/mem-aj"]
}
}
}
Production Setup
Configure environment variables to use high-performance storage and external embedding providers.
Qdrant + External Embeddings
- Run your own Qdrant instance.
- Set environment variables to point to your services:
export VECTORDB_PROVIDER=qdrant
export QDRANT_URL=http://localhost:6333
export EMBEDDING_PROVIDER=openai
export EMBEDDING_API_KEY=sk-your-key
Configuration
Environment Variables
| Variable | Default | Description |
|---|---|---|
EMBEDDING_PROVIDER |
transformersjs |
Embedding provider: transformersjs, openai, ollama, custom |
VECTORDB_PROVIDER |
local |
Storage provider: local, qdrant |
EMBEDDING_URL |
- | Embedding service URL (for Ollama/Custom) |
EMBEDDING_API_KEY |
- | API key for OpenAI |
EMBEDDING_MODEL |
Provider default | Model name |
EMBEDDING_DIMENSIONS |
Provider default | Vector dimensions |
EMBEDDING_MAX_TOKENS |
Provider default | Max token context window for embeddings |
QDRANT_URL |
http://localhost:6333 |
Qdrant endpoint |
VECTORDB_COLLECTION |
memories |
Collection name |
LOG_LEVEL |
info |
Log level: debug, info, warn, error |
Embedding Providers
Transformers.js (Default - Zero Config)
Runs locally in your Node.js process. No external services needed.
export EMBEDDING_PROVIDER=transformersjs
OpenAI
export EMBEDDING_PROVIDER=openai
export EMBEDDING_API_KEY=sk-your-key
export EMBEDDING_MODEL=text-embedding-3-small
Ollama
export EMBEDDING_PROVIDER=ollama
export EMBEDDING_URL=http://localhost:11434
export EMBEDDING_MODEL=nomic-embed-text
Custom
Any HTTP endpoint that accepts POST /embed with { inputs: string[] } and returns number[][].
export EMBEDDING_PROVIDER=custom
export EMBEDDING_URL=http://your-service:port
MCP Tools
memory_add
Store a memory with automatic categorization and importance scoring.
{
"content": "Decided to use PostgreSQL for the main database",
"type": "auto",
"tags": ["database", "architecture"],
"project": "my-app"
}
memory_search
Semantic search across all memories.
{
"query": "database decisions",
"limit": 10,
"min_score": 0.7
}
memory_list
Browse memories by type, tags, or project.
{
"type": "decision",
"project": "my-app",
"limit": 20
}
memory_forget
Delete a memory by ID.
{
"memoryId": "uuid-here"
}
memory_link
Manually link two related memories.
{
"id1": "uuid-1",
"id2": "uuid-2"
}
memory_profile
Store user preferences.
{
"action": "set",
"key": "preferred_language",
"value": "typescript"
}
Memory Types
| Type | Description | Keywords Detected |
|---|---|---|
knowledge |
Facts and information | (default) |
decision |
Choices made | decided, chose, will use, picked |
pattern |
Recurring solutions | pattern, always, convention, best practice |
preference |
User preferences | prefer, like, dislike, want, hate |
context |
Situational context | working on, currently, project |
debug |
Debug notes | error, bug, fix, crash, issue |
Development
# Install dependencies
npm install
# Build
npm run build
# Run in dev mode
npm run dev
# Run tests
npm test
Agent Instructions
The server automatically injects usage instructions into the connected agent's context via the MCP instructions protocol field. Agents learn:
- When to search, store, and link memories
- How to write effective memories (word limits adapted to the configured embedding model)
- What memory types to use and cross-tool workflows
No manual prompt engineering or AGENTS.md configuration needed. Just connect and the agent knows what to do.
Token limits per provider default:
| Provider | Max Tokens | Max Words |
|---|---|---|
| Transformers.js | 512 | ~384 |
| OpenAI | 8,191 | ~6,143 |
| Ollama | 8,192 | ~6,144 |
| Custom | 512 | ~384 |
Override with EMBEDDING_MAX_TOKENS if using a non-default model.
Architecture
Memory MCP supports two modes:
Zero-Config Mode (Default)
Simple, file-based storage for personal use.
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ MCP Client │────▶│ Memory MCP │────▶│ Local JSON │
│ (Claude/AI) │ │ Server │ │ Vector Store │
└─────────────────┘ └────────┬────────┘ └─────────────────┘
│
▼
┌─────────────────┐
│ Transformers.js │
│ (In-process) │
└─────────────────┘
Production Mode
High-performance configuration for shared environments.
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ MCP Client │────▶│ Memory MCP │────▶│ Qdrant │
│ (Claude/AI) │ │ Server │ │ Vector DB │
└─────────────────┘ └────────┬────────┘ └─────────────────┘
│
▼
┌─────────────────┐
│ External │
│ Provider │
│ (OpenAI/Ollama) │
└─────────────────┘
License
MIT License - see LICENSE
Contributing
Contributions welcome! Please read our contributing guidelines.
Credits
Built by Aalok Jha
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。