You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-12Lines changed: 23 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -570,20 +570,31 @@ app.listen(3000);
570
570
```
571
571
572
572
> [!TIP]
573
-
> When using this in a remote environment, make sure to allow the header parameter `mcp-session-id` in CORS. Otherwise, it may result in a `Bad Request: No valid session ID provided` error.
574
-
>
575
-
> For example, in Node.js you can configure it like this:
> When using this in a remote environment, make sure to allow the header parameter `mcp-session-id` in CORS. Otherwise, it may result in a `Bad Request: No valid session ID provided` error. Read the following section for examples.
585
574
> ```
586
575
576
+
577
+
#### CORS Configuration for Browser-Based Clients
578
+
579
+
If you'd like your server to be accessible by browser-based MCP clients, you'll need to configure CORS headers. The `Mcp-Session-Id` header must be exposed for browser clients to access it:
580
+
581
+
```typescript
582
+
import cors from 'cors';
583
+
584
+
// Add CORS middleware before your MCP routes
585
+
app.use(cors({
586
+
origin: '*', // Configure appropriately for production, for example:
0 commit comments