Skip to content

Commit 467e913

Browse files
authored
Merge pull request #64 from mcp-agents-ai/feat/leixu/improve-setup
feat: Enhance project setup with nvm instructions and add setup scrip…
2 parents 909611d + 87182e2 commit 467e913

File tree

7 files changed

+85
-1
lines changed

7 files changed

+85
-1
lines changed

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22.16.0

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,43 @@ graph TD
119119
- Lucide React (for icons)
120120

121121
## Installation
122+
123+
### Prerequisites
124+
This project uses Node Version Manager (nvm) to manage Node.js versions. Make sure you have nvm installed globally.
125+
126+
#### Installing nvm (if not already installed)
127+
```bash
128+
# Install nvm
129+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
130+
131+
# Reload your shell configuration
132+
source ~/.bashrc
133+
134+
# Verify nvm installation
135+
nvm --version
136+
```
137+
138+
### Project Setup
122139
1. Clone the repository
123-
2. Run `npm install` to install dependencies
140+
2. **Quick Setup (Recommended)**: Run the setup script which handles nvm and dependencies:
141+
```bash
142+
./setup.sh
143+
```
144+
145+
**OR Manual Setup**:
146+
- Use the correct Node.js version specified in `.nvmrc`:
147+
```bash
148+
nvm use
149+
```
150+
If the Node.js version isn't installed, nvm will prompt you to install it:
151+
```bash
152+
nvm install
153+
```
154+
- Run `npm install` to install dependencies
124155
3. Start the development server with `npm run dev`
125156
157+
**Note**: The project includes a `.nvmrc` file that specifies the required Node.js version (22.16.0). Always run `nvm use` when switching to this project to ensure you're using the correct Node.js version.
158+
126159
## Available Scripts
127160
- `dev`: Start development server
128161
- `build`: Build for production

client/.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22.16.0

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"server"
99
],
1010
"scripts": {
11+
"preinstall": "echo 'Make sure to run \"nvm use\" before installing dependencies'",
1112
"dev": "concurrently \"npm run server:dev\" \"npm run client:dev\"",
1213
"client:dev": "cd client && vite",
1314
"server:dev": "cd server && tsx watch src/server.ts",

server/.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22.16.0

setup.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# MCP Agents Hub - Environment Setup Script
5+
# This script ensures the correct Node.js version is being used via nvm
6+
7+
echo "🚀 Setting up MCP Agents Hub development environment..."
8+
9+
# Source nvm (in case it's not in the current shell)
10+
export NVM_DIR="$HOME/.nvm"
11+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
12+
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
13+
14+
# Check if nvm is available
15+
if ! type nvm &> /dev/null; then
16+
echo "❌ nvm is not installed or not sourced. Please install nvm first:"
17+
echo " curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash"
18+
echo " source ~/.bashrc"
19+
exit 1
20+
fi
21+
22+
# Use the Node.js version specified in .nvmrc
23+
if [ -f ".nvmrc" ]; then
24+
echo "📋 Found .nvmrc file, using specified Node.js version..."
25+
nvm use
26+
if [ $? -ne 0 ]; then
27+
echo "⚠️ Node.js version not installed. Installing now..."
28+
nvm install
29+
nvm use
30+
fi
31+
else
32+
echo "⚠️ No .nvmrc file found, using default Node.js version"
33+
fi
34+
35+
# Display current versions
36+
echo "✅ Node.js version: $(node --version)"
37+
echo "✅ npm version: $(npm --version)"
38+
39+
# Install dependencies
40+
echo "📦 Installing dependencies..."
41+
npm ci
42+
43+
echo "🎉 Setup complete! You can now run:"
44+
echo " npm run dev (start development server)"
45+
echo " npm run build (build for production)"
46+
echo " npm run lint (run linting)"

0 commit comments

Comments
 (0)