File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
src/content/docs/browser-rendering/platform Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,22 @@ import { env } from 'cloudflare:workers';
79
79
import { createMcpAgent } from ' @cloudflare/playwright-mcp' ;
80
80
81
81
export const PlaywrightMCP = createMcpAgent (env .BROWSER );
82
- export default PlaywrightMCP .mount (' /sse' );
82
+
83
+ export default {
84
+ fetch(request : Request , env : Env , ctx : ExecutionContext ) {
85
+ const { pathname } = new URL (request .url );
86
+
87
+ switch (pathname ) {
88
+ case ' /sse' :
89
+ case ' /sse/message' :
90
+ return PlaywrightMCP .serveSSE (' /sse' ).fetch (request , env , ctx );
91
+ case ' /mcp' :
92
+ return PlaywrightMCP .serve (' /mcp' ).fetch (request , env , ctx );
93
+ default :
94
+ return new Response (' Not Found' , { status: 404 });
95
+ }
96
+ },
97
+ };
83
98
```
84
99
85
100
4 . Deploy the server.
You can’t perform that action at this time.
0 commit comments