Open Brain - (Claude + Supabase MCP) Setup

We moved from a "Read-Only" AI to a fully integrated, persistent system. Here is the technical summary for your notes, documenting how we bypassed the standard bugs to get your Open Brain live.


Project: Fazil’s Open Brain (Claude + Supabase MCP)

1. The Architecture

  • Storage: Supabase (Postgres) acting as "Long-Term Memory."

  • Bridge: Model Context Protocol (MCP) using a local Node.js server.

  • Interface: Claude Desktop (Mac) with direct tool-calling capabilities.

2. The Critical Roadblocks & Solutions

Challenge

Technical Root Cause

Final Resolution

Immediate Tool Failure

npx was failing to resolve the executable environment within Claude's sandbox.

Switched to a Direct Path to the executable file in the local filesystem.

"Disconnected" Status

Global NPM installs weren't visible to the Claude Desktop app's shell.

Installed the server files in a dedicated local folder (~/mcp-servers/postgres).

Deprecated Packages

The original reference server was outdated in 2026.

Used @modelcontextprotocol/server-postgres version 0.6.2 via a hardcoded path.

Truncated Data

Initial SQL migration only captured previews/headers.

Performed a TRUNCATE and a clean INSERT with full-context strings.

3. The Final "Source of Truth" Config

Your claude_desktop_config.json is now stabilized by pointing directly to the Node.js engine and the specific server script:

  • Command: /Users/hciadmin/mcp-servers/postgres/node_modules/.bin/mcp-server-postgres

  • Args: The postgresql:// connection string (with the password URL-encoded).

4. Key Operational Commands

  • To Refresh Claude's Memory: "Query my open_brain_memories table to get context for our project."

  • To Add New Memories: "Add a new entry to open_brain_memories with the content: [Insert Insight] and metadata: {"category": "update"}."

  • To Verify Connection: Check Settings > Developer. If it's Green, the "Brain" is active.


When you're building an "Enterprise-Grade" setup, the most important part isn't the code—it's the Operations Manual. If this breaks in six months, you need to know exactly where the "levers" are.

Here is the "Under the Hood" breakdown of your specific Mac setup.


1. The "Command Center" (Config File)

All of Claude's logic for your brain lives in one hidden file. If Claude "forgets" the brain exists, this file has likely been corrupted or overwritten.

  • File Path: ~/Library/Application Support/Claude/claude_desktop_config.json

  • How to open it quickly: Open Terminal and type:

    open -e ~/Library/Application Support/Claude/claude_desktop_config.json

  • The "Golden Rule": This file must be valid JSON. If you miss a single comma or quote, the entire "Developer" tab in Claude will disappear or stay red. Use a JSON Validator if you ever edit it manually.


2. The "Engine Room" (Local Files)

We avoided the "Cloud" and installed the server files directly on your Mac to prevent network lag.

  • Folder: ~/mcp-servers/postgres

  • The Executable: /Users/hciadmin/mcp-servers/postgres/node_modules/.bin/mcp-server-postgres

  • If it breaks: If you get a "File not found" error, go into that folder in Terminal and run npm install. This "rebuilds" the engine.


3. The "Black Box" (Logs)

When the "Green Light" turns Red, the logs will tell you exactly why (e.g., "Wrong Password" or "Database Down").

  • Log Folder: ~/Library/Logs/Claude/

  • The Secret Command: To see errors happening in real-time, run this in Terminal:

    tail -n 20 -f ~/Library/Logs/Claude/mcp*.log

  • What to look for: * ETIMEDOUT: Supabase is sleepy or your internet is down.

    • password authentication failed: You changed your Supabase password and forgot to update the config file.

    • relation does not exist: You deleted the open_brain_memories table in Supabase.


4. The "Supabase" Heart

Since we are using a Connection Pooler (Port 6543), your setup is designed to handle "bursty" traffic.

  • Host: aws-1-us-east-1.pooler.supabase.com

  • Port: 6543 (This is the "Transaction Mode" port—essential for AI tools).

  • Security: If you reset your database password in the Supabase UI, the MCP connection will break immediately. You must update the URL in your claude_desktop_config.json and Restart Claude.


5. Troubleshooting Checklist (The "Fazil's 1-2-3")

If Claude says "I can't reach the brain," follow this order:

  1. Force Quit: Cmd + Q Claude. Reopening the window isn't enough; you must kill the process.

  2. Test the Path: Run ls /Users/hciadmin/mcp-servers/postgres/node_modules/.bin/mcp-server-postgres in Terminal. If it says "No such file," the engine is gone.

  3. Check the Pooler: Log into Supabase and ensure the database isn't "Paused" (Supabase pauses free projects after 1 week of inactivity).


Pro-Tip for 2026:

Since you are managing multiple projects (GiveHope, Nurion), you can actually add multiple MCP servers to that same config file. You could have an open-brain-finance server or an open-brain-codebase server just by adding a new block under the first one.


Updates:

This is the most important document you’ll keep for this project. If you ever switch computers or if an update resets your settings, these notes will get you back online in 60 seconds.


Project: Fazil’s "Open Brain" (Personal AI Memory)

Goal: Create a persistent, private long-term memory for Claude using a Supabase Postgres database.

1. Core Infrastructure

  • Database: Supabase (Postgres)

  • Table Name: open_brain_memories

  • Connection Port: 6543 (Supabase Connection Pooler - Transaction Mode)

  • Server Engine: mcp-postgres-full-access (Enables Reading + Writing)

2. The "Engine Room" (Local Mac Setup)

