MCP and the Open Brain: Why Model Context Protocol Matters
Model Context Protocol is the TCP/IP of AI memory. An open brain without MCP support is a silo. With it, any AI client — Claude Desktop, Cursor, Zed — reads from the same store.
What MCP Is, Briefly
Standardizing LLM Connectivity
The Model Context Protocol (MCP), released by Anthropic in November 2024, is an open-source standard designed to decouple AI applications from the data sources they consume. It utilizes JSON-RPC 2.0 to create a universal interface between LLM hosts and external systems, eliminating the need for fragmented, proprietary connectors.
Architecture Components
The protocol operates on a client-server model similar to the Language Server Protocol (LSP). In this ecosystem, Hosts (such as Claude Desktop, Cursor, or Zed) initiate connections via embedded Clients. These clients communicate with Servers that expose three primary primitives:
- Resources: Read-only data sources, such as local files or API responses, that provide static context.
- Tools: Executable functions that allow the LLM to perform actions, such as querying a database or triggering a webhook.
- Prompts: Pre-defined templates that guide the LLM through specific complex workflows.
By implementing an MCP open brain memory system, developers ensure that any compatible AI client can access a centralized knowledge base without rewriting integration logic for every new tool.
Why an Open Brain Needs MCP
Solving the N×M Integration Problem
Traditional AI integrations suffer from exponential complexity. If a user maintains five different memory stores (e.g., Notion, Obsidian, Postgres, Slack, and Gmail) and utilizes six different AI clients (e.g., Claude, ChatGPT, Cursor, Zed, Perplexity, and custom agents), they face an N×M problem requiring 30 distinct integrations to achieve full connectivity.
Linear Scaling via Standardization
MCP transforms this complexity into a linear N+M model. By deploying a single MCP server for each memory store, every compatible client gains immediate access to that data. The architectural shift moves the burden of integration from the client-side to a standardized server layer.
The Open Brain Architecture
An Open Brain system leveraging Supabase and pgvector benefits most from this approach. Instead of building custom plugins for every IDE or chat interface, the developer exposes one MCP server that interfaces with the Postgres vector store. This allows a unified memory state where an agent in Cursor can retrieve the same context as a prompt in Claude Desktop.
| Metric | Custom Integrations (N×M) | MCP Standard (N+M) |
|---|---|---|
| Development Effort | High (per client/source pair) | Low (once per source) |
| Maintenance | Fragile; breaks on API updates | Stable; centralized server logic |
| Interoperability | Siloed | Universal across MCP hosts |
A Working MCP Server, Complete
Implementing Vector Memory Retrieval
The following Python implementation creates an MCP server that connects to a Supabase instance. It uses pgvector for cosine similarity searches and the Nomic Embed API to vectorize incoming queries, enabling high-precision AI memory retrieval.
import asyncio
from mcp.server.fastmcp import FastMCP
import psycopg
from pgvector.psycopg2 import register_vector
import requests
# Initialize MCP Server
mcp = FastMCP("OpenBrain-Memory")
SUPABASE_DB_URL = "postgresql://postgres:[PASSWORD]@db.[REF].supabase.co:5432/postgres"
NOMIC_API_KEY = "your_nomic_key"
async def get_embedding(text):
resp = requests.post(
"https://api.nomic.ai/v1/embeddings",
headers={"Authorization": f"Api-Key {NOMIC_API_KEY}"},
json={"model": "nomic-embed-text-v1.5", "text": text}
)
return resp.json()["embedding"]
@mcp.tool()
async def search_memories(query: str) -> str:
"""Search the open brain memory for relevant context using vector similarity."""
embedding = await get_embedding(query)
with psycopg.connect(SUPABASE_DB_URL) as conn:
# pgvector registration is handled via the connection
with conn.cursor() as cur:
cur.execute(
"SELECT content, metadata FROM memories ORDER BY embedding <=> %s LIMIT 5",
(embedding,)
)
results = cur.fetchall()
if not results:
return "No relevant memories found."
formatted = "\n---\n".join([f"{r[0]} (Meta: {r[1]})" for r in results])
return f"Top 5 matching memories:\n{formatted}"
if __name__ == "__main__":
mcp.run()
Client Configuration
To register this server in Claude Desktop, add the following entry to the claude_desktop_config.json file located in the application support folder:
{
"mcpServers": {
"open-brain": {
"command": "python",
"args": ["/path/to/your/server.py"]
}
}
}
Where to Go From Here
Expanding Memory Capabilities
The basic retrieval tool is a starting point. To build a fully autonomous MCP open brain memory, developers should implement bidirectional tools. Adding insert_memory and update_memory functions allows the LLM to not only read from its history but actively curate its own knowledge base in real-time.
Implementing Static Resources
Beyond tools, MCP supports resources. By exposing the entire memory index as a browsable resource, users can allow an AI to scan the structure of their knowledge graph or list all available memory categories without performing a vector search first.
Implementing a 'get_related' tool that recursively fetches linked memories allows for multi-hop reasoning, moving beyond simple RAG into complex cognitive retrieval.
Technical Documentation
For the full protocol specification, refer to modelcontextprotocol.io. For a production-ready reference implementation of these concepts, the NovCog Brain starter repository on GitHub provides maintained templates for Supabase and pgvector integration.