记忆
STDIO基于语义搜索的LLM长期记忆存储系统
基于语义搜索的LLM长期记忆存储系统
A long-term memory storage system for LLMs using the Model Context Protocol (MCP) standard. This system helps LLMs remember the context of work done over the entire history of a project, even across multiple sessions. It uses semantic search with embeddings to provide relevant context from past interactions and development decisions.
nomic-embed-text model installednpm install
npm run build
.env file with required configuration:
OLLAMA_HOST=http://localhost:11434
DB_PATH=memory.db
Start the server in development mode:
npm run dev
This will:
The server connects via stdio for Cursor compatibility
The system uses SQLite with the following tables:
projects: Project information and metadatamemories: Memory entries storing various types of development contextembeddings: Vector embeddings (768d) for semantic search capabilitiestags: Memory organization tagsmemory_tags: Many-to-many relationships between memories and tagsmemory_relationships: Directed relationships between memory entriesThe following tools are available through the MCP protocol:
store-dev-memory: Create new development memories with:
list-dev-memories: List existing memories with optional tag filteringget-dev-memory: Retrieve specific memory by IDsearch: Semantic search across memories using embeddingsFor development:
npm run dev
This will:
Key dependencies:
@modelcontextprotocol/sdk@^1.7.0: MCP protocol implementationbetter-sqlite3@^9.4.3: SQLite database interfacenode-fetch@^3.3.2: HTTP client for Ollama APIzod@^3.22.4: Runtime type checking and validationmemory-mcp-server/
├── src/
│   ├── db/
│   │   ├── init.ts     # Database initialization
│   │   └── service.ts  # Database service layer
│   ├── dev-memory.ts   # Development memory helpers
│   ├── index.ts        # Main server implementation
│   └── schema.sql      # Database schema
├── dist/               # Compiled JavaScript
├── package.json        # Project configuration
└── tsconfig.json       # TypeScript configuration
Contributions are welcome! Please ensure you: