Skip to content

[recipes] Vercel + Neon + Telegram alternative architecture#37

Open
geoff-price wants to merge 4 commits intoNateBJones-Projects:mainfrom
geoff-price:recipes/vercel-neon-telegram
Open

[recipes] Vercel + Neon + Telegram alternative architecture#37
geoff-price wants to merge 4 commits intoNateBJones-Projects:mainfrom
geoff-price:recipes/vercel-neon-telegram

Conversation

@geoff-price
Copy link

Summary

  • Alternative Open Brain architecture using Vercel (serverless), Neon (pgvector), and Telegram (mobile capture) instead of Cloudflare + Supabase + Slack
  • Uses Vercel AI SDK with OpenAI directly (no OpenRouter)
  • MCP server with Streamable HTTP transport (2025-03-26 spec)
  • 4 capture channels: MCP clients, Telegram bot, HTTP API, CLI
  • Timing-safe auth, rate limiting (30 req/min), 10KB input cap
  • 30 unit tests (auth, rate limiting, Zod schemas)
  • Tested on a personal instance across ChatGPT, Claude Desktop, Claude Code, and Telegram

What it does

Deploys a complete Open Brain on the Vercel + Neon stack. The thoughts table schema and match_thoughts() function are identical to OB1's — data is portable between stacks.

Component Default (OB1) This recipe
Runtime Cloudflare Workers Vercel Serverless (Next.js App Router)
Database Supabase (pgvector) Neon Postgres (pgvector)
AI Provider OpenAI via OpenRouter OpenAI direct (Vercel AI SDK)
Mobile capture Slack Telegram (grammY)
MCP transport SSE Streamable HTTP
Auth Supabase auth + API keys Static access key (timing-safe)

Requirements

  • Vercel account (free tier)
  • Neon account (free tier)
  • OpenAI API key
  • Telegram account (optional, for mobile capture)

Testing

Tested on a personal deployment (engram) with cross-client verification:

  • Captured thoughts from Telegram, ChatGPT, Claude Desktop, and Claude Code
  • Searched and listed thoughts across all clients
  • Unit tests pass: npm test (30 tests, vitest)

Test plan

  • Recipe is in correct recipes/ directory
  • README has all required sections (prerequisites, instructions, expected outcome, troubleshooting)
  • metadata.json is valid with all required fields
  • No credentials or API keys in source
  • SQL creates new tables only (no modifications to core tables)
  • Changes confined to recipes/vercel-neon-telegram/
  • Internal README links resolve correctly

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@justfinethanku
Copy link
Collaborator

Appreciate the work here, but a couple of things:

