Skip to content

Commit 909fe5d

Browse files
authored
Merge pull request #633 from Achintha444/main
Update readme file to include a tip to allow `mcp-session-id` in CORS when using StreamableHTTP
2 parents 4621105 + 5f96ae4 commit 909fe5d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,21 @@ app.delete('/mcp', handleSessionRequest);
500500
app.listen(3000);
501501
```
502502

503+
> [!TIP]
504+
> 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.
505+
>
506+
> For example, in Node.js you can configure it like this:
507+
>
508+
> ```ts
509+
> app.use(
510+
> cors({
511+
> origin: ['https://your-remote-domain.com, https://your-other-remote-domain.com'],
512+
> exposedHeaders: ['mcp-session-id'],
513+
> allowedHeaders: ['Content-Type', 'mcp-session-id'],
514+
> })
515+
> );
516+
> ```
517+
503518
#### Without Session Management (Stateless)
504519
505520
For simpler use cases where session management isn't needed:

0 commit comments

Comments
 (0)