Open Brain
A remote MCP server enabling semantic memory across multiple AI platforms like Perplexity Comet and Claude Desktop, with vector embeddings for intelligent retrieval.
README
Open Brain: Multi-Client MCP Deployment
A complete Model Context Protocol (MCP) server deployment enabling semantic memory across multiple AI platforms (Perplexity Comet, Claude Desktop) through a single remote server with Cloudflare tunnel and client-specific authentication strategies.
Overview
Open Brain is a personal semantic memory system that captures thoughts, decisions, ideas, and action items with vector embeddings for intelligent retrieval. This repository documents the complete deployment architecture of the Open Brain (OB1) architecture by Nate B. Jones and includes:
- Remote MCP server (Node.js, Ollama embeddings, Supabase vector storage)
- Cloudflare Tunnel for secure public HTTPS access (For Perplexity Comet)
- Perplexity Comet integration (direct API key auth)
- Claude Desktop integration (local stdio proxy to bypass OAuth requirement)
Full credit: The OB1 protocol, architecture, and concept were created by Nate B. Jones. This project adapts his work. Please star and follow the original OB1 repository.
Architecture
Two Node.js Servers:
- Remote MCP Server (
server.mjs) - Port 3101, handles all MCP requests, embeddings, database - Local Proxy Server (
proxy-server.js) - Claude Desktop only, runs locally, forwards to server.mjs
Two Different Paths:
- Perplexity Comet: Direct HTTPS → Cloudflare Tunnel → server.mjs (remote)
- Claude Desktop: stdio → proxy-server.js (local) → server.mjs (local OR remote, no Cloudflare)
┌──────────────────────────────────────────────────────────────────┐
│ CLIENT LAYER │
├──────────────────────────────────────────────────────────────────┤
│ │
│ Claude Desktop Perplexity Comet │
│ (stdio MCP client) (Direct HTTPS) │
│ │ │ │
│ │ │ │
│ ┌────────────────────────┐ │ │
│ │ Local Proxy Server │ │ │
│ │ proxy-server.js │ │ │
│ │ Node.js (localhost) │ │ │
│ │ stdio ↔ HTTP(S) bridge │ │ │
│ └──────┬─────────────────┘ │ │
│ │ │ │
│ │Direct HTTP(S) │ │
│ │(no Cloudflare) │ │
│ │ ↓ │
├─────────│────────────────────────────────────────────────────────┤
│ │ Cloudflare Tunnel (Perplexity ONLY) │
│ │ https://your-subdomain.your-domain.com │
│ │ - Access Policy: Bypass for /mcp path │
│ │ - WAF: Skip security for PerplexityBot UA │
│ │ - IP Whitelist: ASN AS16509 (AWS/Perplexity) │
│ │ │ │
│─────────│───────────────────────────────────────────│────────────┤
│ ↓ YOUR COMPUTER/SERVER (Port 3101) ↓ │
│ ┌───────────────────────────────────────────────────────────┐ │
│ │ Remote MCP Server (server.mjs) │ │
│ │ Node.js Express Server │ │
│ │ - Streamable HTTP: /mcp │ │
│ │ - SSE: /sse │ │
│ │ - Health: /health │ │
│ │ - Multi-auth: query param, header, Bearer token │ │
│ └────────────────────────┬──────────────────────────────────┘ │
│ │ │
│ ┌────────────┴────────────┐ │
│ ↓ ↓ │
│ ┌────────────────────┐ ┌────────────────────┐ │
│ │ Ollama │ │ Supabase │ │
│ │ Port: 11434 │ │ (Cloud PostgreSQL) │ │
│ │ Model: │ │ - pgvector ext │ │
│ │ nomic-embed-text │ │ - thoughts table │ │
│ │ Embeddings (768d) │ │ - 768-dim vectors │ │
│ └────────────────────┘ └────────────────────┘ │
└──────────────────────────────────────────────────────────────────┘
Claude Desktop Proxy Configuration:
// proxy-server.js can point to:
const REMOTE_URL = 'http://localhost:3101/mcp'; // Local server
// OR
const REMOTE_URL = 'https://your-domain.com/mcp'; // Remote via Cloudflare
// OR
const REMOTE_URL = 'https://direct-ip:3101/mcp'; // Remote direct (no Cloudflare)
The Challenge: Multi-Client MCP Deployment
Problem 1: Remote MCP Server Access
Most MCP implementations assume local stdio servers. Deploying a remote MCP server accessible to multiple clients requires:
- Public HTTPS endpoint
- Authentication that works across different client capabilities
- Security hardening (Cloudflare Access, WAF rules)
- Multiple transport support (Streamable HTTP, SSE)
Problem 2: Claude Desktop's OAuth Requirement
Claude Desktop only supports OAuth for remote MCP servers configured via UI. It doesn't support:
- Simple API key authentication in
claude_desktop_config.json - Direct HTTPS URLs with auth in config file
- The
npx mcp-remotewrapper (Windows path issues)
Solution: Client-Specific Integration Strategies
Perplexity Comet: Direct connection via Settings → Integrations
- URL:
https://your-domain.com/mcp - Auth: API Key field (sent as header)
- Transport: Streamable HTTP
Claude Desktop: Local stdio proxy (this repository)
- Runs locally as stdio MCP server
- Forwards requests to remote server with API key
- Bypasses OAuth requirement entirely
Repository Contents
This repository contains the complete Open Brain deployment:
ob1-local-stack/
├── server.mjs # Open Brain MCP server (main)
├── proxy-server.js # Claude Desktop stdio proxy
├── schema.sql # Supabase database schema
├── package-server.json # Server dependencies
├── package.json # Proxy dependencies
├── .env.server.example # Server configuration template
├── .env.example # Proxy configuration template
├── DEPLOYMENT.md # Complete deployment guide
├── README.md # This file
├── .gitignore # Secrets exclusion
└── LICENSE # MIT License
Quick Start
Prerequisites
- Node.js 18+ installed
- Claude Desktop installed (for proxy integration)
- Supabase account (for full deployment)
- Ollama installed (for full deployment)
Two deployment options:
- Use existing Open Brain server - Just run the Claude Desktop proxy (Quick Start below)
- Deploy your own server - See DEPLOYMENT.md for complete setup guide
Installation
- Clone this repository:
git clone https://github.com/shawnsammartano-hub/ob1-local-stack.git
cd ob1-local-stack
- Install dependencies:
npm install
- Configure your remote server:
Edit proxy-server.js lines 10-11:
const REMOTE_URL = 'https://your-openbrain-domain.com/mcp';
const API_KEY = 'your-api-key-here';
SECURITY WARNING: Never commit your actual API key or domain to Git. Keep credentials local only.
- Configure Claude Desktop:
Edit claude_desktop_config.json:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"open-brain": {
"command": "node",
"args": ["C:\\path\\to\\ob1-local-stack\\proxy-server.js"]
}
}
}
Important for Windows: Use double backslashes \\ in the path.
- Restart Claude Desktop:
- Windows: Task Manager → End Task on Claude → Reopen
- macOS: Cmd+Q to quit completely → Reopen
- Verify connection:
Click the hammer icon (🔨) in Claude Desktop. You should see "open-brain" with 4 tools:
capture_thoughtsearch_thoughtsbrowse_thoughtsstats
Testing
Manual Proxy Test
node proxy-server.js
Send this JSON-RPC request (press Enter twice after pasting):
{"jsonrpc":"2.0","method":"tools/list","params":{},"id":1}
Expected output:
[Proxy] Forwarding tools/list request
[Proxy] Received 4 tools
{"result":{"tools":[...]}}
Press Ctrl+C to stop.
In Claude Desktop
Test with:
Save this to my Open Brain: Testing Claude Desktop proxy connection
Expected behavior:
- Claude calls
capture_thoughttool - Proxy terminal shows
[Proxy] Forwarding tool call: capture_thought - Remote server processes via Ollama embeddings
- Thought saved to Supabase
- Claude confirms success
Technical Deep Dive
Why a Local Proxy?
Claude Desktop's remote server support has three critical limitations:
- OAuth-only authentication - Doesn't support API keys in config
- Windows path quoting issues -
npx mcp-remotefails with spaces in paths - Unreliable HTTPS handling - Connection errors with direct URLs
The stdio proxy bypasses all three:
- Acts as a local stdio server (fully supported by Claude Desktop)
- Forwards requests to remote HTTPS server with API key auth
- Handles both JSON-RPC and SSE response formats
MCP SDK Implementation
Uses @modelcontextprotocol/sdk v1.27.1 with schema-based request handlers:
import {
ListToolsRequestSchema,
CallToolRequestSchema
} from '@modelcontextprotocol/sdk/types.js';
server.setRequestHandler(ListToolsRequestSchema, async () => {
// Forward to remote server, parse response
});
server.setRequestHandler(CallToolRequestSchema, async (request) => {
// Forward tool execution, return result
});
Key pattern:
- SDK v1.x uses schema objects, not string method names
- Handlers must return exact structure expected by protocol
- SSE responses require parsing
data:lines before JSON decode
Request Flow
- Claude Desktop sends JSON-RPC via stdio to proxy
- Proxy receives via
StdioServerTransport - Proxy forwards to remote via HTTPS POST with API key
- Remote server processes (Ollama embedding, Supabase query)
- Response parsing:
- SSE format: Extract
data: {...}line → parse JSON - JSON format: Parse directly
- SSE format: Extract
- Return to Claude Desktop via stdio
Error Handling
All errors logged to stderr (visible in Claude Desktop logs):
Windows: %APPDATA%\Claude\logs\mcp-server-open-brain.log
macOS: ~/Library/Logs/Claude/mcp-server-open-brain.log
Common errors:
HTTP 401: Invalid API keyConnection refused: Remote server downJSON parse error: SSE format mismatch
Troubleshooting
Proxy won't start
- Check Node.js version:
node --version(need 18+) - Verify dependencies:
npm install - Check paths: Windows paths must use
\\not\in config file
Tools don't appear in Claude Desktop
- Check Claude Desktop logs in
%APPDATA%\Claude\logs\ - Verify proxy is configured correctly in
claude_desktop_config.json - Ensure Claude Desktop was fully restarted (Task Manager → End Task)
- Test proxy manually:
node proxy-server.jsthen send test JSON
"Server disconnected" error
- Verify API key is correct in
proxy-server.js - Check remote server is running and accessible
- Test remote endpoint:
curl https://your-domain.com/health - Look for errors in proxy stderr output
Windows "Cannot find module" errors
- Ensure you ran
npm installin the proxy directory - Check that
node_modulesfolder exists - Verify
package.jsonis in the same directory asproxy-server.js
Full Deployment Stack
Want to deploy your own Open Brain server? Here's the complete architecture:
1. Open Brain MCP Server
Stack:
- Node.js MCP server with multi-transport support
- Ollama (nomic-embed-text for 768-dim embeddings)
- Supabase (pgvector for semantic search)
- Express.js for HTTP/SSE endpoints
Key endpoints:
/mcp- Streamable HTTP (POST)/sse- Server-Sent Events (GET/POST)/health- Health check (GET)
Authentication:
- Query parameter:
?key=... - Header:
X-API-Key: ...orAuthorization: Bearer ...
2. Cloudflare Tunnel
Setup:
cloudflared tunnel create open-brain
cloudflared tunnel route dns open-brain your-domain.com
cloudflared tunnel run open-brain
Or as Windows service:
cloudflared service install <TOKEN>
Dashboard config:
- Public Hostname:
your-domain.com - Service:
http://localhost:3101 - Path: Leave blank for all traffic
3. Cloudflare Security Configuration
Access Policy (critical - order matters):
-
Path
/mcp: Bypass policy- Action: Bypass
- Include: Everyone
- DO NOT add Country requirement
- Must be ordered ABOVE domain-wide policy
-
Domain-wide: Email OTP
- Action: Allow
- Include: Email domain / OTP
WAF Custom Rules:
Rule: "Perplexity Bot Bypass"
- Field: User Agent
- Operator: contains
- Value:
PerplexityBot - Action: Skip → All remaining custom rules
IP Access Rules (optional):
- Whitelist ASN AS16509 (AWS - Perplexity backend)
4. Perplexity Comet Integration
Settings → Integrations → MCP Servers:
- Name: Open Brain
- URL:
https://your-domain.com/mcp - Authentication: API Key
- Key: (paste your API key in the auth field)
- Transport: Streamable HTTP
5. Claude Desktop Integration
This repository (the proxy you just installed).
What This Demonstrates
This project showcases:
- MCP Protocol Expertise: Multi-transport server, stdio proxy, schema-based handlers
- Full-Stack Deployment: Remote server, tunnel, security hardening, multi-client integration
- Problem-Solving: Working around platform limitations (Claude's OAuth requirement)
- Security Architecture: Cloudflare Access policies, WAF rules, API key management
- Node.js Patterns: Async/await, fetch API, JSON-RPC, SSE parsing
- Documentation: Clear problem statements, architecture diagrams, deployment guides
Open Brain Tools
Once connected, you have access to:
capture_thought
Save notes, decisions, ideas, action items with automatic semantic classification.
Auto-detects type:
action_item- Tasks, TODOsdecision- Choices made, commitmentsidea- Brainstorms, conceptsinsight- Learnings, realizationsnote- General information
search_thoughts
Semantic search across all saved content using vector similarity.
Parameters:
query(required): Search textthreshold(default 0.7): Similarity cutoff (0-1)limit(default 10): Max results
browse_thoughts
View recent thoughts chronologically.
Parameters:
limit(default 10): Number to retrievetype(optional): Filter by type
stats
Get database statistics: total thoughts, type breakdown, recent activity.
Performance Characteristics
- Capture latency: ~2-3 seconds (Ollama embedding + Supabase insert)
- Search latency: ~500ms (Supabase vector similarity query)
- Proxy overhead: <50ms (local stdio to remote HTTPS)
- Concurrent clients: Unlimited (stateless server architecture)
License
MIT License - see LICENSE file for details
Author
Shawn Sammartano
- LinkedIn · GitHub
- AI Enablement
- Areas of Study: AI Enablement, Enterprise AI Strategy, MCP Architecture
Acknowledgments
- Anthropic - Claude Desktop, MCP specification
- Perplexity AI - Comet custom instructions, MCP client support
- Cloudflare - Tunnel infrastructure, Access security
- Supabase - Vector database (pgvector)
- Ollama - Local embedding models
This project is a complete deployment architecture of:
Open Brain (OB1) by Nate B. Jones 🔗 https://github.com/NateBJones-Projects/OB1 📰 https://natesnewsletter.substack.com/
OB1 is the original architecture, protocol design, MCP tool schema, and concept. The thoughts table schema, match_thoughts function, and four-tool MCP design (capture_thought, search_thoughts, browse_thoughts, stats) are derived from OB1's original work.
Related Repositories
enterprise-rag-system- ChromaDB + Ollama RAG implementation
Contributing
Issues and pull requests welcome. For major changes, please open an issue first to discuss what you would like to change.
Roadmap
- [ ] Add authentication token rotation
- [ ] Implement conversation threading (link related thoughts)
- [ ] Add export functionality (Markdown, JSON)
- [ ] Multi-user support with user-scoped embeddings
- [ ] Web UI for browsing/searching thoughts
- [ ] Integration with additional AI platforms (ChatGPT, Cursor)
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。