UNPKG

launchfast-mcp

Version:

🚀 Professional Amazon & Alibaba research tools for Claude AI - Product research, keyword intelligence, and supplier discovery via MCP

440 lines (326 loc) 8.21 kB
# 🚂 Railway Deployment Guide - LaunchFast MCP Server Deploy your MCP server to Railway in **under 5 minutes** for easy team access. --- ## 🎯 Why Railway? - **One command deployment** - `railway up` - **Auto HTTPS** - Free SSL certificates - **Zero config** - Works out of the box - **GitHub integration** - Auto-deploy on push - **Free tier** - $5/month credit included - **Team friendly** - One URL for everyone --- ## 📋 Prerequisites - [x] Railway CLI installed and logged in (you're already set!) - [x] Git repo linked to Railway - [x] LaunchFast API credentials --- ## 🚀 Deployment Steps ### Step 1: Set Environment Variables ```bash railway variables set LAUNCHFAST_API_URL=https://launchfastlegacyx.com railway variables set LAUNCHFAST_API_KEY=lf_your_api_key_here railway variables set LAUNCHFAST_USER_ID=your_user_id_here railway variables set ALLOWED_ORIGINS=* railway variables set PORT=3000 ``` **Important**: Use your actual LaunchFast credentials from the admin dashboard. ### Step 2: Deploy ```bash # Make sure all changes are committed git add . git commit -m "Add Railway deployment config" # Deploy to Railway railway up # Or if auto-deploy is enabled, just push: git push origin main ``` ### Step 3: Get Your URL ```bash railway domain ``` This will show your Railway URL, something like: ``` https://launchfast-mcp-production.up.railway.app ``` **Save this URL** - your team will use it to connect! ### Step 4: Verify Deployment ```bash # Check health endpoint curl https://your-app.up.railway.app/health # Expected response: { "status": "healthy", "service": "launchfast-mcp", "version": "1.0.0", "timestamp": "2025-01-02T..." } ``` --- ## 👥 Team Connection (Super Simple!) Now your team just adds this to their Claude Desktop config: ### macOS/Linux Edit: `~/Library/Application Support/Claude/claude_desktop_config.json` ### Windows Edit: `%APPDATA%\Claude\claude_desktop_config.json` ### Config (ONE URL for everyone!) ```json { "mcpServers": { "launchfast": { "command": "npx", "args": ["-y", "@modelcontextprotocol/create-client"], "env": { "MCP_SERVER_URL": "https://your-app.up.railway.app/sse" } } } } ``` **That's it!** No API keys to distribute, no local installation, just one URL. --- ## 🔒 Security with Team API Keys If you want per-user tracking, you can still use individual API keys: ### Option 1: Shared Server (Current) - One set of credentials in Railway - Everyone shares the same LaunchFast account - Simplest setup ### Option 2: Per-User Keys Update the server to accept API keys from clients: **Server** (Railway env vars): ```bash # Remove these from Railway: railway variables delete LAUNCHFAST_API_KEY railway variables delete LAUNCHFAST_USER_ID # Keep only: railway variables set LAUNCHFAST_API_URL=https://launchfastlegacyx.com ``` **Client** (each team member): ```json { "mcpServers": { "launchfast": { "command": "npx", "args": ["-y", "@modelcontextprotocol/create-client"], "env": { "MCP_SERVER_URL": "https://your-app.up.railway.app/sse", "LAUNCHFAST_API_KEY": "lf_individual_key_here", "LAUNCHFAST_USER_ID": "individual_user_id_here" } } } } ``` --- ## 📊 Monitoring ### View Logs ```bash railway logs ``` ### View Metrics ```bash railway status ``` ### View in Dashboard ```bash railway open ``` This opens Railway dashboard in browser where you can see: - CPU/Memory usage - Request count - Error rates - Deployment history --- ## 🔄 Updates & Redeploy ### Automatic (Recommended) Railway auto-deploys when you push to `main`: ```bash git add . git commit -m "Update MCP server" git push origin main ``` Railway will automatically: 1. Build your app 2. Run health checks 3. Switch to new version with zero downtime ### Manual ```bash railway up ``` --- ## 💰 Pricing **Free Tier**: - $5/month credit (included free) - ~500 hours/month execution time - Perfect for small teams (5-10 people) **Pro Tier** ($20/month): - $20 credit/month - Priority support - Custom domains - Better for larger teams **Estimate**: For typical team usage (50 queries/day): - ~$2-5/month on free tier - Well within the $5 free credit --- ## 🐛 Troubleshooting ### Deployment Failed **Check build logs**: ```bash railway logs --deployment ``` **Common issues**: - Missing environment variables - Build errors (run `npm run build` locally first) - Port conflicts (Railway uses PORT env var automatically) ### Server Not Responding **Check service status**: ```bash railway status ``` **Restart service**: ```bash railway restart ``` **Check health endpoint**: ```bash curl https://your-app.up.railway.app/health ``` ### Team Can't Connect **Verify URL**: ```bash railway domain ``` **Check ALLOWED_ORIGINS**: ```bash railway variables ``` Should show `ALLOWED_ORIGINS=*` (allows all origins) **Test SSE endpoint**: ```bash curl https://your-app.up.railway.app/sse ``` Should return SSE stream headers. --- ## 🎯 Custom Domain (Optional) ### Add Custom Domain ```bash railway domain add mcp.yourcompany.com ``` Then update DNS with the provided CNAME record. ### Update Team Configs Replace Railway URL with your custom domain: ```json { "env": { "MCP_SERVER_URL": "https://mcp.yourcompany.com/sse" } } ``` --- ## 📋 Deployment Checklist Before sharing with team: - [ ] Railway deployment successful - [ ] Health endpoint returns `{"status":"healthy"}` - [ ] SSE endpoint accessible at `/sse` - [ ] Environment variables set correctly - [ ] Tested with your own Claude Desktop - [ ] Documented team connection instructions - [ ] Set up monitoring/alerts (optional) - [ ] Custom domain configured (optional) --- ## 🚀 Quick Deploy Script Save this as `deploy.sh`: ```bash #!/bin/bash echo "🚂 Deploying LaunchFast MCP to Railway..." # Check if variables are set if ! railway variables | grep -q "LAUNCHFAST_API_KEY"; then echo "❌ Environment variables not set!" echo "Run: railway variables set LAUNCHFAST_API_KEY=..." exit 1 fi # Build locally first echo "📦 Building..." npm run build if [ $? -ne 0 ]; then echo "❌ Build failed!" exit 1 fi # Commit changes echo "💾 Committing changes..." git add . git commit -m "Deploy to Railway" || true # Deploy echo "🚀 Deploying..." railway up # Get URL echo "" echo "✅ Deployment complete!" echo "" echo "Your MCP server URL:" railway domain echo "" echo "Health check:" DOMAIN=$(railway domain | tail -1) curl -s "https://$DOMAIN/health" | json_pp echo "" echo "📋 Share this URL with your team:" echo "https://$DOMAIN/sse" ``` Make executable: ```bash chmod +x deploy.sh ./deploy.sh ``` --- ## 📞 Team Distribution Template Send this to your team: --- **Subject**: 🚀 LaunchFast MCP Server - Now Hosted! Hi team, Our LaunchFast MCP server is now live on Railway! Super simple setup: **1. Add this to your Claude Desktop config:** 📍 Config location: - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json` - Windows: `%APPDATA%\Claude\claude_desktop_config.json` 📝 Add this: ```json { "mcpServers": { "launchfast": { "command": "npx", "args": ["-y", "@modelcontextprotocol/create-client"], "env": { "MCP_SERVER_URL": "https://YOUR-RAILWAY-URL-HERE/sse" } } } } ``` **2. Restart Claude Desktop** **3. Test it:** ``` Research the Amazon market for "portable chargers" ``` **Need help?** Reply to this email or ping me on Slack! --- ## 🎊 You're Done! Your MCP server is now: - Hosted on Railway - Accessible via HTTPS - Auto-deploys on git push - Zero-config for team members - One URL for everyone **Next steps**: 1. Test the deployment yourself 2. Share connection instructions with team 3. Monitor usage in Railway dashboard **Railway Commands Cheat Sheet**: ```bash railway logs # View logs railway status # Check status railway restart # Restart service railway domain # Get URL railway open # Open dashboard railway variables # View env vars ``` Happy deploying! 🚂