semantic-memory

semantic-memory

Persistent memory with semantic search for Claude and MCP-compatible clients, storing context that survives conversations and can be retrieved intelligently.

Category
访问服务器

README

🧠 MCP Semantic Memory Server

Persistent memory with semantic search for Claude and MCP-compatible clients

License: MIT Node.js Version MCP Compatible

Give your AI assistant persistent memory that survives between conversations. Save context once, retrieve it intelligently forever.

✨ Features

  • 🔍 Semantic Search - Find memories by meaning, not just keywords
  • 💾 SQLite Storage - Fast, reliable, and scalable
  • 👤 User Biography - Structured profile (name, occupation, tech stack, etc.)
  • 🏠 100% Local - No external APIs, all processing on your machine
  • Fast - Powered by all-MiniLM-L6-v2 embeddings (~50ms searches)
  • 🔒 Private - Your data never leaves your computer

🎯 Problem & Solution

Problem: Claude forgets everything between conversations. You constantly re-explain your context, projects, preferences, and tech stack.

Solution: This MCP server gives Claude persistent memory with intelligent semantic search. Save information once, and Claude retrieves it automatically when relevant.

Example

// Save once
save_memory("project-info", "Working on an e-commerce site with Next.js and Stripe")

// Days later, in a new conversation
User: "How do I add payments to my project?"
Claude: *searches memory* "Since you're using Stripe in your e-commerce project..."

🚀 Quick Start

Installation

# Clone the repository
git clone https://github.com/GFYURI/mcp-semantic-memory.git
cd mcp-semantic-memory

# Install dependencies (pnpm recommended)
pnpm install
# or: npm install

Configuration

Add to your MCP client config (e.g., Claude Desktop):

Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "semantic-memory": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-semantic-memory/index.js"]
    }
  }
}

Example (Windows):

{
  "mcpServers": {
    "semantic-memory": {
      "command": "node",
      "args": ["C:\\Users\\YourName\\mcp-semantic-memory\\index.js"]
    }
  }
}

First Run

  1. Restart your MCP client (e.g., Claude Desktop)
  2. The server will download the embedding model (~25MB) on first use
  3. Start saving memories!

📚 Available Tools

Memory Management

save_memory(id, text, metadata?)

Save a memory with semantic embedding.

save_memory({
  id: "my-cat",
  text: "My cat's name is Mia, she's orange and very playful",
  metadata: { category: "personal", type: "pet" }
})

search_memory(query, n_results?, threshold?)

Search memories by semantic similarity.

search_memory({
  query: "what's my pet's name?",
  n_results: 5,      // optional, default: 5
  threshold: 0.3     // optional, default: 0.3 (0-1 scale)
})

get_memory(id)

Retrieve a specific memory by ID.

delete_memory(id)

Delete a memory permanently.

list_all_memories()

List all stored memories (ordered by last update).

User Biography

get_user_bio()

Get the user's complete biographical profile.

set_user_bio(data)

Create or update user biography. All fields are optional.

set_user_bio({
  nombre: "Angel",
  ocupacion: "Student",
  ubicacion: "Santiago, Chile",
  tecnologias: ["Python", "JavaScript", "Node.js"],
  herramientas: ["VS Code", "Docker", "pnpm"],
  idiomas: ["Spanish", "English"],
  timezone: "America/Santiago",
  mascotas: ["Mia (cat)"]
})

update_user_bio(field, value)

Update a single field in the biography.

update_user_bio({
  field: "tecnologias",
  value: ["Python", "JavaScript", "TypeScript"]
})

🎨 Use Cases

For Developers

  • Remember your tech stack and project context
  • Store solutions to common problems
  • Keep track of configurations and preferences

For Students

  • Save study notes and learning progress
  • Remember assignment deadlines and requirements
  • Track research topics and sources

For Everyone

  • Personal preferences and interests
  • Important dates and events
  • Conversation context across sessions

🔧 How It Works

Semantic Search

Traditional keyword search:

Query: "what's my pet's name?"
Memory: "My cat Mia is orange"
Result: ❌ No matches (different words)

Semantic search:

Query: "what's my pet's name?"
Memory: "My cat Mia is orange"
Result: ✅ 78% similarity (understands meaning)

Technical Details

  • Embeddings: all-MiniLM-L6-v2 (384 dimensions)
  • Storage: SQLite with optimized indexes
  • Search: Cosine similarity between vectors
  • Performance: ~50-100ms per save, ~200ms search in 100 memories

📊 Database Schema

-- Memories table
CREATE TABLE memories (
  id TEXT PRIMARY KEY,
  text TEXT NOT NULL,
  embedding TEXT NOT NULL,  -- JSON array of 384 floats
  metadata TEXT,            -- JSON object
  created_at TEXT NOT NULL,
  updated_at TEXT NOT NULL
);

-- User biography table
CREATE TABLE user_bio (
  id INTEGER PRIMARY KEY CHECK (id = 1),
  nombre TEXT,
  ocupacion TEXT,
  ubicacion TEXT,
  tecnologias TEXT,  -- JSON array
  herramientas TEXT, -- JSON array
  idiomas TEXT,      -- JSON array
  timezone TEXT,
  mascotas TEXT,     -- JSON array
  created_at TEXT NOT NULL,
  updated_at TEXT NOT NULL
);

🆚 Comparison with Alternatives

Feature This MCP @modelcontextprotocol/server-memory
Semantic Search
User Biography
Storage SQLite In-memory
Persistence ✅ Disk ❌ RAM only
Scalability 1000s of memories Limited
Search Speed Fast (indexed) N/A

🛠️ Development

# Install dependencies
pnpm install

# Run locally
node index.js

# Test with MCP inspector
npx @modelcontextprotocol/inspector node index.js

📝 Requirements

  • Node.js >= 18.0.0
  • ~100MB disk space (model + dependencies)
  • MCP-compatible client (Claude Desktop, LM Studio, etc.)

🐛 Troubleshooting

First run takes 30-60 seconds

The embedding model is being downloaded (~25MB). Subsequent runs are instant.

sharp installation fails on Windows

pnpm rebuild sharp
# or
pnpm install --force

Database is locked

Close other connections to memory.db or restart your MCP client.

Memories not loading

Check that the absolute path in your MCP config is correct.

🤝 Contributing

Contributions are welcome! Feel free to:

  • Report bugs
  • Suggest features
  • Submit pull requests
  • Improve documentation

📄 License

MIT License - feel free to use this in your own projects!

🙏 Acknowledgments

⭐ Star History

If you find this useful, consider giving it a star! It helps others discover the project.


Made with ❤️ for the MCP community

Report Bug · Request Feature

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选