Skip to content

Commit 6c9a678

Browse files
committed
fix: properly background node server so it auto-starts in Codespaces
1 parent 87c22d5 commit 6c9a678

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717

1818
"postCreateCommand": "npm install && npm run build",
19-
"postStartCommand": "nohup bash .devcontainer/setup.sh > /tmp/mcp-server.log 2>&1 &",
19+
"postStartCommand": "bash .devcontainer/setup.sh",
2020

2121
"customizations": {
2222
"vscode": {

.devcontainer/setup.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,24 @@ fi
5454

5555
echo ""
5656
echo "🚀 Starting MCP server on http://localhost:3001..."
57-
echo " Logs: /tmp/mcp-server.log"
5857
echo "======================================"
5958

6059
# Make port public (only in Codespaces) - run in background
6160
if [ -n "$CODESPACE_NAME" ]; then
6261
(sleep 5 && gh codespace ports visibility 3001:public -c "$CODESPACE_NAME" 2>/dev/null) &
6362
fi
6463

65-
# Start the server
66-
exec node dist/server.js
64+
# Start the server in background with proper logging
65+
nohup node dist/server.js > /tmp/mcp-server.log 2>&1 &
66+
SERVER_PID=$!
67+
echo "✅ MCP server started (PID: $SERVER_PID)"
68+
echo " Logs: tail -f /tmp/mcp-server.log"
69+
70+
# Wait a moment and verify it's running
71+
sleep 2
72+
if kill -0 $SERVER_PID 2>/dev/null; then
73+
echo "✅ Server is running"
74+
else
75+
echo "❌ Server failed to start. Check /tmp/mcp-server.log"
76+
cat /tmp/mcp-server.log
77+
fi

0 commit comments

Comments
 (0)