Repository navigation
Grok Bot MCP Events: Cloudflare Worker host polyfill + unified remote MCP inbox - #27
Open
infoxicator wants to merge 8 commits into
Open
infoxicator wants to merge 8 commits into
infoxicator wants to merge 8 commits into
Conversation
…es, and init/Docker setup
… per-request _meta envelope
VOUCHAVOUCHA is currently in early access and is not enabled for this repository yet. To request access, contact @idosal. VOUCHA has not added a comprehension check to this PR. |
- Separate operator ADMIN_KEY from Grok connector READER_KEY; bind watches to upstream endpoint URL and retire watches/hooks on server removal or endpoint replacement
- Use redirect: 'manual' and strict HTTPS/issuer/URL validation on all outbound MCP and OAuth requests
- Add OAuth refresh_token rotation with scope checks and truthful revocation reporting for access + refresh tokens
- Add /admin/delivery/{retry,accept} recovery for held batches, park delivery when routine secrets are absent, and add backlog backpressure + bounded read_batch
- Clear null/absent cursors, gate truncation notices on supplied cursor, stop on terminal Forbidden, rediscover on HeaderMismatch/NotFound/Unsupported, and narrow 2026-07-28 discovery fallback
- Verify Standard Webhooks HMAC-SHA256 over exact received bytes and raw timestamp string; stream-cap /hooks/* bodies and re-read watch state after await
- Gate /hooks/* and OAuth endpoints during MCP_EVENTS_OFF=1 stand-down
- Persist in-flight attempt state in Node bridge for holdOnAmbiguous crash recovery and fix flaky 503/429 test
- Expand Worker tests with modern 2026-07-28, pre-standard, and OAuth fixtures; remove temporary probe/ folder and simplify setup UX with copy-paste prompt
infoxicator
marked this pull request as ready for review
November 30, 2026 16:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a zero-server Cloudflare Worker + SQLite Durable Object host polyfill (
polyfills/events/grok-bot/worker) and upgrades the self-hosted Node bridge (polyfills/events/grok-bot) so Grok Bot can reliably receive MCP Events (SEP-3415) 24/7 while its VM sleeps, with zero scheduled model runs and zero idle token burn.Cloudflare Worker host polyfill (
polyfills/events/grok-bot/worker)GrokEventsHub) deployed to the user's own Cloudflare account vianpm run setup(same deployment pattern aspolyfills/events/claude-code/mod/relay, with its own Workers-native client/receiver/scheduler)./mcp):read_batchplus the 6 MCP Events tools (list_event_types,watch_event,unwatch_event,list_watches,get_event,recent_events).READER_KEY(POST /mcponly) andADMIN_KEY(/oauth/start,/admin/servers,DELETE /admin/servers/*,/admin/delivery/{retry,accept}).redirect: 'manual'(rejecting3xx) and stricthttps:/// issuer / metadata URL validation./hooks/*, Standard Webhooks HMAC-SHA256 verification over exact received bytes and exact rawwebhook-timestampstring, and synchronous post-awaitwatch state re-read before committing events/dedupe state.410on hooks) when a server is removed or re-authenticated to a different URL.MCP_EVENTS_OFF=1(empty tool list, stopped alarms, and503on/hooks/*and OAuth endpoints).2026-07-28(server/discover,Mcp-Method,Mcp-Name,Mcp-Param-*, per-request_metaenvelope) with narrow fallback to legacyinitializeandMCP_EVENTS_PRE_STANDARD=offstrict mode.Forbidden, and rediscovers onHeaderMismatch/NotFound/Unsupported./oauth/start,/oauth/callback): connects OAuth MCP servers (such as T3 Code) via browser sign-in with least-privilege scope enforcement, truthful revocation reporting (access + refresh tokens), and automaticrefresh_tokenrotation.408/429/5xxerrors with exponential backoff, parks cleanly when routine secrets are unconfigured, caps pending backlog with503backpressure, and supports operator recovery vianpm run setup -- retryandnpm run setup -- accept <BATCH>.npm run setupcopies the connector header on macOS andnpm run setup -- promptprints/copies the exact Grok Bot routine creation prompt.Self-hosted Node bridge improvements (
polyfills/events/grok-bot)bridge.mjs start(watcher + 7-tool MCP HTTP server in one process) andbridge.mjs init.408/429/5xxerrors, persistent in-flight attempt state for strictholdOnAmbiguouscrash recovery, surfaced notices, optionalGROK_EVENTS_READER_ORIGIN, andMCP_EVENTS_OFF=1stand-down.Verification
tsc --noEmitclean + 5/5wrangler devtests passing (modern-only2026-07-28, pre-standardMCP_EVENTS_PRE_STANDARD=off, and OAuth 2.1 mocks coveringREADER_KEY/ADMIN_KEYseparation, redirect refusal, raw-byte webhook verification,503/429retry,401hold &/admin/delivery/*recovery, null cursor clearing, terminalForbidden,HeaderMismatchunwatch recovery, OAuth scope rejection + confirmed/unconfirmed revocation reporting + refresh rotation,DELETE /admin/servers/*retiring hooks, andMCP_EVENTS_OFF=1gating).event-feeds(demo.buttonviapoll): watch created from Grok chat, button press woke Foxbot unattended, calledread_batch, and reportedpress-1.thread.run_settledvia signedwebhook+ OAuthorchestration:read): watch created from Grok chat, T3 turn completion sent signed webhook to Cloudflare Worker, woke Foxbot unattended, calledread_batch, and reported the completed run.