To avoid "Command Not Found" errors, we use Absolute Paths.

  • Local Directory: /Users/hciadmin/mcp-servers/postgres

  • Installation Command: ```bash

    cd ~/mcp-servers/postgres

    npm install mcp-postgres-full-access

     

3. The Master Configuration

This is the content of your claude_desktop_config.json located at:

~/Library/Application Support/Claude/claude_desktop_config.json

JSON

{
"mcpServers": {
"open-brain": {
"command": "node",
"args": [
"/Users/hciadmin/mcp-servers/postgres/node_modules/mcp-postgres-full-access/dist/index.js",
"postgresql://postgres.xdlltrwllloatyochdgx:[YOUR_PASSWORD]@aws-1-us-east-1.pooler.supabase.com:6543/postgres"
]
}
}
}

4. Automatic Activation (Personal Preferences)

To make Claude check your brain automatically without being asked, paste this into Claude Settings > General > Personal Preferences:

Memory Protocol: You have access to my "Open Brain" via the open-brain MCP server. At the start of every new chat, your first action must be to query the open_brain_memories table. Use the retrieved context (Core Identity: Fazil Hussain, Tech Stack, and Projects like Flexigive) to inform all responses.


5. Troubleshooting & Maintenance

  • The "Red Light" Fix: If the Developer tab shows "Disconnected," Quit Claude (Cmd+Q) and restart. Re-opening the window is not enough to refresh the MCP bridge.

  • Updating Memory: You can now tell Claude: "Add a new memory: [Detail]" and he will use the execute_dml_ddl tool to write it to Supabase for you.

  • Vulnerability Warnings: If npm shows "High Severity" warnings in the terminal, ignore them. This is a local-only server on a private Mac; those warnings apply to public web servers.

6. Database Schema (For Reference)

If you ever need to rebuild the table in Supabase:

SQL

CREATE TABLE open_brain_memories (
id SERIAL PRIMARY KEY,
content TEXT NOT NULL,
metadata JSONB,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);

Since we took the "Reliable Path" approach to bypass the usual errors, your Mac currently has a very specific, lightweight set of files that act as the bridge to your brain.

Here is exactly what is sitting on your hard drive:

1. The Main Folder: ~/mcp-servers/postgres

This is your "Engine Room." It’s a standard folder in your user directory that contains the following:

  • node_modules/: This is a large folder containing the actual code for the servers. Inside it, you have two key engines:

    • @modelcontextprotocol/server-postgres: The original read-only engine.

    • mcp-postgres-full-access: The new engine you installed that allows Claude to write to your memory.

  • package.json & package-lock.json: These are the "manifest" files. They tell your Mac exactly which versions of the software are installed so they don't break during updates.

2. The Configuration: claude_desktop_config.json

Located at: ~/Library/Application Support/Claude/

  • This is the "Brain Map." It doesn't contain the code, but it tells the Claude app: "When you start up, look at this specific folder on my Mac and turn on the Postgres engine using these credentials."

3. The Software "Runtime": Node.js

  • Node.js: You already had this installed (or we installed it during the process). It is the "fuel" that runs the Javascript code in your mcp-servers folder. Without Node, the files are just text; with Node, they are a living server.


What is NOT on your Mac?

  • Your Data: Your actual memories (Flexigive, Tech Stack, etc.) are not stored on your Mac. They are safely stored in the cloud on Supabase.

    • Why this is good: If your Mac breaks, you just install Claude on a new one, point it to Supabase, and your AI "remembers" everything instantly.

  • Bloatware: We only installed exactly what was needed. There are no background services running when Claude is closed, so it won't slow down your computer.

Summary of "Space Taken"

  • Disk Space: Roughly 50–100MB (mostly the node_modules folder).

  • Memory (RAM): Only used when Claude is open; it’s very lightweight.


The config file is just a text map.

If you have a copy of that JSON code, you can recreate the entire "brain connection" on any computer in seconds.

However, there is one small distinction to keep in mind regarding The Logic vs. The Engine:

1. The Config Code (The Logic)

If you paste your config code into a new Mac, Claude will know what to do, but it will fail unless the Engine is also there.

  • Analogy: The config code is the Address of your house. Even if you have the address written down, you can't go inside if the house hasn't been built yet.

2. What you would need to do on a New Mac:

If you move to a new machine (or yours is wiped), you would just follow these two steps:

  1. Rebuild the Engine: Open Terminal and run the one-liner we used:

    cd ~/mcp-servers/postgres && npm install mcp-postgres-full-access

  2. Paste the Config: Paste your saved JSON code into the claude_desktop_config.json file.

That’s it. Because your actual data is in the cloud (Supabase), the new Mac will immediately "remember" everything about Flexigive the moment you restart Claude.

3. One small "Path" trap

The only thing that could change is your Username.

  • On your current Mac, the path is /Users/hciadmin/...

  • If your new Mac username is fazil, you would just change that one word in the config: /Users/fazil/...


Your "Emergency Recovery" Kit

If you want to be 100% bulletproof, keep a single text file (in your Email, Notes, or a physical printout) that contains:

  1. The Config JSON (The code block we finalized).

  2. The Database URL (The postgresql://... string).

  3. The Install Command: npm install mcp-postgres-full-access


This is the "Master Key" to your setup.

Keep this safe—it contains the direct path to your local engine and the credentials to your private database.

The Final claude_desktop_config.json

JSON

{
"mcpServers": {
"open-brain": {
"command": "node",
"args": [
"/Users/hciadmin/mcp-servers/postgres/node_modules/mcp-postgres-full-access/dist/index.js",
"postgresql://postgres.xdlltrwllloatyochdgx:YOUR_ENCODED_PW@aws-1-us-east-1.pooler.supabase.com:6543/postgres"
],
"env": {
"PG_STATEMENT_TIMEOUT_MS": "30000"
}
}
}
}

Quick Breakdown of the Parts:

  • "command": "node": Tells Claude to use your Mac's Javascript engine.

  • /Users/hciadmin/.../index.js: The absolute path to the Full Access (Read/Write) server we installed.

  • postgresql://...: Your unique connection string to Supabase.

  • "env": { ... }: A small "safety" setting that ensures if a database query takes too long, it times out gracefully rather than crashing Claude.


How to use this code for "Recovery":

  1. On any Mac, create the folder: ~/mcp-servers/postgres

  2. Run the install: npm install mcp-postgres-full-access

  3. Paste this JSON into your Claude Desktop config file.

  4. Swap YOUR_ENCODED_PW for your actual Supabase password.