# Second Brain Cloudflare

> One memory layer, every AI tool. Store anything once — recall it in Claude, ChatGPT, Cursor, or any MCP client. Self-hosted on Cloudflare's free tier.

- **Type:** MCP server
- **Install:** `agentstack add mcp-rahilp-second-brain-cloudflare`
- **Verified:** Pending review
- **Seller:** [rahilp](https://agentstack.voostack.com/s/rahilp)
- **Installs:** 0
- **Category:** [Cloud & Infrastructure](https://agentstack.voostack.com/c/cloud-infrastructure)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [rahilp](https://github.com/rahilp)
- **Source:** https://github.com/rahilp/second-brain-cloudflare
- **Website:** https://www.thesecondbrain.dev

## Install

```sh
agentstack add mcp-rahilp-second-brain-cloudflare
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Second Brain

**One shared memory for Claude, ChatGPT, Cursor, Codex, and every other AI tool you use.**

[](LICENSE)
[](https://workers.cloudflare.com/)
[](https://modelcontextprotocol.io/)

You use Claude for some things, ChatGPT for others, and Cursor for code. But your context, including your projects, decisions, and preferences, does not move with you. You end up explaining yourself again and again.

Second Brain gives every AI tool access to the same persistent memory.

Unlike memory built into a single app, this memory belongs to you. It runs in your own Cloudflare account, stays under your control, and cannot be locked inside one AI platform.

[](https://deploy.workers.cloudflare.com/?url=https://github.com/rahilp/second-brain-cloudflare)

Deploying takes about two minutes. See the [Quick Start](#quick-start) for the required configuration values.

> ## #3 Product of the Day on Product Hunt
>
> 

## See it in action

[](https://youtu.be/h0JqRM0UxHE)

## How it works

Connect Second Brain to the AI tools you already use, then save information as it comes up.

Second Brain retrieves memories by meaning rather than exact wording. Asking:

> What did I decide about the pricing model?

can surface the correct memory even when the original note used completely different words.

### Memory tools

| Tool          | What it does                                             |
| ------------- | -------------------------------------------------------- |
| `remember`    | Store ideas, decisions, preferences, and project context |
| `append`      | Add an update to an existing memory                      |
| `update`      | Replace an existing memory                               |
| `recall`      | Find memories by meaning rather than exact wording       |
| `list_recent` | Browse recently saved memories                           |
| `forget`      | Permanently delete a memory                              |

## Save from anywhere

Memory is most useful when capturing information is easy. Second Brain connects to the tools and moments where context already exists.

* **AI clients:** Use `remember` directly within Claude, ChatGPT, Cursor, Codex, and other MCP clients.

* **Command line:** Run `brain remember`, `brain recall`, and other commands from your terminal.

  ```bash
  npm install -g second-brain-cf-cli
  ```

* **Obsidian:** Automatically sync notes using the [Second Brain Sync plugin](https://github.com/rahilp/second-brain-obsidian-plugin), also available through [Obsidian Community Plugins](https://community.obsidian.md/plugins/second-brain-sync).

* **Browser extension:** Capture a page or highlighted text using the [Chrome extension](https://github.com/rahilp/second-brain-browser-extension).

* **iPhone and iPad:** Use the Brain Dump, Text Brain Dump, and Save to Brain shortcuts in [`integrations/ios-shortcuts/`](integrations/ios-shortcuts/).

* **Bookmarklet:** Use the lightweight bookmarklet in [`integrations/bookmarklet.js`](integrations/bookmarklet.js).

## Quick Start

Set up your Second Brain in three steps.

### 1. Choose an authentication token

Your `AUTH_TOKEN` is the password used to access your Second Brain.

Use either:

* A memorable phrase, such as `coffee-lover-2026`
* A randomly generated token:

  ```bash
  openssl rand -base64 32
  ```

Save this token somewhere secure. You will need it when authorizing clients and testing your deployment.

### 2. Deploy to Cloudflare

Click **[Deploy to Cloudflare](https://deploy.workers.cloudflare.com/?url=https://github.com/rahilp/second-brain-cloudflare)** and follow the prompts.

Enter the following value during setup:

| FIELD      | VALUE                           |
| ---------- | ------------------------------- |
| AUTH_TOKEN | The token you created in step 1 |

Cloudflare will provision the required resources and deploy your Worker automatically. The Vectorize index is created for you during deployment with the correct settings (384 dimensions, cosine metric), so there is nothing else to fill in.

When deployment finishes, copy your Worker URL. It will look similar to:

```text
https://your-worker-name.your-subdomain.workers.dev
```

### 3. Connect your AI clients

Choose the instructions for the clients you use.

#### Claude Code or Codex CLI

Run the command for your operating system, replacing `YOUR-WORKER-URL` with the Worker URL from step 2.

**macOS, Linux, WSL, or Git Bash**

```bash
curl -fsSL https://raw.githubusercontent.com/rahilp/second-brain-cloudflare/main/scripts/connect-ai-clients.sh | bash -s -- https://YOUR-WORKER-URL
```

**Windows PowerShell**

```powershell
iex "& { $(irm https://raw.githubusercontent.com/rahilp/second-brain-cloudflare/main/scripts/connect-ai-clients.ps1) } -WorkerUrl https://YOUR-WORKER-URL"
```

The setup script configures the MCP connection and global instructions using OAuth. Your authentication token is not passed to the script.

#### ChatGPT or Claude desktop and web apps

These clients require two manual setup steps:

1. Add the provided custom instructions to the app's personalization settings.
2. Add the following URL as a custom MCP connector:

   ```text
   https://YOUR-WORKER-URL/mcp
   ```

Follow the **[client-specific instructions in the wiki](../../wiki/Connect-to-AI-Clients)** for the exact menus and settings.

Your Second Brain is now ready to use across every connected client.

### Optional: Verify the deployment

Replace `YOUR-WORKER-URL` and `YOUR-TOKEN` with your own values:

```bash
curl -X POST https://YOUR-WORKER-URL/capture \
  -H "Authorization: Bearer YOUR-TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"content":"second brain is working","source":"test"}'
```

A successful response will look like:

```json
{"ok":true,"id":"..."}
```

How OAuth authentication works

The `/mcp` endpoint supports OAuth 2.0 discovery and dynamic client registration.

When you add the following URL as an MCP connector:

```text
https://YOUR-WORKER-URL/mcp
```

a compatible client will:

1. Detect the authentication requirement.
2. Register itself with your Worker.
3. Open the hosted login page in your browser.
4. Ask you to enter your `AUTH_TOKEN`.
5. Store the resulting OAuth authorization.

This means your authentication token does not need to be placed in the client configuration or included in the connector URL.

The following clients support this flow:

* ChatGPT
* Claude.ai
* Claude Code
* Codex CLI

You can also configure supported command-line clients manually:

```bash
claude mcp add --transport http second-brain https://YOUR-WORKER-URL/mcp
```

```bash
codex mcp add second-brain --url https://YOUR-WORKER-URL/mcp
```

Clients that cannot open a browser, such as `mcp-remote` in a headless environment, can use static token authentication:

```http
Authorization: Bearer YOUR-AUTH-TOKEN
```

OAuth requires the `OAUTH_KV` namespace for client registrations and tokens. The Deploy to Cloudflare button provisions it automatically.

Manual deployment

To deploy without the one-click button:

```bash
npm install
npm run deploy
```

Wrangler provisions the required Cloudflare resources automatically. The Vectorize index (384 dimensions, cosine) and its `VECTORIZE` binding are created and wired up for you by the `postinstall`/deploy scripts — no manual configuration needed.

## Documentation

* [Setup Guide](../../wiki/Setup-Guide): Deploy the Worker, configure authentication, and connect AI clients
* [How It Works](../../wiki/How-It-Works): Semantic search, chunking, memory classification, and duplicate detection
* [Connect to AI Clients](../../wiki/Connect-to-AI-Clients): ChatGPT, Claude, Claude Code, Codex, and other MCP clients
* [Capture from Anywhere](../../wiki/Capture-from-Anywhere): Browser extension, bookmarklet, iOS Shortcuts, and share sheet
* [Web UI](../../wiki/Web-UI): Dashboard and mobile interface
* [Obsidian Plugin](../../wiki/Obsidian-Plugin): Installation, configuration, and sync modes
* [API Reference](../../wiki/API-Reference): REST and MCP endpoints

## Technology

Second Brain is built with:

* Cloudflare Workers
* D1 SQLite
* Cloudflare Vectorize
* Workers AI
* Cloudflare KV
* Model Context Protocol
* TypeScript

It runs within Cloudflare's free tier at personal scale.

Your data stays in your own Cloudflare account.

## Star History

  
    
    
    
  

[MIT License](LICENSE) · [Discussions](https://github.com/rahilp/second-brain-cloudflare/discussions)

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [rahilp](https://github.com/rahilp)
- **Source:** [rahilp/second-brain-cloudflare](https://github.com/rahilp/second-brain-cloudflare)
- **License:** MIT
- **Homepage:** https://www.thesecondbrain.dev

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** yes
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: flagged — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-rahilp-second-brain-cloudflare
- Seller: https://agentstack.voostack.com/s/rahilp
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
