Skip to content

feat(mcp-server): switch channel from SSE to WebSocket for DO hibernation#165

Merged
liplus-lin-lay merged 2 commits intomainfrom
163-reduce-durable-objects-duration-by-offloading-sse-from-do
Apr 3, 2026
Merged

feat(mcp-server): switch channel from SSE to WebSocket for DO hibernation#165
liplus-lin-lay merged 2 commits intomainfrom
163-reduce-durable-objects-duration-by-offloading-sse-from-do

Conversation

@liplus-lin-lay
Copy link
Copy Markdown
Member

Refs #163

mcp-serverのチャンネル接続をEventSource(SSE)からネイティブWebSocketに切り替え。
DO側がhibernationできるようになり、duration(GB-sec)の無料枠超過を解消する。

  • local-mcpのWebSocket実装パターン(L515-618)を参考に移植
  • 25秒keepalive(ping送信)、exponential backoff自動再接続
  • close code 1008/4401でtoken refresh
  • eventsource依存を除去(Node.js 18+ネイティブWebSocket APIのみ使用)
  • docs/0-requirements.mdとREADMEを更新

SSE接続ではDOがhibernationできず、duration(GB-sec)が無料枠を超過していた。
local-mcpのWebSocket実装パターンに倣い、mcp-serverのチャンネル接続をネイティブWebSocketに切り替え。
25秒keepalive(ping送信)、exponential backoff自動再接続、token refresh on close code 1008/4401を含む。
eventsource依存を除去し、Node.js 18+ネイティブWebSocket APIのみ使用。

Refs #163

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@liplus-lin-lay liplus-lin-lay linked an issue Apr 3, 2026 that may be closed by this pull request
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Apr 3, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
github-webhook-mcp 8e4fd6b Apr 03 2026, 01:49 PM

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@liplus-lin-lay liplus-lin-lay merged commit 5b7c7ed into main Apr 3, 2026
3 checks passed
@liplus-lin-lay liplus-lin-lay deleted the 163-reduce-durable-objects-duration-by-offloading-sse-from-do branch April 3, 2026 13:49
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.

Reduce Durable Objects duration by offloading SSE from DO

1 participant