Implement R2 artifact storage middleware #42
+254
−5
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.
This pull request adds support for storing Playwright MCP artifacts (such as screenshots and PDFs) in Cloudflare R2 when running in Cloudflare Workers. It introduces middleware to intercept MCP responses, upload artifacts to R2, and return accessible URLs instead of inline base64 data. The documentation is updated to explain how to configure and use this feature.
Artifact Storage with R2 Integration:
interceptMcpResponsemiddleware incloudflare/src/r2-middleware.tsthat intercepts MCP responses, uploads image artifacts to R2, and modifies the response to return URLs, inline data, or both, depending on configuration.cloudflare/src/index.tsto support artifact storage configuration, including R2 bucket binding, key prefix, public URL base, and return mode.Documentation:
README.mdwith detailed instructions on configuring R2 storage for artifacts, including examplewrangler.toml, Worker middleware usage, return modes, and serving artifacts from R2.Related to #40