MCP server for semantic memory storage using local Postgres with pgvector
npm install postgres-pgvector-memory-mcp.clinerules). See System Prompts.
mcp.json file must be strictly configured as detailed in the MCP Client Configuration section.
pgvector extension. This enables your AI assistant to store, retrieve, and search memories using vector embeddings.
project_id.
pgvector extension:
docker-compose.yml from that repository (or create one like below):
yaml
services:
db:
image: pgvector/pgvector:pg16
restart: always
ports:
- "5432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: postgres
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata:
`
Run it:
`bash
docker-compose up -d
`
$3
`bash
npx postgres-pgvector-memory-mcp setup
`
This interactive setup will:
1. Ask for your Postgres Connection String (default: postgresql://postgres:password@localhost:5432/postgres).
2. Connect to the database.
3. Automatically apply the database schema (create memories table and vector extension).
$3
Add the following to your mcp.json or MCP settings:
`json
{
"mcpServers": {
"postgres-memory": {
"command": "node",
"args": [
"c:/mcpservers/post-pgvector-mcp/dist/index.js"
],
"env": {
"POSTGRES_URL": "postgresql://postgres:password@localhost:5432/postgres"
}
}
}
}
`
Tools
- store_memory: Save a snippet of information with a category.
- search_memories: Find memories semantically related to a query.
- list_memories: recent memories for a project.
- delete_memory: Remove a memory by ID.
- get_project_stats: Count memories for a project.
Development
1. Install dependencies:
`bash
npm install
`
2. Build:
`bash
npm run build
`
3. Run locally:
`bash
npm run dev
``