Skip to content

Commit 185fb23

Browse files
authored
Merge branch 'main' into main
2 parents c8f633a + 1e52f38 commit 185fb23

39 files changed

+1759
-143
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,21 @@ app.delete('/mcp', handleSessionRequest);
504504
app.listen(3000);
505505
```
506506

507+
> [!TIP]
508+
> 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.
509+
>
510+
> For example, in Node.js you can configure it like this:
511+
>
512+
> ```ts
513+
> app.use(
514+
> cors({
515+
> origin: ['https://your-remote-domain.com, https://your-other-remote-domain.com'],
516+
> exposedHeaders: ['mcp-session-id'],
517+
> allowedHeaders: ['Content-Type', 'mcp-session-id'],
518+
> })
519+
> );
520+
> ```
521+
507522
#### Without Session Management (Stateless)
508523
509524
For simpler use cases where session management isn't needed:
@@ -544,6 +559,7 @@ app.post('/mcp', async (req: Request, res: Response) => {
544559
}
545560
});
546561
562+
// SSE notifications not supported in stateless mode
547563
app.get('/mcp', async (req: Request, res: Response) => {
548564
console.log('Received GET MCP request');
549565
res.writeHead(405).end(JSON.stringify({
@@ -556,6 +572,7 @@ app.get('/mcp', async (req: Request, res: Response) => {
556572
}));
557573
});
558574
575+
// Session termination not needed in stateless mode
559576
app.delete('/mcp', async (req: Request, res: Response) => {
560577
console.log('Received DELETE MCP request');
561578
res.writeHead(405).end(JSON.stringify({
@@ -950,7 +967,7 @@ Client-side: Handle elicitation requests
950967
```typescript
951968
// This is a placeholder - implement based on your UI framework
952969
async function getInputFromUser(message: string, schema: any): Promise<{
953-
action: "accept" | "decline" | "cancel";
970+
action: "accept" | "reject" | "cancel";
954971
data?: Record<string, any>;
955972
}> {
956973
// This should be implemented depending on the app

eslint.config.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,12 @@ export default tseslint.config(
1515
{ "argsIgnorePattern": "^_" }
1616
]
1717
}
18+
},
19+
{
20+
files: ["src/client/**/*.ts", "src/server/**/*.ts"],
21+
ignores: ["**/*.test.ts"],
22+
rules: {
23+
"no-console": "error"
24+
}
1825
}
1926
);

package-lock.json

Lines changed: 32 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@modelcontextprotocol/sdk",
3-
"version": "1.12.3",
3+
"version": "1.13.2",
44
"description": "Model Context Protocol implementation for TypeScript",
55
"license": "MIT",
66
"author": "Anthropic, PBC (https://anthropic.com)",
@@ -36,8 +36,11 @@
3636
],
3737
"scripts": {
3838
"build": "npm run build:esm && npm run build:cjs",
39-
"build:esm": "tsc -p tsconfig.prod.json && echo '{\"type\": \"module\"}' > dist/esm/package.json",
40-
"build:cjs": "tsc -p tsconfig.cjs.json && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json",
39+
"build:esm": "mkdir -p dist/esm && echo '{\"type\": \"module\"}' > dist/esm/package.json && tsc -p tsconfig.prod.json",
40+
"build:esm:w": "npm run build:esm -- -w",
41+
"build:cjs": "mkdir -p dist/cjs && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json && tsc -p tsconfig.cjs.json",
42+
"build:cjs:w": "npm run build:cjs -- -w",
43+
"examples:simple-server:w": "tsx --watch src/examples/server/simpleStreamableHttp.ts --oauth",
4144
"prepack": "npm run build:esm && npm run build:cjs",
4245
"lint": "eslint src/",
4346
"test": "jest",

0 commit comments

Comments
 (0)