A Model Context Protocol (MCP) server for PostgreSQL, acting as a super memory and task tracker for AI assistants.
Project description
Pg-Mnemosyne MCP
A Model Context Protocol (MCP) server that provides AI assistants with a robust "super memory", task tracker, and dynamic PostgreSQL database management capabilities.
⚡ Quick Start
-
Install the package globally (recommended):
pipx install pg-mnemosyne-mcp
Note: If you get an 'externally-managed-environment' error, either use
pipx(recommended) or add--break-system-packagesto your pip command. -
Auto-configure all your AI agents (Claude, Gemini, Qwen, Cursor, etc.) at once:
pg-mnemosyne init --dsn "postgresql://user:password@localhost:5432/postgres"
-
Restart your AI agents. You're done!
Features
- High-Performance: Uses cached connection pooling (
asyncpg.create_pool) for instant sub-millisecond database queries. - Dynamic Projects: The AI can create new databases for different projects on the fly.
- Dynamic Schema: The AI can modify table schemas dynamically to adapt to changing memory needs.
- Standard Memory Tracker: Built-in support for tracking, updating, and deleting memory items with tags.
- Advanced Task Management: Dedicated tasks schema with fields for status transitions, priority, and deadlines.
- Multi-Agent Coordination: Centralized session tracking preventing duplicate coding and file-editing conflicts.
- Raw SQL Execution: Gives AI ultimate flexibility for complex queries and DDL operations.
Setup
Users will need to provide their PostgreSQL credentials using the PG_BASE_DSN environment variable. This is a standard connection string:
postgresql://<USERNAME>:<PASSWORD>@<HOST>:<PORT>/<DEFAULT_DB>
Where to configure this (Client Setup)
The exact location depends on which AI client you are using. You need to add the server configuration to your client's MCP settings file.
For Claude Desktop:
- Mac:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
For Cursor:
- Go to
Settings>Features>MCPand add a new MCP server, or edit your project's.cursor/mcp.json.
For Roo Code / Cline (VS Code):
- Edit the MCP settings file located at
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json(Mac) or the equivalent Windows path.
For Gemini CLI & Qwen CLI:
- Open your global configuration file (usually located at
~/.gemini/settings.jsonor~/.qwen/settings.json). - Alternatively, use the CLI:
gemini mcp add pg-mnemosyne "/path/to/pg-mnemosyne" -e PG_BASE_DSN="postgresql://user:pass@localhost:5432/postgres" -s user # OR qwen mcp add pg-mnemosyne "/path/to/pg-mnemosyne" -e PG_BASE_DSN="postgresql://user:pass@localhost:5432/postgres" -s user
For Claude Code CLI:
- The easiest way is to add it via the CLI:
claude mcp add pg-mnemosyne "/path/to/pg-mnemosyne" -e PG_BASE_DSN="postgresql://user:pass@localhost:5432/postgres" -s user
- Manually, it lives in your global config at
~/.claude.json.
For Codex CLI:
- The easiest way is to add it via the CLI:
codex mcp add pg-mnemosyne --env PG_BASE_DSN="postgresql://user:pass@localhost:5432/postgres" -- pg-mnemosyne
- Manually, it lives in your global config at
~/.codex/config.toml(TOML format).
For Windsurf IDE:
- Edit your global config at
~/.codeium/windsurf/mcp_config.json. - Alternatively, click the Hammer (MCP) icon in the Cascade panel and select Configure.
For Antigravity CLI (agy): Antigravity uses a plugin-based system. To add the server:
- Create a plugin directory:
mkdir -p ~/.gemini/config/plugins/pg-mnemosyne - Create
~/.gemini/config/plugins/pg-mnemosyne/mcp_config.jsonwith the Standard Template below. - Add an entry to your
~/.gemini/config/import_manifest.jsonunder the"imports"array:{ "name": "pg-mnemosyne", "source": "manual", "components": ["mcpServers"] }
Configuration Template (Claude Desktop, Cursor, Roo Code, Gemini CLI, Claude Code, Antigravity, Windsurf):
{
"mcpServers": {
"pg-mnemosyne": {
"command": "pg-mnemosyne",
"env": {
"PG_BASE_DSN": "postgresql://postgres:my_password@localhost:5432/postgres"
}
}
}
}
For OpenCode:
- Edit your OpenCode configuration file located at
~/.config/opencode/opencode.jsonc.
Configuration Template (OpenCode):
{
"mcp": {
"pg-mnemosyne": {
"type": "local",
"command": ["pg-mnemosyne"],
"environment": {
"PG_BASE_DSN": "postgresql://postgres:my_password@localhost:5432/postgres"
}
}
}
}
Running the Server (Standalone)
pg-mnemosyne run
This starts the MCP server using standard input/output.
CLI Usage
The pg-mnemosyne command also acts as a standalone CLI for managing your data and configuring agents.
Auto-Initialization
You can automatically configure all supported AI agents (Claude, Gemini, Qwen, Cursor, etc.) with a single command:
pg-mnemosyne init --dsn "postgresql://user:pass@localhost:5432/postgres"
Manual Record Management
You can add and list records directly from your terminal:
# Add a record
pg-mnemosyne add my_project_db todo "Finish the documentation"
# List records
pg-mnemosyne list my_project_db --type todo
🤝 Multi-Agent Coordination & Advanced Tasks
Pg-Mnemosyne includes specialized schemas to help complex multi-agent setups (e.g. Gemini CLI, Codex CLI, Roo Code, Claude Desktop) coordinate on the same project:
📋 Professional Tasks Schema
Spin up a dedicated tasks table with fields for statuses (backlog, todo, in_progress, blocked, done), priority levels (low, medium, high, critical), tags, and deadlines:
pg-mnemosyne init-todo my_project_db
🛰️ Agent Coordination Hub
Avoid merge conflicts, double-coding, and redundant compiler troubleshooting by initializing the shared agent_sessions coordination table:
pg-mnemosyne init-coordination my_project_db
When active, agents use the update_agent_session and get_active_sessions MCP tools to register their current editing files and active subtasks, creating a real-time bulletin board for mutual visibility!
Available MCP Tools
create_project_db(db_name: str): Creates a new isolated PostgreSQL database.init_schema(db_name: str): Initializes the baserecordstable.init_todo_schema(db_name: str): Initializes a professionaltaskstable.init_coordination_schema(db_name: str): Initializes the multi-agentagent_sessionstable.add_column(db_name: str, table: str, column_name: str, data_type: str): Dynamically adds a column to any table.add_record(db_name: str, type: str, content: str, tags: list[str]): Adds a memory/todo record.get_records(db_name: str, type: str = None, limit: int = 50): Retrieves recent records.update_record(db_name: str, record_id: int, content: str = None, tags: list[str] = None, status: str = None): Partially updates a record.delete_record(db_name: str, record_id: int): Deletes a record by ID.update_agent_session(db_name: str, agent_name: str, active_task: str, active_file: str = None, status: str = "active"): Registers/updates active agent state.get_active_sessions(db_name: str): Lists active agent coordination sessions.run_sql(db_name: str, query: str): Runs arbitrary SQL (SELECT, INSERT, DDL, etc.).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pg_mnemosyne_mcp-0.1.1.tar.gz.
File metadata
- Download URL: pg_mnemosyne_mcp-0.1.1.tar.gz
- Upload date:
- Size: 886.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6597c9e6f22fe528756a5e3ce5a2b9d3a258c9df334f7048faffee6c4527a717
|
|
| MD5 |
6f0b2ac4b5ff40cb5ca1149e15d7eab7
|
|
| BLAKE2b-256 |
6a7496c9463ba71f02d9606abc6f783ab03a91c490e43ee7df1a463d728bdcf4
|
Provenance
The following attestation bundles were made for pg_mnemosyne_mcp-0.1.1.tar.gz:
Publisher:
publish.yml on Janadasroor/pg-mnemosyne-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pg_mnemosyne_mcp-0.1.1.tar.gz -
Subject digest:
6597c9e6f22fe528756a5e3ce5a2b9d3a258c9df334f7048faffee6c4527a717 - Sigstore transparency entry: 1630581311
- Sigstore integration time:
-
Permalink:
Janadasroor/pg-mnemosyne-mcp@afba584877d40d73644a4d17156b5f06c4ea2e4b -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Janadasroor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@afba584877d40d73644a4d17156b5f06c4ea2e4b -
Trigger Event:
push
-
Statement type:
File details
Details for the file pg_mnemosyne_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pg_mnemosyne_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f94a9335539ce73e4ea7dfe59fe7fd7e12bdee2bebbe24ebf3548ded4603724
|
|
| MD5 |
5f51b7d2dc967867b3e177cc8f5a8d9b
|
|
| BLAKE2b-256 |
4e5ab6020429ee1d7f70689e0e8a8aacbe84bd2c4d706313964a2423bc7bbcf4
|
Provenance
The following attestation bundles were made for pg_mnemosyne_mcp-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on Janadasroor/pg-mnemosyne-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pg_mnemosyne_mcp-0.1.1-py3-none-any.whl -
Subject digest:
0f94a9335539ce73e4ea7dfe59fe7fd7e12bdee2bebbe24ebf3548ded4603724 - Sigstore transparency entry: 1630581317
- Sigstore integration time:
-
Permalink:
Janadasroor/pg-mnemosyne-mcp@afba584877d40d73644a4d17156b5f06c4ea2e4b -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Janadasroor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@afba584877d40d73644a4d17156b5f06c4ea2e4b -
Trigger Event:
push
-
Statement type: