sdimitrov/mcp-memory 是从 https://github.com/sdimitrov/mcp-memory. 导入的 MCP 服务器候选。
概览
sdimitrov/mcp-memory 是从 https://github.com/sdimitrov/mcp-memory. 导入的 MCP 服务器候选。
概述(AI 翻译)
该服务器采用 mem0 原理为 AI 助手实现长期记忆功能,采用 PostgreSQL 和 pgvector 驱动,实现高效的向量相似性搜索。
特色
- PostgreSQL与pgvector用于向量相似性搜索
- 利用BERT实现的自动嵌入生成
- 用于内存操作的 RESTful API
- 语义搜索功能
- 支持不同类型的记忆(学习、经历等)
- 基于标签的内存检索
- 记忆信心评分
- 服务器发送事件(SSE),用于实时更新
- 光标 MCP 协议兼容
先修条件
-
安装 pgvector 扩展的 PostgreSQL 14+:
-
Node.js 16+
布置
-
安装依赖:
-
配置环境变量: 复制
.env.sample到.env,并调整数值:
示例 .env 配置:
-
初始化数据库:
-
启动服务器:
关于自动换弹的开发:
使用光标
在光标中添加MCP服务器
要将内存服务器添加到光标中,你需要修改位于 ~/.cursor/mcp.json 的 MCP 配置文件。在 mcpServers 对象中添加以下配置:
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
MCP Memory Server
This server implements long-term memory capabilities for AI assistants using mem0 principles, powered by PostgreSQL with pgvector for efficient vector similarity search.
Features
- PostgreSQL with pgvector for vector similarity search
- Automatic embedding generation using BERT
- RESTful API for memory operations
- Semantic search capabilities
- Support for different types of memories (learnings, experiences, etc.)
- Tag-based memory retrieval
- Confidence scoring for memories
- Server-Sent Events (SSE) for real-time updates
- Cursor MCP protocol compatible
Prerequisites
- PostgreSQL 14+ with pgvector extension installed:
# In your PostgreSQL instance:
CREATE EXTENSION vector;
- Node.js 16+
Setup
- Install dependencies:
npm install
- Configure environment variables:
Copy
.env.sampleto.envand adjust the values:
cp .env.sample .env
Example .env configurations:
# With username/password
DATABASE_URL="postgresql://username:password@localhost:5432/mcp_memory"
PORT=3333
# Local development with peer authentication
DATABASE_URL="postgresql:///mcp_memory"
PORT=3333
- Initialize the database:
npm run prisma:migrate
- Start the server:
npm start
For development with auto-reload:
npm run dev
Using with Cursor
Adding the MCP Server in Cursor
To add the memory server to Cursor, you need to modify your MCP configuration file located at ~/.cursor/mcp.json. Add the following configuration to the mcpServers object:
{
"mcpServers": {
"memory": {
"command": "node",
"args": [
"/path/to/your/memory/src/server.js"
]
}
}
}
Replace /path/to/your/memory with the actual path to your memory server installation.
For example, if you cloned the repository to /Users/username/workspace/memory, your configuration would look like:
{
"mcpServers": {
"memory": {
"command": "node",
"args": [
"/Users/username/workspace/memory/src/server.js"
]
}
}
}
The server will be automatically started by Cursor when needed. You can verify it’s working by:
- Opening Cursor
- The memory server will be started automatically when Cursor launches
- You can check the server status by visiting
http://localhost:3333/mcp/v1/health
Available MCP Endpoints
SSE Connection
- Endpoint:
GET /mcp/v1/sse - Query Parameters:
subscribe: Comma-separated list of events to subscribe to (optional)
- Events:
connected: Sent on initial connectionmemory.created: Sent when new memories are createdmemory.updated: Sent when existing memories are updated
Memory Operations
- Create Memory
POST /mcp/v1/memory
Content-Type: application/json
{
"type": "learning",
"content": {
"topic": "Express.js",
"details": "Express.js is a web application framework for Node.js"
},
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"memory": {
"command": "node",
"args": [
"/path/to/your/memory/src/server.js"
]
}
}
}