Skip to content

Commit 0079f52

Browse files
committed
fix: add module field and ES module support for Smithery CLI compatibility
🔧 Package.json Updates: - Add 'module' field pointing to './src/index.ts' (required by Smithery CLI) - Add 'type': 'module' for ES module support - Add 'exports' field for better module resolution - Add 'build:smithery' script for Smithery-specific builds �� TypeScript Configuration: - Add tsconfig.smithery.json for ES module builds - Configure separate build output for Smithery (build-smithery/) - Maintain CommonJS compatibility for existing CLI usage 🚀 Smithery Configuration: - Update smithery.yaml with custom build command and entry point - Specify buildCommand: 'npm run build:smithery' - Set entryPoint: './build-smithery/index.js' 📁 Build Management: - Update .gitignore to exclude build-smithery directory - Update clean script to remove both build directories This resolves the Smithery CLI build error: 'No entry point found in package.json. Please define the module field' The package now supports both traditional npm installation and Smithery.ai hosted deployment with proper ES module handling.
1 parent 505183f commit 0079f52

File tree

4 files changed

+42
-1
lines changed

4 files changed

+42
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ yarn-error.log*
1414

1515
# Build files
1616
/build
17+
/build-smithery
1718
/dist
1819

1920
# Coverage directory used by tools like istanbul

package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@
33
"version": "0.10.1",
44
"description": "Model Context Protocol server for n8n workflow management",
55
"main": "build/server.js",
6+
"module": "./src/index.ts",
7+
"type": "module",
8+
"exports": {
9+
".": {
10+
"import": "./src/index.ts",
11+
"require": "./build/server.js"
12+
}
13+
},
614
"scripts": {
7-
"clean": "rm -rf build",
15+
"clean": "rm -rf build build-smithery",
816
"build": "tsc",
17+
"build:smithery": "tsc -p tsconfig.smithery.json",
918
"dev": "tsc -w",
1019
"start": "node build/server.js",
1120
"prepare": "npm run build",

smithery.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
runtime: "typescript"
2+
build:
3+
buildCommand: "npm run build:smithery"
4+
entryPoint: "./build-smithery/index.js"
25
name: n8n-workflow-builder
36
displayName: n8n Workflow Builder
47
description: An MCP server for programmatically creating and managing n8n workflows with comprehensive API access.

tsconfig.smithery.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"target": "ES2020",
5+
"module": "ESNext",
6+
"moduleResolution": "node",
7+
"outDir": "./build-smithery",
8+
"rootDir": "./src",
9+
"strict": true,
10+
"esModuleInterop": true,
11+
"allowSyntheticDefaultImports": true,
12+
"skipLibCheck": true,
13+
"forceConsistentCasingInFileNames": true,
14+
"declaration": true,
15+
"declarationMap": true,
16+
"sourceMap": true,
17+
"types": ["node"]
18+
},
19+
"include": [
20+
"src/index.ts"
21+
],
22+
"exclude": [
23+
"node_modules",
24+
"build",
25+
"tests",
26+
"src/server.ts"
27+
]
28+
}

0 commit comments

Comments
 (0)