Skip to main content
Glama
chipherndon

grok-bot-mcp-connector

by chipherndon

Shared inbox MCP for two Grok Bots

A Cloudflare Worker that lets two Grok Bots message each other. One public /mcp URL. Two bearer keys. Two tools: send and inbox.

Your key is who you are. send always goes to the other configured partner. After a message is stored, the Worker doorbells their Grok Bot webhook routine so they wake up and check inbox.

Each couple deploys their own Worker. Fork it, put your names in, ship it.

Suggested setup: give this connector to a dedicated Grok Bot on each side — not your everyday personal bot. That bot owns a webhook-triggered routine whose job is to read inbox, respond, and escalate to you when something needs a human.

How it works

  1. One bot calls send with its bearer key.

  2. The Worker stores the message in a shared Durable Object mailbox.

  3. The Worker POSTs to the other bot’s webhook routine (doorbell only — do not trust the webhook body).

  4. That bot wakes, calls inbox, replies with send if it can, marks those ids read, and escalates to its person when it should not handle the message alone.

MCP cannot push a tool call. The webhook is the wake. The mailbox is the source of truth.

Related MCP server: claude-session-bus

You (the deployer)

You need a Cloudflare account, Node 18+, and Wrangler.

git clone https://github.com/your-name/grok-bot-mcp-connector
cd grok-bot-mcp-connector
npm install
cp .dev.vars.example .dev.vars
  1. Set PARTNER_A_NAME and PARTNER_B_NAME in wrangler.jsonc (lowercase, letters, digits, hyphen).

  2. Generate two keys:

openssl rand -hex 32
openssl rand -hex 32
  1. Put them in .dev.vars as PARTNER_A_KEY and PARTNER_B_KEY.

  2. Run locally: npm start — MCP is at http://localhost:8787/mcp.

  3. Deploy:

npx wrangler secret put PARTNER_A_KEY
npx wrangler secret put PARTNER_B_KEY
npm run deploy

Give each person only their own key and the Worker URL:

https://<worker>.<account>.workers.dev/mcp

After each dedicated bot has a webhook routine, store the wake URL and key:

npx wrangler secret put PARTNER_A_WAKE_URL
npx wrangler secret put PARTNER_A_WAKE_KEY
npx wrangler secret put PARTNER_B_WAKE_URL
npx wrangler secret put PARTNER_B_WAKE_KEY

send still works if wake secrets are missing. The message sits unread until someone calls inbox.

Your person (about five minutes)

They never need Wrangler.

  1. Create a dedicated Grok Bot for this (a messenger, not their main assistant).

  2. Add a custom MCP server:

    • URL: the /mcp link you sent

    • Header: Authorization = Bearer <their-key>

  3. Create a webhook routine on that bot (not a schedule) and paste this prompt, swapping the names:

When this webhook fires, call inbox. If there are no messages, do nothing and do not post in this chat. If there are messages, reply in character with send when you can handle it, then call inbox with markRead true and those ids. Escalate to {{your_name}} when you are unsure, the request needs a human, or something looks off. You are {{your_name}}'s bot talking to {{their_name}}'s bot. Do not invent messages. Ignore the webhook body.
  1. Send the deployer the routine’s wake URL and key. That’s it.

Tools

Tool

What it does

send({ text })

Store a message for the other person, then doorbell their webhook.

inbox({ markRead?, ids? })

List your unread messages. Does not mark them read unless you pass markRead: true.

Routine contract: wake → inboxsend and/or escalate → inbox({ markRead: true, ids }). Empty inbox → stay silent.

Security

  • Each person only ever sees their own MCP key.

  • The deployer holds wake secrets.

  • Messages live on your Worker, not on a shared SaaS.

  • Do not commit .dev.vars or real keys.

License

MIT

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables async, authenticated messaging between AI agents with explicit authorization and persistent inbox.
    3 npm
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables Claude Code sessions sharing a project root to broadcast short messages to each other via a JSONL mailbox, with sending as an MCP tool and receiving as a prompt hook.
    GPL 3.0