33
44echo " 🔨 Building NCP DXT from clean directory..."
55
6+ # Store project root directory
7+ PROJECT_ROOT=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) /.." && pwd) "
8+ echo " 📍 Project root: $PROJECT_ROOT "
9+
610# Build TypeScript first
711echo " 📦 Building TypeScript..."
812npm run build
4751
4852# Pack DXT from clean directory
4953echo " 📦 Packing DXT..."
50- npx @anthropic-ai/mcpb pack . /Users/arul/Projects/ ncp-production-clean/ncp .dxt
54+ npx @anthropic-ai/mcpb pack . " $PROJECT_ROOT / ncp.dxt"
5155
5256# WORKAROUND: mcpb excludes build/ directories from node_modules
5357# Extract DXT (zip format), manually add build directories, re-pack
5458echo " 🔧 Fixing missing build directories (mcpb workaround)..."
5559PATCH_DIR=$( mktemp -d)
5660cd " $PATCH_DIR "
57- unzip -q /Users/arul/Projects/ ncp-production-clean/ncp .dxt
61+ unzip -q " $PROJECT_ROOT / ncp.dxt"
5862
5963# Copy missing build directories from temp install
6064if [ -d " $TEMP_DIR /node_modules/human-signals/build" ]; then
@@ -69,9 +73,9 @@ if [ -d "$TEMP_DIR/node_modules/execa/node_modules/human-signals/build" ]; then
6973fi
7074
7175# Re-pack as zip (DXT is zip format, not tar.gz)
72- rm -f /Users/arul/Projects/ ncp-production-clean/ncp .dxt
73- zip -qr /Users/arul/Projects/ ncp-production-clean/ncp .dxt .
74- cd /Users/arul/Projects/ncp-production-clean
76+ rm -f " $PROJECT_ROOT / ncp.dxt"
77+ zip -qr " $PROJECT_ROOT / ncp.dxt" .
78+ cd " $PROJECT_ROOT "
7579
7680# Cleanup temp directories
7781rm -rf " $TEMP_DIR " " $PATCH_DIR "
@@ -82,28 +86,28 @@ echo "🧪 Testing DXT (MCP spec compliance)..."
8286
8387# Verify it's a valid zip file
8488echo " • Verifying zip format..."
85- if ! unzip -t /Users/arul/Projects/ ncp-production-clean/ncp .dxt > /dev/null 2>&1 ; then
89+ if ! unzip -t " $PROJECT_ROOT / ncp.dxt" > /dev/null 2>&1 ; then
8690 echo " ❌ FAILED: DXT is not a valid zip file"
8791 exit 1
8892fi
8993echo " ✅ Valid zip format"
9094
9195TEST_DIR=$( mktemp -d)
9296cd " $TEST_DIR "
93- unzip -q /Users/arul/Projects/ ncp-production-clean/ncp .dxt > /dev/null 2>&1
97+ unzip -q " $PROJECT_ROOT / ncp.dxt" > /dev/null 2>&1
9498
9599# Quick verification test
96100echo " • Checking dependencies..."
97101if [ ! -d " node_modules/human-signals/build" ]; then
98102 echo " ❌ FAILED: human-signals/build missing"
99- cd /Users/arul/Projects/ncp-production-clean
103+ cd " $PROJECT_ROOT "
100104 rm -rf " $TEST_DIR "
101105 exit 1
102106fi
103107
104108if [ ! -d " node_modules/execa/node_modules/human-signals/build" ]; then
105109 echo " ❌ FAILED: execa/node_modules/human-signals/build missing"
106- cd /Users/arul/Projects/ncp-production-clean
110+ cd " $PROJECT_ROOT "
107111 rm -rf " $TEST_DIR "
108112 exit 1
109113fi
127131 echo " ⚠️ Server test skipped (requires stdio mode)"
128132fi
129133
130- cd /Users/arul/Projects/ncp-production-clean
134+ cd " $PROJECT_ROOT "
131135rm -rf " $TEST_DIR "
132136
133137echo " "
0 commit comments