Skip to main content
Glama

MCP Quoting System

by r-long
GIT-SETUP.md•10.9 kB
# Git Repository Setup & Auto-Deployment **Setting up GitHub repo with auto-deploy to Vercel and Railway** --- ## šŸŽÆ Repository Strategy ### What We'll Create: ``` mcp-quoting-system (GitHub repo) │ ā”œā”€ā”€ main branch → Production │ ā”œā”€ā”€ Auto-deploys to Railway (database + API) │ └── Auto-deploys to Vercel (optional frontend) │ └── dev branch → Development/Testing └── Can deploy to separate Railway/Vercel instances ``` --- ## šŸ“‹ Pre-Setup Checklist Before we create the repo, let's prepare: ### Files to Exclude from Git: - [ ] `.env` (contains secrets) - [ ] `node_modules/` (dependencies) - [ ] `dist/` (build output) - [ ] `data/*.json` (local database files) - [ ] `.DS_Store` (Mac files) - [ ] `*.log` (log files) - [ ] `uploads/` (uploaded PDFs) ### Files to Include: - [x] All `.ts` source files - [x] `package.json` & `package-lock.json` - [x] `tsconfig.json` - [x] `prisma/schema.prisma` - [x] `.env.example` (template without secrets) - [x] `.gitignore` (what to exclude) - [x] `README.md` (documentation) - [x] All documentation (*.md files) - [x] Batch files (*.bat) - [x] `public/` folder (web interface) --- ## šŸš€ Step-by-Step Setup ### Step 1: Prepare .gitignore Check if you have a good `.gitignore` file: ```gitignore # Dependencies node_modules/ package-lock.json # Build output dist/ build/ # Environment variables (IMPORTANT - NEVER COMMIT!) .env .env.local .env.*.local # Database files data/ *.sqlite *.db # Logs logs/ *.log npm-debug.log* server.log # OS files .DS_Store Thumbs.db # IDE .vscode/ .idea/ *.swp *.swo # Uploads uploads/ temp/ # Prisma .env prisma/.env # Testing coverage/ .nyc_output/ # Misc .cache/ *.pid *.seed *.pid.lock ``` ### Step 2: Create GitHub Repository **Option A: Via GitHub Website (Easier)** 1. Go to https://github.com/new 2. Fill in: - **Repository name:** `mcp-quoting-system` - **Description:** "MCP-based intelligent quoting system with PostgreSQL, vector search, and automated cost estimation" - **Visibility:** Private (recommended) or Public - **DO NOT** initialize with README (we have one) - **DO NOT** add .gitignore (we have one) 3. Click "Create repository" **Option B: Via GitHub CLI** ```bash gh repo create mcp-quoting-system --private --description "MCP-based intelligent quoting system" ``` ### Step 3: Initialize Local Git Repository ```powershell # Navigate to project cd C:\Users\Rich\OneDrive\Projects\Quoting # Initialize git (if not already) git init # Add all files git add . # Check what will be committed git status # Make sure .env is NOT in the list! # If it is, add it to .gitignore and run: git rm --cached .env # Create initial commit git commit -m "Initial commit: MCP Quoting System v1.0.0 with Phase 1 database migration" # Add remote (replace YOUR_USERNAME) git remote add origin https://github.com/YOUR_USERNAME/mcp-quoting-system.git # Push to GitHub git branch -M main git push -u origin main ``` ### Step 4: Verify on GitHub 1. Go to your repository: `https://github.com/YOUR_USERNAME/mcp-quoting-system` 2. Check that files are there 3. **CRITICAL:** Verify `.env` is NOT committed 4. Check that `.env.example` IS committed --- ## šŸš‚ Railway Auto-Deployment Setup ### Step 1: Connect Repository to Railway 1. **In Railway Dashboard:** - Click your project - Click "+ New" - Select "GitHub Repo" - Authorize Railway to access your GitHub - Select `mcp-quoting-system` repo 2. **Configure Build Settings:** - **Build Command:** `npm install && npm run build` - **Start Command:** `npm start` - **Root Directory:** `/` (or leave blank) 3. **Add Environment Variables:** - Click on your Node.js service - Go to "Variables" tab - Add these: ``` NODE_ENV=production PORT=3789 DATABASE_URL=${{Postgres.DATABASE_URL}} (Reference your Railway PostgreSQL) OPENAI_API_KEY=sk-your-key-here SMTP_HOST=smtp.gmail.com SMTP_PORT=587 SMTP_USER=your-email@gmail.com SMTP_PASS=your-app-password ``` 4. **Link PostgreSQL:** - In Variables, use Railway's internal linking: - `DATABASE_URL=${{Postgres.DATABASE_URL}}` - Railway auto-connects services ### Step 2: Configure Deployment Triggers **In Railway Settings:** - **Auto-deploy on push:** āœ… Enabled - **Branch:** `main` - **Deploy on PR:** Optional (good for testing) **Optional: Multiple Environments** ``` main branch → Production Railway service dev branch → Staging Railway service ``` ### Step 3: Test Deployment ```powershell # Make a small change echo "# Test deployment" >> README.md # Commit and push git add README.md git commit -m "Test: Railway auto-deployment" git push # Watch Railway dashboard - should auto-deploy! ``` --- ## ⚔ Vercel Auto-Deployment Setup ### Option A: Deploy Node.js API to Vercel **Note:** Vercel is optimized for frontend/serverless. For your MCP server, Railway might be better. But if you want to deploy to Vercel: 1. **Install Vercel CLI:** ```bash npm install -g vercel ``` 2. **Login:** ```bash vercel login ``` 3. **Initialize Project:** ```bash cd C:\Users\Rich\OneDrive\Projects\Quoting vercel ``` 4. **Add `vercel.json` configuration:** ```json { "version": 2, "builds": [ { "src": "dist/index.js", "use": "@vercel/node" } ], "routes": [ { "src": "/(.*)", "dest": "dist/index.js" } ], "env": { "NODE_ENV": "production" } } ``` 5. **Connect to GitHub:** - Go to https://vercel.com/dashboard - Click "New Project" - Import from GitHub - Select `mcp-quoting-system` - Configure environment variables - Deploy! ### Option B: Vercel Frontend + Railway Backend (Recommended) **Better architecture:** - **Railway:** Node.js MCP server + PostgreSQL - **Vercel:** Static frontend or Next.js UI We can build a separate Next.js frontend that connects to Railway API. --- ## šŸ” Environment Variables Management ### Development (.env - local only, not committed): ```env DATABASE_URL="postgresql://localhost:5432/quoting_db" OPENAI_API_KEY="sk-..." NODE_ENV="development" ``` ### Railway (set in dashboard): ``` DATABASE_URL=${{Postgres.DATABASE_URL}} OPENAI_API_KEY=sk-... NODE_ENV=production PORT=3789 ``` ### Vercel (set in dashboard): ``` NEXT_PUBLIC_API_URL=https://your-railway-app.up.railway.app ``` --- ## šŸ“ Repository Structure ``` mcp-quoting-system/ ā”œā”€ā”€ .github/ │ └── workflows/ # CI/CD (optional) │ └── deploy.yml ā”œā”€ā”€ prisma/ │ └── schema.prisma ā”œā”€ā”€ src/ │ ā”œā”€ā”€ database/ │ ā”œā”€ā”€ services/ │ └── index.ts ā”œā”€ā”€ scripts/ │ └── migrate-json-to-db.ts ā”œā”€ā”€ public/ # Web interface │ ā”œā”€ā”€ index.html │ └── styles.css ā”œā”€ā”€ docs/ # Documentation │ ā”œā”€ā”€ DATABASE-SETUP.md │ ā”œā”€ā”€ RAILWAY-SETUP.md │ └── ... ā”œā”€ā”€ .env.example # āœ… Committed (template) ā”œā”€ā”€ .env # āŒ NOT committed (secrets) ā”œā”€ā”€ .gitignore ā”œā”€ā”€ package.json ā”œā”€ā”€ tsconfig.json ā”œā”€ā”€ README.md └── CHANGELOG.md ``` --- ## šŸ”„ Development Workflow ### Daily Development: ```bash # 1. Pull latest changes git pull origin main # 2. Create feature branch git checkout -b feature/new-feature # 3. Make changes # ... code code code ... # 4. Test locally npm run dev # 5. Commit changes git add . git commit -m "feat: add new feature" # 6. Push to GitHub git push origin feature/new-feature # 7. Create Pull Request on GitHub # 8. Merge to main → Auto-deploys to Railway! ``` ### Deployment Flow: ``` Local Development ↓ git push to GitHub ↓ Auto-deploys to Railway/Vercel ↓ Production running! ``` --- ## šŸŽÆ Branch Strategy ### Simple Strategy (Recommended): ``` main ↓ └── Auto-deploys to production ``` ### Advanced Strategy: ``` main (production) ↓ dev (staging) ↓ feature/* (development) ``` --- ## āœ… Setup Checklist ### Pre-Git: - [ ] Good `.gitignore` file exists - [ ] `.env.example` created (template without secrets) - [ ] `.env` in `.gitignore` - [ ] Documentation is up to date - [ ] All secrets removed from code ### GitHub: - [ ] Repository created on GitHub - [ ] Local repo initialized - [ ] Initial commit made - [ ] Pushed to GitHub - [ ] Verified `.env` NOT in repo ### Railway: - [ ] Repository connected to Railway - [ ] Build/start commands configured - [ ] Environment variables set - [ ] PostgreSQL linked - [ ] Auto-deploy enabled - [ ] Test deployment successful ### Vercel (Optional): - [ ] Project connected to Vercel - [ ] Environment variables set - [ ] Auto-deploy enabled - [ ] Test deployment successful --- ## 🚨 Security Checklist **CRITICAL - Never commit:** - [ ] `.env` file - [ ] Database passwords - [ ] API keys (OpenAI, SMTP) - [ ] User credentials - [ ] Private keys **Always commit:** - [ ] `.env.example` (sanitized template) - [ ] `.gitignore` (properly configured) - [ ] Source code - [ ] Documentation --- ## šŸ“Š Deployment Status Once set up, you can monitor: **Railway:** - Deployments tab: See build/deploy history - Logs tab: Real-time application logs - Metrics: CPU, memory, network usage **Vercel:** - Deployments: Each push creates a deployment - Preview URLs: Test before production - Analytics: Performance metrics --- ## šŸ”— Useful Commands ```bash # Check git status git status # View commit history git log --oneline # Create new branch git checkout -b feature/new-feature # Switch branches git checkout main # Pull latest changes git pull # Push changes git push # View remotes git remote -v # Undo last commit (keep changes) git reset --soft HEAD~1 # Deploy to Railway manually railway up # Deploy to Vercel manually vercel --prod ``` --- ## šŸŽ“ Best Practices 1. **Commit Often:** Small, focused commits 2. **Meaningful Messages:** Use conventional commits - `feat:` New feature - `fix:` Bug fix - `docs:` Documentation - `refactor:` Code refactoring 3. **Branch Protection:** Protect `main` branch 4. **Code Review:** Use Pull Requests 5. **Environment Variables:** Never hardcode secrets 6. **Testing:** Test before pushing 7. **Documentation:** Keep docs updated --- ## šŸš€ Next Steps **What do you want to do first?** 1. **Create GitHub repository** - I'll give you exact commands 2. **Set up Railway auto-deploy** - Connect repo to Railway - Configure environment 3. **Set up Vercel (optional)** - For frontend/API routes 4. **All of the above** - Complete CI/CD pipeline **Tell me and I'll guide you through it step-by-step!**

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/r-long/mcp-quoting-system'

If you have feedback or need assistance with the MCP directory API, please join our Discord server