Neon: We considered Neon early on for Open Brain but it was a dealbreaker — no pgvector support (or at least not at parity with Supabase's implementation). Vector search is core to how Open Brain works, so we can't recommend an alternative stack that doesn't have it. If Neon has added pgvector support since then, happy to be corrected, but as-is this isn't a viable alternative stack for OB1.

Telegram capture: This piece is valuable, but @alanshurafa already has PR #43 open for Telegram capture as a standalone integration. Would be great if you two could collaborate on that PR rather than duplicating effort. Your implementation might have patterns or ideas that complement what's in #43.

Ask: Could you split this PR? Pull out the Telegram capture piece and coordinate with @alanshurafa on #43. The Vercel + Neon stack would need to solve the vector search gap before we could move forward with it.

Copy link
Collaborator

@justfinethanku justfinethanku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Thank you for this comprehensive alternative architecture contribution! The implementation quality is excellent — well-structured code, thorough testing (30 unit tests), proper error handling, and thoughtful security considerations. The README is detailed and user-friendly.

What's Good

Strong implementation:

  • Clean separation of concerns (auth, rate limiting, capture pipeline, DB access)
  • Proper input validation with Zod schemas
  • Security best practices (timing-safe auth, rate limiting, input caps)
  • Comprehensive test coverage across auth, rate limiting, and types
  • SQL is safe (no destructive operations, creates new tables only)
  • No hardcoded credentials (all use environment variables)
  • README has all required sections with clear, step-by-step instructions
  • metadata.json is valid and complete
  • Proper folder structure under recipes/
  • PR title follows correct format: [recipes] Description

Thoughtful design:

  • The Vercel AI SDK integration is clean
  • Parallel embedding + extraction is smart
  • Multiple capture channels (MCP, Telegram, HTTP, CLI) provide good flexibility
  • Data portability preserved (identical thoughts table and match_thoughts function)

Critical Issue: Local MCP Pattern

The README instructs users to edit claude_desktop_config.json (Step 8) to set up Claude Desktop MCP connection. This violates CONTRIBUTING.md Rule #14.

From CONTRIBUTING.md (lines 253-254):

Remote MCP pattern — MCP servers must be deployed as Supabase Edge Functions and connected via custom connectors (URL-based). Do NOT use local Node.js servers or claude_desktop_config.json.

The automated review workflow (Rule 14, lines 430-457 of .github/workflows/ob1-review.yml) will flag this when it runs.

Why this matters: The OB1 project requires consistent MCP setup patterns across all contributions. Extensions and integrations must use remote MCP via the Claude Desktop custom connectors UI (Settings → Connectors → Add custom connector → paste URL), not the local config file approach.

Required fix:

Replace the Claude Desktop section in Step 8 with:

**Claude Desktop** (Settings → Connectors → Add custom connector):

1. Open Claude Desktop
2. Go to Settings → Connectors
3. Click "Add custom connector"
4. Paste your MCP endpoint URL: `https://your-project.vercel.app/api/mcp?key=YOUR_ACCESS_KEY`
5. Click "Add"

The connector will appear as "open-brain" in your MCP tools list.

(Note: If the ?key= query param approach doesn't work with Claude Desktop's custom connectors, you may need to use the x-brain-key header instead. The Claude Code example in your README shows the correct header-based auth pattern.)

Additional Observations (Nice-to-Haves, Not Blocking)

  1. Troubleshooting section is excellent — covers 5+ common issues with clear solutions
  2. File structure diagram — helpful for navigation
  3. Architecture diagram — nice visual explanation
  4. Testing confirmation — you mention personal deployment testing with cross-client verification, which is great
  5. Consider adding a note about ChatGPT Developer Mode disabling built-in Memory (you do mention it briefly, which is good)
  6. The comparison table between default OB1 stack and this recipe is very helpful for users choosing between approaches

Verdict: Significant changes needed

This is a high-quality contribution that just needs one critical fix to align with the project's MCP setup pattern. Once the claude_desktop_config.json instructions are replaced with the custom connector approach, this will be ready to merge.

Action items:

  1. Replace Claude Desktop MCP setup instructions (Step 8) to use custom connectors instead of claude_desktop_config.json
  2. Verify the header-based auth works with Claude Desktop custom connectors (or adjust if needed)
  3. Update the Troubleshooting section's MCP connection issue accordingly

Once these are addressed, this will be an excellent addition to the recipes collection. The Vercel + Neon + Telegram stack offers a compelling alternative architecture, and your implementation demonstrates strong engineering practices.

…dback)

Replace claude_desktop_config.json + mcp-remote bridge instructions with
Claude Desktop custom connectors UI approach in both Step 8 and the
Troubleshooting section, aligning with CONTRIBUTING.md Rule NateBJones-Projects#14.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@geoff-price
Copy link
Author

@justfinethanku Thanks for the review and appreciate the detail.

Fixed in 6408891:

  • Replaced claude_desktop_config.json + mcp-remote instructions in Step 8 with the custom connectors UI approach (Settings > Connectors > Add
    custom connector)
  • Updated the Troubleshooting section to match
  • Verified zero hits against the Rule Recipe: Daily digest email from recent thoughts #14 regex

Cool project. Looking forward to getting this merged and contributing more down the line.

-G

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants