# Migrating to Bun
## Why Bun for MCP?
1. **4x Faster Startup** - Critical for MCP servers that start with each Claude conversation
2. **No Build Step** - Run TypeScript directly
3. **Simpler Toolchain** - No need for tsx, rimraf, or typescript compiler
4. **Better Performance** - Faster HTTP requests and JSON parsing
## Migration Steps
### 1. Install Bun
Windows (PowerShell as Admin):
```powershell
irm bun.sh/install.ps1 | iex
```
Or via Scoop:
```bash
scoop install bun
```
### 2. Replace package.json
```bash
# Backup existing
copy package.json package.node.json
# Use Bun version
copy package.bun.json package.json
```
### 3. Install Dependencies with Bun
```bash
# Remove node_modules
rmdir /s /q node_modules
# Install with Bun
bun install
```
### 4. Update Claude Desktop Config
Edit `%APPDATA%\Claude\claude_desktop_config.json`:
```json
{
"mcpServers": {
"mindbody": {
"command": "bun",
"args": ["run", "C:\\Users\\VinSpo\\Desktop\\MindbodyMCP\\src\\index.ts"],
"env": {
"MINDBODY_API_KEY": "your_api_key",
"MINDBODY_SITE_ID": "-99",
"MINDBODY_SOURCE_NAME": "your_source_name",
"MINDBODY_SOURCE_PASSWORD": "your_source_password"
}
}
}
}
```
### 5. Test with Bun
```bash
# Test the tool
bun run test:tool
# Run the server
bun run dev
```
## Benefits You'll Notice
1. **Instant Startup** - No TypeScript compilation delay
2. **Faster Development** - Hot reload without build step
3. **Smaller Footprint** - Bun binary handles everything
4. **Better Errors** - Native TypeScript error messages
## Rollback (if needed)
```bash
# Restore Node.js setup
copy package.node.json package.json
npm install
npm run build
```
Then update Claude config back to use `node` with `dist/index.js`.
## Compatibility Notes
✅ **Confirmed Working:**
- @modelcontextprotocol/sdk
- axios
- dotenv
- All our current code
⚠️ **Watch for:**
- Native Node.js modules (we don't use any)
- Complex build tools (we don't need them)
## Performance Comparison
| Operation | Node.js | Bun |
|-----------|---------|-----|
| Startup | ~800ms | ~200ms |
| First API Call | ~1200ms | ~400ms |
| Package Install | ~15s | ~3s |
| TypeScript Run | Needs build | Direct |