agentmemory-server
v1.0.0
Published
Shared AI session memory MCP server backed by PostgreSQL
Readme
agentmemory-server
Shared AI session memory MCP server. Captures Claude Code and Copilot sessions to Azure PostgreSQL so agents can recall team-wide context across laptops.
Requirements
- Node.js >= 20
- Access to Azure Database for PostgreSQL (connection string)
Install
Mac/Linux:
npm install -g agentmemory-serverWindows (PowerShell):
npm install -g agentmemory-serverConfigure
Set one environment variable:
Mac/Linux (~/.zshrc or ~/.bashrc):
export AGENT_MEMORY_DB_URL="postgres://user:[email protected]:5432/agentmemory?sslmode=require"Windows (System → Advanced System Settings → Environment Variables):
AGENT_MEMORY_DB_URL = postgres://user:[email protected]:5432/agentmemory?sslmode=requireRun migrations (one-time, any laptop)
npm run migrateWire up Claude Code
Add to ~/.claude/settings.json:
Mac/Linux:
{
"mcpServers": {
"agentmemory": {
"command": "agentmemory-server",
"env": { "AGENT_MEMORY_DB_URL": "postgres://..." }
}
},
"hooks": {
"Stop": [
{ "type": "command", "command": "agentmemory-server save-session" }
]
}
}Windows:
{
"mcpServers": {
"agentmemory": {
"command": "agentmemory-server",
"env": { "AGENT_MEMORY_DB_URL": "postgres://..." }
}
},
"hooks": {
"Stop": [
{ "type": "command", "command": "cmd /c agentmemory-server save-session" }
]
}
}Wire up Copilot
Add to task-completion-notify.json:
Mac/Linux:
{
"hooks": {
"Stop": [
{ "type": "command", "command": "agentmemory-server save-session" }
]
}
}Windows:
{
"hooks": {
"Stop": [
{ "type": "command", "command": "cmd /c agentmemory-server save-session" }
]
}
}MCP tools available to agents
| Tool | Purpose |
|---|---|
| save_session | Save a completed session (called by stop hook) |
| save_memory | Save a curated memory (feedback, project, user, reference) |
| update_memory | Update an existing memory by slug |
| delete_memory | Soft-delete a memory |
| get_memory_index | List all memory titles — lightweight, call at session start |
| get_memory | Get full memory body by slug |
| recall_memories | Full-text + tag search over curated memories |
| recall_sessions | Search session history by keyword, project, user, tool/skill used |
| get_session | Get a full session record with all items |
How identity works
user_name and hostname are resolved automatically from os.userInfo().username and os.hostname(). No configuration needed. Works identically on Mac and Windows.
