Digital Brain MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add -e "DIGITAL_BRAIN_API_KEYS=${DIGITAL_BRAIN_API_KEYS}" -e "SUPABASE_URL=${SUPABASE_URL}" -e "SUPABASE_SERVICE_ROLE_KEY=${SUPABASE_SERVICE_ROLE_KEY}" -e "GOOGLE_API_KEY=${GOOGLE_API_KEY}" digital-brain -- npx -y @dswillden/digital-brain-mcp
Required:DIGITAL_BRAIN_API_KEYSSUPABASE_URLSUPABASE_SERVICE_ROLE_KEYGOOGLE_API_KEY
README.md

A persistent long-term memory system for AI clients

🧠 Digital Brain MCP

A Second Brain powered by Model Context Protocol (MCP), Google Gemini Embedding 2, and Supabase pgvector — deployed on Vercel.

Connect any MCP-compatible AI client (Claude, Cursor, OpenCode, Copilot, etc.) and give it persistent long-term memory. Store text, images, PDFs, audio, and video — all embedded in a unified vector space for cross-modal semantic search.


Architecture

AI Client (Claude / Cursor / OpenCode / Copilot)
        │
        ā–¼  MCP Protocol (Streamable HTTP + SSE)
        │  Authorization: Bearer <api-key>
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│   Vercel (Next.js)                       │
│   /api/mcp/[transport]                   │
│                                          │
│   ā”Œā”€ā”€ Auth Middleware ──┐                │
│   │  Bearer token check │                │
│   ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜                │
│                                          │
│   Tools:                                 │
│    • store_memory      (text)            │
│    • store_file        (base64 upload)   │
│    • store_file_from_url (URL fetch)     │
│    • search_memory     (cross-modal)     │
│    • get_file_url      (signed download) │
│    • list_memories                       │
│    • update_memory                       │
│    • delete_memory                       │
│    • get_stats                           │
│                                          │
│   REST Endpoint:                         │
│    • POST /api/upload  (direct file)     │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
           │             │
     ā”Œā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”  ā”Œā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
     ā–¼           ā–¼  ā–¼                  ā–¼
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│ Gemini  │  │  Supabase    │  │ Supabase  │
│ Embed 2 │  │  PostgreSQL  │  │ Storage   │
│  API    │  │  + pgvector  │  │ (files)   │
│         │  │  vector(768) │  │           │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Multimodal Embedding

Gemini Embedding 2 maps all modalities into the same 768-dimension vector space. This means:

  • A text query like "architecture diagram" can find a stored PNG image
  • Searching for "meeting notes" can return an audio recording of a meeting
  • A PDF of a research paper and a text summary live side by side in the same search space

Supported File Types

Modality MIME Types Limits
Image image/png, image/jpeg, image/webp, image/gif Up to 6 per request
PDF application/pdf Up to 6 pages
Audio audio/mpeg, audio/wav, audio/ogg, audio/mp3, audio/aac, audio/flac —
Video video/mp4, video/quicktime, video/webm Up to 120 seconds

Interleaved Embedding

When you provide a description alongside a file, the system creates an interleaved embedding — a single vector that captures both the visual/audio content AND your text description. This produces significantly richer search results compared to embedding the file alone.


How It Works

  1. You say (in Claude/Cursor/etc): "Remember that the EBR system uses Azure Functions for the API layer"
  2. MCP client calls your Digital Brain's store_memory tool
  3. Gemini Embedding 2 converts the text into a 768-dimension vector
  4. Supabase stores the text + vector in PostgreSQL with pgvector
  5. Later, you ask: "What tech does the EBR system use?"
  6. search_memory embeds your query, runs cosine similarity search, returns the matching memory

For files, the flow is the same — except the file bytes are sent to Gemini for multimodal embedding, and the raw file is stored in Supabase Storage with a signed download URL generated on retrieval.


Security Model

The server uses Bearer token authentication on every request:

  • Fail-closed: If no API keys are configured, ALL requests are rejected
  • Multi-key support: Set multiple comma-separated keys in DIGITAL_BRAIN_API_KEYS so each client gets its own key (and you can rotate independently)
  • Row Level Security (RLS): Enabled on the Supabase memories table — only service_role can access data. The anon key has zero access.
  • Service Role Key: Only stored server-side in Vercel env vars, never exposed to clients
  • Private Storage: The brain-files bucket is private — files are only accessible via time-limited signed URLs (1 hour expiry)

Generating API Keys

# Generate a strong 256-bit key
openssl rand -hex 32

Tech Stack

Component Technology Purpose
Embeddings Gemini Embedding 2 (gemini-embedding-2-preview) Multimodal embeddings — text, images, audio, video, PDF all in one vector space
Vector DB Supabase + pgvector PostgreSQL with vector similarity se

Tools (9)

store_memoryStores text-based memory in the vector database.
store_fileStores a file using base64 encoding.
store_file_from_urlFetches and stores a file from a provided URL.
search_memoryPerforms cross-modal semantic search across stored memories and files.
get_file_urlGenerates a signed download URL for a stored file.
list_memoriesLists stored memories.
update_memoryUpdates an existing memory entry.
delete_memoryDeletes a memory entry.
get_statsRetrieves statistics about the stored memory.

Environment Variables

DIGITAL_BRAIN_API_KEYSrequiredComma-separated API keys for authentication.
SUPABASE_URLrequiredThe URL of your Supabase project.
SUPABASE_SERVICE_ROLE_KEYrequiredThe service role key for Supabase database access.
GOOGLE_API_KEYrequiredAPI key for Google Gemini Embedding 2.

Configuration

claude_desktop_config.json
{"mcpServers": {"digital-brain": {"command": "npx", "args": ["-y", "@dswillden/digital-brain-mcp"], "env": {"DIGITAL_BRAIN_API_KEYS": "your-secret-key", "SUPABASE_URL": "your-url", "SUPABASE_SERVICE_ROLE_KEY": "your-key", "GOOGLE_API_KEY": "your-key"}}}}

Try it

→Remember that the EBR system uses Azure Functions for the API layer.
→Search my memory for information regarding the EBR system architecture.
→Store this PDF research paper and summarize its key findings.
→Find the meeting notes I saved last week about the project timeline.
→What tech stack does the EBR system use?

Frequently Asked Questions

What are the key features of Digital Brain MCP?

Persistent long-term memory for AI clients. Cross-modal semantic search for text, images, PDFs, audio, and video. Unified vector space using Google Gemini Embedding 2. Secure storage with Supabase pgvector and Row Level Security. Interleaved embedding for richer search results.

What can I use Digital Brain MCP for?

Storing project documentation and research papers for instant retrieval. Saving meeting audio recordings and searching them by topic. Maintaining a searchable knowledge base of code snippets and architecture diagrams. Creating a unified 'Second Brain' that links visual assets with text descriptions.

How do I install Digital Brain MCP?

Install Digital Brain MCP by running: npx -y @dswillden/digital-brain-mcp

What MCP clients work with Digital Brain MCP?

Digital Brain MCP works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Digital Brain MCP docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare