fix: resolve TypeScript compilation errors in Docker build

The build was failing because TypeScript couldn't find module imports.
Fixed by:
1. Installing minimal dependencies needed for compilation (MCP SDK, dotenv, express)
2. Excluding n8n node implementation files that aren't needed for MCP server
   - Removed src/n8n directory (n8n node implementation)
   - Removed src/utils/bridge.ts and src/utils/mcp-client.ts (n8n-specific utils)

These files are only used for n8n integration, not for the MCP server runtime.

Results:
- Build succeeds with only 102 packages (vs 2294 before)
- TypeScript compiles without errors
- Faster builds and smaller image

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czlonkowski
2025-06-18 23:37:48 +02:00
parent 8777c82235
commit 98b7e83739

View File

@@ -8,13 +8,16 @@ WORKDIR /app
# Copy tsconfig for TypeScript compilation
COPY tsconfig.json ./
# Create minimal package.json and install ONLY TypeScript
# Create minimal package.json and install ONLY build dependencies
RUN --mount=type=cache,target=/root/.npm \
echo '{}' > package.json && \
npm install --no-save typescript@^5.8.3 @types/node@^22.15.30 @types/express@^5.0.3
npm install --no-save typescript@^5.8.3 @types/node@^22.15.30 @types/express@^5.0.3 \
@modelcontextprotocol/sdk@^1.12.1 dotenv@^16.5.0 express@^5.1.0
# Copy source and build
# Copy source and build (excluding n8n-specific files)
COPY src ./src
# Remove n8n node implementation and related utils that aren't needed for MCP server
RUN rm -rf src/n8n src/utils/bridge.ts src/utils/mcp-client.ts
RUN npx tsc
# Stage 2: Runtime (minimal dependencies)