Open
Description
Describe the bug
After cloning the repo, npm install
, and npm run build
works great.
pnpm install
and pnpm build
fails.
To Reproduce
Steps to reproduce the behavior:
- Clone the repo
pnpm install
pnpm build
Expected behavior
I expect it to build.
Logs
pnpm build
> @modelcontextprotocol/sdk@1.12.1 build /Users/kscott/Code/typescript-sdk
> npm run build:esm && npm run build:cjs
> @modelcontextprotocol/sdk@1.12.1 build:esm
> tsc -p tsconfig.prod.json && echo '{"type": "module"}' > dist/esm/package.json
src/client/streamableHttp.ts:4:41 - error TS2307: Cannot find module 'eventsource-parser/stream' or its corresponding type declarations.
4 import { EventSourceParserStream } from "eventsource-parser/stream";
~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/client/streamableHttp.ts:300:15 - error TS18046: 'event' is of type 'unknown'.
300 if (event.id) {
~~~~~
src/client/streamableHttp.ts:301:27 - error TS18046: 'event' is of type 'unknown'.
301 lastEventId = event.id;
~~~~~
src/client/streamableHttp.ts:302:33 - error TS18046: 'event' is of type 'unknown'.
302 onresumptiontoken?.(event.id);
~~~~~
src/client/streamableHttp.ts:305:16 - error TS18046: 'event' is of type 'unknown'.
305 if (!event.event || event.event === "message") {
~~~~~
src/client/streamableHttp.ts:305:31 - error TS18046: 'event' is of type 'unknown'.
305 if (!event.event || event.event === "message") {
~~~~~
src/client/streamableHttp.ts:307:69 - error TS18046: 'event' is of type 'unknown'.
307 const message = JSONRPCMessageSchema.parse(JSON.parse(event.data));
~~~~~
src/examples/server/simpleStreamableHttp.ts:239:23 - error TS2339: Property 'auth' does not exist on type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
239 if (useOAuth && req.auth) {
~~~~
src/examples/server/simpleStreamableHttp.ts:240:44 - error TS2339: Property 'auth' does not exist on type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
240 console.log('Authenticated user:', req.auth);
~~~~
src/examples/server/simpleStreamableHttp.ts:326:23 - error TS2339: Property 'auth' does not exist on type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
326 if (useOAuth && req.auth) {
~~~~
src/examples/server/simpleStreamableHttp.ts:327:64 - error TS2339: Property 'auth' does not exist on type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
327 console.log('Authenticated SSE connection from user:', req.auth);
~~~~
src/server/auth/handlers/revoke.ts:62:26 - error TS2339: Property 'client' does not exist on type 'Request<{}, any, any, ParsedQs, Record<string, any>>'.
62 const client = req.client;
~~~~~~
src/server/auth/handlers/token.ts:78:26 - error TS2339: Property 'client' does not exist on type 'Request<{}, any, any, ParsedQs, Record<string, any>>'.
78 const client = req.client;
~~~~~~
src/server/auth/middleware/bearerAuth.ts:23:16 - error TS2664: Invalid module name in augmentation, module 'express-serve-static-core' cannot be found.
23 declare module "express-serve-static-core" {
~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/server/auth/middleware/bearerAuth.ts:71:11 - error TS2339: Property 'auth' does not exist on type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
71 req.auth = authInfo;
~~~~
src/server/auth/middleware/clientAuth.ts:19:16 - error TS2664: Invalid module name in augmentation, module 'express-serve-static-core' cannot be found.
19 declare module "express-serve-static-core" {
~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/server/auth/middleware/clientAuth.ts:60:11 - error TS2339: Property 'client' does not exist on type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
60 req.client = client;
~~~~~~
src/server/auth/router.ts:188:17 - error TS2742: The inferred type of 'mcpAuthMetadataRouter' cannot be named without a reference to '.pnpm/@types+express-serve-static-core@5.0.6/node_modules/@types/express-serve-static-core'. This is likely not portable. A type annotation is necessary.
188 export function mcpAuthMetadataRouter(options: AuthMetadataOptions) {
~~~~~~~~~~~~~~~~~~~~~
Found 18 errors in 7 files.
Errors Files
7 src/client/streamableHttp.ts:4
4 src/examples/server/simpleStreamableHttp.ts:239
1 src/server/auth/handlers/revoke.ts:62
1 src/server/auth/handlers/token.ts:78
2 src/server/auth/middleware/bearerAuth.ts:23
2 src/server/auth/middleware/clientAuth.ts:19
1 src/server/auth/router.ts:188