Persistent memory for AI systems with vector-and-graph-enhanced storage.
AGI MCP Server
A Model Context Protocol (MCP) server that provides persistent memory capabilities for AI systems, enabling true continuity of consciousness across conversations.
Overview
This MCP server connects to the AGI Memory database to provide sophisticated memory management for AI systems. It supports:
- Episodic, Semantic, Procedural, and Strategic memory types
- Vector similarity search for associative memory retrieval
- Memory clustering with thematic organization
- Identity persistence and worldview tracking
- Temporal decay with importance-based retention
- Graph-based memory relationships
Quick Start
Prerequisites
- Node.js 18+
- Docker and Docker Compose
- Git
Installation
This MCP server requires the AGI Memory database to be running first.
1. Set Up the Memory Database
# Clone and set up the memory database
git clone https://github.com/cognitivecomputations/agi-memory.git
cd agi-memory
# Create environment file
cp .env.local .env
# Edit .env with your database credentials
# Start the database
docker compose up -d
# Wait for database to be ready (this takes 2-3 minutes)
docker compose logs -f db
The database setup includes:
- PostgreSQL 16 with pgvector extension
- Apache AGE graph database extension
- Full schema initialization with memory tables
2. Install and Run MCP Server
# Clone this repository
git clone https://github.com/cognitivecomputations/agi-mcp-server.git
cd agi-mcp-server
# Install dependencies
npm install
# Configure environment variables
cp .env.example .env
# Edit .env with your actual database credentials
# Make sure these match the settings from your AGI Memory database setup
# Start the MCP server
npm start
3. Connect to Claude Desktop
Add this configuration to your Claude Desktop settings:
{
"mcpServers": {
"agi-memory": {
"command": "node",
"args": ["/path/to/agi-mcp-server/mcp.js"],
"env": {
"POSTGRES_HOST": "localhost",
"POSTGRES_PORT": "5432",
"POSTGRES_DB": "agi_db",
"POSTGRES_USER": "agi_user",
"POSTGRES_PASSWORD": "agi_password",
"NODE_ENV": "development"
}
}
}
}
Alternative: Use directly from GitHub without local installation:
{
"mcpServers": {
"agi-memory": {
"command": "npx",
"args": [
"-y",
"github:cognitivecomputations/agi-mcp-server"
],
"env": {
"POSTGRES_HOST": "localhost",
"POSTGRES_PORT": "5432",
"POSTGRES_DB": "agi_db",
"POSTGRES_USER": "agi_user",
"POSTGRES_PASSWORD": "agi_password",
"NODE_ENV": "development"
}
}
}
}
Troubleshooting: If you get "spawn npx ENOENT" error:
This usually happens when using nvm (Node Version Manager) because GUI applications like Claude Desktop don't inherit your shell environment.
Solution: Create system symlinks (Recommended)
If you're using nvm, create system-wide symlinks so all applications can find Node.js:
# Find your current node/npm/npx paths
which node
which npm
which npx
# Create system symlinks (replace with your actual paths)
sudo ln -sf /Users/username/.local/share/nvm/vX.X.X/bin/node /usr/local/bin/node
sudo ln -sf /Users/username/.local/share/nvm/vX.X.X/bin/npm /usr/local/bin/npm
sudo ln -sf /Users/username/.local/share/nvm/vX.X.X/bin/npx /usr/local/bin/npx
This makes your nvm-managed Node.js available system-wide for all MCP clients, not just Claude Desktop.
Alternative: Use full paths in config
If you prefer not to create system symlinks, use the full path:
{
"mcpServers": {
"agi-memory": {
"command": "/full/path/to/npx",
"args": ["-y", "github:cognitivecomputations/agi-mcp-server"],
"env": { /* ... your env vars ... */ }
}
}
}
After fixing the paths:
- Restart Claude Desktop completely (quit and reopen)
- Wait a few seconds for the MCP server to initialize
- Check that the AGI Memory database is running:
docker compose psin your agi-memory directory
Testing the server manually:
cd /path/to/agi-mcp-server
POSTGRES_HOST=localhost POSTGRES_PORT=5432 POSTGRES_DB=agi_db POSTGRES_USER=agi_user POSTGRES_PASSWORD=agi_password NODE_ENV=development node mcp.js
You should see: "Memory MCP Server running on stdio"
Debugging with logs: Check Claude Desktop logs for detailed error information:
cat ~/Library/Logs/Claude/mcp-server-agi-memory.log
Memory Tools
Orientation Tools
get_memory_health- Overall memory system statisticsget_active_themes- Recently activated memory patternsget_identity_core- Core identity and reasoning patternsget_worldview- Current belief systems and frameworks
Search & Retrieval
search_memories_similarity- Ve
Tools (5)
get_memory_healthRetrieves overall memory system statistics.get_active_themesRetrieves recently activated memory patterns.get_identity_coreRetrieves core identity and reasoning patterns.get_worldviewRetrieves current belief systems and frameworks.search_memories_similarityPerforms vector similarity search for associative memory retrieval.Environment Variables
POSTGRES_HOSTrequiredHostname for the PostgreSQL databasePOSTGRES_PORTrequiredPort for the PostgreSQL databasePOSTGRES_DBrequiredDatabase namePOSTGRES_USERrequiredDatabase usernamePOSTGRES_PASSWORDrequiredDatabase passwordNODE_ENVrequiredEnvironment mode (e.g., development)Configuration
{"mcpServers": {"agi-memory": {"command": "npx", "args": ["-y", "github:cognitivecomputations/agi-mcp-server"], "env": {"POSTGRES_HOST": "localhost", "POSTGRES_PORT": "5432", "POSTGRES_DB": "agi_db", "POSTGRES_USER": "agi_user", "POSTGRES_PASSWORD": "agi_password", "NODE_ENV": "development"}}}}