Skip to content

Commit d9006bd

Browse files
authored
feat: make MCP SDK a peer dependency (#168)
* feat: make MCP SDK a peer dependency - Move @modelcontextprotocol/sdk from dependencies to peerDependencies (^1.20.0) - Add to devDependencies for local development (^1.24.3) - Externalize SDK from all build entry points (app, app-bridge, react, server) Benefits: - Consumers control their SDK version - Deduplication when consumer already has SDK - Follows pattern of react/zod peer deps * fix: require SDK ^1.24.0 for Zod 4 compatibility Earlier SDK versions have Zod type incompatibilities that cause build errors. * chore: update examples to SDK ^1.24.0 to match peer dep
1 parent 2dd223b commit d9006bd

File tree

12 files changed

+23
-15
lines changed

12 files changed

+23
-15
lines changed

build.bun.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,20 @@ function buildJs(entrypoint: string, opts: Record<string, any> = {}) {
2323
}
2424

2525
await Promise.all([
26-
buildJs("src/app.ts", { outdir: "dist/src" }),
26+
buildJs("src/app.ts", {
27+
outdir: "dist/src",
28+
external: ["@modelcontextprotocol/sdk"],
29+
}),
2730
buildJs("src/app-bridge.ts", {
2831
outdir: "dist/src",
2932
external: ["@modelcontextprotocol/sdk"],
3033
}),
3134
buildJs("src/react/index.tsx", {
3235
outdir: "dist/src/react",
33-
external: ["react", "react-dom"],
36+
external: ["react", "react-dom", "@modelcontextprotocol/sdk"],
37+
}),
38+
buildJs("src/server/index.ts", {
39+
outdir: "dist/src/server",
40+
external: ["@modelcontextprotocol/sdk"],
3441
}),
3542
]);

examples/basic-host/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"dependencies": {
1414
"@modelcontextprotocol/ext-apps": "../..",
15-
"@modelcontextprotocol/sdk": "^1.22.0",
15+
"@modelcontextprotocol/sdk": "^1.24.0",
1616
"react": "^19.2.0",
1717
"react-dom": "^19.2.0",
1818
"zod": "^4.1.13"

examples/basic-server-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"dependencies": {
1414
"@modelcontextprotocol/ext-apps": "../..",
15-
"@modelcontextprotocol/sdk": "^1.22.0",
15+
"@modelcontextprotocol/sdk": "^1.24.0",
1616
"react": "^19.2.0",
1717
"react-dom": "^19.2.0",
1818
"zod": "^4.1.13"

examples/basic-server-vanillajs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"dependencies": {
1414
"@modelcontextprotocol/ext-apps": "../..",
15-
"@modelcontextprotocol/sdk": "^1.22.0",
15+
"@modelcontextprotocol/sdk": "^1.24.0",
1616
"zod": "^4.1.13"
1717
},
1818
"devDependencies": {

examples/budget-allocator-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"dependencies": {
1717
"@modelcontextprotocol/ext-apps": "../..",
18-
"@modelcontextprotocol/sdk": "^1.22.0",
18+
"@modelcontextprotocol/sdk": "^1.24.0",
1919
"chart.js": "^4.4.0",
2020
"zod": "^4.1.13"
2121
},

examples/cohort-heatmap-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"dependencies": {
1717
"@modelcontextprotocol/ext-apps": "../..",
18-
"@modelcontextprotocol/sdk": "^1.22.0",
18+
"@modelcontextprotocol/sdk": "^1.24.0",
1919
"react": "^19.2.0",
2020
"react-dom": "^19.2.0",
2121
"zod": "^4.1.13"

examples/customer-segmentation-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"dependencies": {
1717
"@modelcontextprotocol/ext-apps": "../..",
18-
"@modelcontextprotocol/sdk": "^1.22.0",
18+
"@modelcontextprotocol/sdk": "^1.24.0",
1919
"chart.js": "^4.4.0",
2020
"zod": "^4.1.13"
2121
},

examples/scenario-modeler-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"dependencies": {
1717
"@modelcontextprotocol/ext-apps": "../..",
18-
"@modelcontextprotocol/sdk": "^1.22.0",
18+
"@modelcontextprotocol/sdk": "^1.24.0",
1919
"chart.js": "^4.4.0",
2020
"react": "^19.2.0",
2121
"react-dom": "^19.2.0",

examples/system-monitor-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"dependencies": {
1717
"@modelcontextprotocol/ext-apps": "../..",
18-
"@modelcontextprotocol/sdk": "^1.22.0",
18+
"@modelcontextprotocol/sdk": "^1.24.0",
1919
"chart.js": "^4.4.0",
2020
"systeminformation": "^5.27.11",
2121
"zod": "^4.1.13"

examples/threejs-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"dependencies": {
1717
"@modelcontextprotocol/ext-apps": "../..",
18-
"@modelcontextprotocol/sdk": "^1.22.0",
18+
"@modelcontextprotocol/sdk": "^1.24.0",
1919
"react": "^19.2.0",
2020
"react-dom": "^19.2.0",
2121
"three": "^0.181.0",

0 commit comments

Comments
 (0)