Skip to content

Commit 4243707

Browse files
committed
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
1 parent bea0ae2 commit 4243707

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
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
]);

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
},
6060
"author": "Olivier Chafik",
6161
"devDependencies": {
62+
"@modelcontextprotocol/sdk": "^1.24.3",
6263
"@playwright/test": "^1.52.0",
6364
"@types/bun": "^1.3.2",
6465
"@types/react": "^19.2.2",
@@ -79,6 +80,7 @@
7980
"zod": "^4.1.13"
8081
},
8182
"peerDependencies": {
83+
"@modelcontextprotocol/sdk": "^1.20.0",
8284
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
8385
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
8486
"zod": "^3.25.0 || ^4.0.0"
@@ -92,7 +94,6 @@
9294
}
9395
},
9496
"dependencies": {
95-
"@modelcontextprotocol/sdk": "^1.24.3",
9697
"prettier": "^3.6.2"
9798
},
9899
"optionalDependencies": {

0 commit comments

Comments
 (0)