diff --git a/Dockerfile b/Dockerfile index 89f40fb..00104ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,7 @@ FROM deps AS builder WORKDIR /app COPY tsconfig.json ./ +COPY build.js ./ COPY src ./src RUN pnpm build diff --git a/build.js b/build.js new file mode 100644 index 0000000..0b1eefb --- /dev/null +++ b/build.js @@ -0,0 +1,13 @@ +// build.js +import { build } from 'esbuild'; + +build({ + entryPoints: ['src/index.ts'], + bundle: true, + platform: 'node', + target: 'node22', + format: 'esm', + outfile: 'dist/index.js', + sourcemap: true, + packages: 'external', +}).catch(() => process.exit(1)); diff --git a/package.json b/package.json index 4a3f043..8a12871 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,11 @@ "description": "", "main": "dist/index.js", "scripts": { - "build": "tsc", "dev": "tsx watch src/index.ts", "start": "node dist/index.js", "lint": "eslint .", - "typecheck": "tsc --noEmit", + "typecheck": "tsc", + "build": "tsc && node build.js", "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], @@ -27,6 +27,7 @@ "devDependencies": { "@eslint/js": "^9.21.0", "@types/node": "^22.13.5", + "esbuild": "^0.28.1", "eslint": "^9.21.0", "pino-pretty": "^13.1.3", "tsx": "^4.19.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a550742..f43e766 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -226,6 +226,9 @@ importers: '@types/node': specifier: ^22.13.5 version: 22.20.0 + esbuild: + specifier: ^0.28.1 + version: 0.28.1 eslint: specifier: ^9.21.0 version: 9.39.4 diff --git a/src/server.ts b/src/server.ts index 86cdf66..ee31165 100644 --- a/src/server.ts +++ b/src/server.ts @@ -1,7 +1,7 @@ import Fastify, { type FastifyInstance } from "fastify"; import { ToolDef } from "./types"; import McpSession from "./mcpConnection"; -import { isInitializeRequest } from "@modelcontextprotocol/sdk/types"; +import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js"; import { pingTool, testAddTool, testRemoveTool, listToolsTool, invokeToolTool } from "./mcpTools"; export class Server { diff --git a/tsconfig.json b/tsconfig.json index e544bbb..8895a8e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,6 +6,7 @@ "lib": ["ES2022"], "outDir": "dist", "rootDir": "src", + "noEmit": true, "strict": true, "esModuleInterop": true, "skipLibCheck": true,