Cloudflare hosting phase #1 - Express compat layer#568
Open
fredericbarthelet wants to merge 6 commits intomainfrom
Open
Cloudflare hosting phase #1 - Express compat layer#568fredericbarthelet wants to merge 6 commits intomainfrom
fredericbarthelet wants to merge 6 commits intomainfrom
Conversation
ab247c9 to
5ffcc02
Compare
5ffcc02 to
203bd0a
Compare
203bd0a to
ef94389
Compare
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.
Addresses #535
This is phase 1 of Cloudflare hosting support.
One big rework not initially planned was to get read of all readFileSync API calls that can't be used in a Cloudflare worker environment. We were relying on those to:
I created a separate issue to move away from native Node.js API in production build : #571
I also had to make 2 additional small changes compared to original plan:
Run
pnpm create skybridge@cloudflareand thennpm run cloudflare:deployin the generated directory to deploy on CloudflareGreptile Summary
This PR begins Cloudflare Workers hosting support (phase 1) by adding an Express compatibility layer. The
McpServer.run()method now starts the HTTP server and then conditionally importshttpServerHandlerfromcloudflare:nodeto return a Workers-compatible fetch handler. In non-Workers environments, it returnsundefined. Dynamic imports inexpress.tsare indirected through variables to prevent Cloudflare's bundler from statically resolving dev-only dependencies.server.run()return type changed fromPromise<void>toPromise<{ fetch: (...args: unknown[]) => unknown } | undefined>to expose the Cloudflare Workers fetch interfaceimport()calls inexpress.tsuse variable indirection to avoid bundler static analysisexport default await server.run()for Workers module compatibilitywidgetsDevServerremoved from public exports inindex.ts— this is a breaking change as documentation (docs/devtools/index.mdx) still references importing it fromskybridge/serverConfidence Score: 4/5
widgetsDevServerpublic export without updating the documentation that references it, which will break users following the "Custom Integration" guide.packages/core/src/server/index.ts— removedwidgetsDevServerexport still referenced in documentationComments Outside Diff (1)
packages/core/src/server/index.ts, line 10 (link)Breaking public export removal
The
widgetsDevServerexport was removed here, butdocs/devtools/index.mdx(line 81) still documents it as part of the "Custom Integration" guide:Users following that documentation will get an import error after this change. The docs should be updated to remove or replace this reference — or the export should be kept if it's still intended for external use.
Prompt To Fix All With AI
Last reviewed commit: 25e58e2