-
Notifications
You must be signed in to change notification settings - Fork 0
Integrate React frontend with MCP Bridge API #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
SPerekrestova
merged 3 commits into
main
from
claude/mcp-bridge-frontend-integration-01MxvXHdRCEDCaLApWnk98XU
Nov 17, 2025
+1,429
−455
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| VITE_GITHUB_OWNER=your-organization-or-user-name | ||
| VITE_GITHUB_OWNER_TYPE=user-or-org | ||
| VITE_GITHUB_TOKEN=your-github-personal-access-token | ||
| VITE_GITHUB_API_BASE_URL=https://api.github.com | ||
| # MCP Bridge Configuration | ||
| VITE_MCP_BRIDGE_URL=http://localhost:3001 | ||
| VITE_GITHUB_ORGANIZATION=your-org-or-username |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # MCP Bridge Configuration (Production) | ||
| VITE_MCP_BRIDGE_URL=https://mcp-bridge.yourdomain.com | ||
| VITE_GITHUB_ORGANIZATION=SPerekrestova | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,245 @@ | ||
| # Deployment Guide - Free Hosting | ||
|
|
||
| ## ⚠️ Important: MCP Server Required | ||
|
|
||
| This application uses a **3-tier MCP architecture** that requires: | ||
| 1. **Frontend** (React) | ||
| 2. **MCP Bridge** (FastAPI) | ||
| 3. **MCP Server** (FastMCP) ← **Must be included!** | ||
|
|
||
| 📚 **[Read MCP Server Deployment Guide](./MCP_DEPLOYMENT.md)** for detailed instructions on bundling MCP Server with your deployment. | ||
|
|
||
| **Quick Summary:** You need to either: | ||
| - Copy MCP Server into `mcp-server/` directory in this repo, OR | ||
| - Add MCP Server as a git submodule, OR | ||
| - Download it during build | ||
|
|
||
| --- | ||
|
|
||
| ## 🎯 Quick Deploy to Render (Free) | ||
|
|
||
| ### Prerequisites | ||
| - GitHub account | ||
| - Render account (free): https://render.com | ||
| - **MCP Server in your repository** (see [MCP_DEPLOYMENT.md](./MCP_DEPLOYMENT.md)) | ||
|
|
||
| ### 1. Deploy Backend (MCP Bridge + MCP Server) | ||
|
|
||
| **Via Render Dashboard:** | ||
|
|
||
| 1. Go to https://dashboard.render.com | ||
| 2. Click **"New +"** → **"Web Service"** | ||
| 3. Connect GitHub repository: `SPerekrestova/github-knowledge-vault` | ||
| 4. Configure: | ||
| ``` | ||
| Name: github-knowledge-vault-bridge | ||
| Root Directory: mcp-bridge | ||
| Environment: Python 3 | ||
| Build Command: pip install -r requirements.txt | ||
| Start Command: python main.py | ||
| Plan: Free | ||
| ``` | ||
|
|
||
| 5. **Environment Variables:** | ||
| ``` | ||
| GITHUB_TOKEN=your_github_personal_access_token | ||
| GITHUB_ORGANIZATION=SPerekrestova | ||
| PORT=10000 | ||
| HOST=0.0.0.0 | ||
| CACHE_TTL_SECONDS=300 | ||
| CACHE_ENABLED=true | ||
| CORS_ORIGINS=* | ||
| LOG_LEVEL=INFO | ||
| ``` | ||
|
|
||
| 6. Click **"Create Web Service"** | ||
| 7. Wait for deployment (~5 minutes) | ||
| 8. Copy your service URL: `https://your-service.onrender.com` | ||
|
|
||
| ### 2. Deploy Frontend (React App) | ||
|
|
||
| **Via Render Dashboard:** | ||
|
|
||
| 1. Click **"New +"** → **"Static Site"** | ||
| 2. Connect same GitHub repository | ||
| 3. Configure: | ||
| ``` | ||
| Name: github-knowledge-vault | ||
| Root Directory: (leave empty) | ||
| Build Command: npm install && npm run build | ||
| Publish Directory: dist | ||
| ``` | ||
|
|
||
| 4. **Environment Variables:** | ||
| ``` | ||
| VITE_MCP_BRIDGE_URL=https://your-bridge-service.onrender.com | ||
| VITE_GITHUB_ORGANIZATION=SPerekrestova | ||
| ``` | ||
|
|
||
| 5. Click **"Create Static Site"** | ||
| 6. Wait for deployment (~3 minutes) | ||
| 7. Your app is live! 🎉 | ||
|
|
||
| ### 3. Access Your App | ||
|
|
||
| - **Frontend:** `https://github-knowledge-vault.onrender.com` | ||
| - **Backend API:** `https://github-knowledge-vault-bridge.onrender.com` | ||
| - **Health Check:** `https://github-knowledge-vault-bridge.onrender.com/health` | ||
|
|
||
| --- | ||
|
|
||
| ## 🔧 Alternative: Vercel (Frontend) + Render (Backend) | ||
|
|
||
| ### Deploy Frontend to Vercel: | ||
|
|
||
| ```bash | ||
| # Install Vercel CLI | ||
| npm i -g vercel | ||
|
|
||
| # Deploy from project root | ||
| cd /home/user/github-knowledge-vault | ||
| vercel | ||
|
|
||
| # Add environment variables | ||
| vercel env add VITE_MCP_BRIDGE_URL production | ||
| # Enter: https://your-bridge.onrender.com | ||
|
|
||
| vercel env add VITE_GITHUB_ORGANIZATION production | ||
| # Enter: SPerekrestova | ||
|
|
||
| # Deploy to production | ||
| vercel --prod | ||
| ``` | ||
|
|
||
| **Result:** | ||
| - Frontend: `https://github-knowledge-vault.vercel.app` (faster) | ||
| - Backend: `https://your-bridge.onrender.com` (free) | ||
|
|
||
| --- | ||
|
|
||
| ## 🐳 Alternative: Railway (Full Stack) | ||
|
|
||
| ### Deploy via Railway: | ||
|
|
||
| 1. Go to https://railway.app | ||
| 2. Click **"Start a New Project"** | ||
| 3. Select **"Deploy from GitHub repo"** | ||
| 4. Choose `SPerekrestova/github-knowledge-vault` | ||
| 5. Railway will auto-detect Docker Compose | ||
| 6. Add environment variables in dashboard | ||
| 7. Deploy! 🚀 | ||
|
|
||
| **Note:** Railway provides $5/month free credits (not unlimited) | ||
|
|
||
| --- | ||
|
|
||
| ## 📊 Free Tier Limitations | ||
|
|
||
| ### Render Free Tier: | ||
| - ✅ Unlimited deployments | ||
| - ✅ Automatic HTTPS | ||
| - ✅ Free PostgreSQL (90 days retention) | ||
| - ⚠️ Services spin down after 15 min inactivity | ||
| - ⚠️ Cold start: ~30 seconds to wake up | ||
| - ⚠️ 750 hours/month compute time | ||
|
|
||
| ### Vercel Free Tier: | ||
| - ✅ Unlimited deployments | ||
| - ✅ 100 GB bandwidth/month | ||
| - ✅ Automatic HTTPS & CDN | ||
| - ✅ No cold starts | ||
| - ⚠️ Serverless function timeout: 10s | ||
|
|
||
| ### Railway Free Tier: | ||
| - ⚠️ $5/month credits (runs out) | ||
| - ✅ No cold starts | ||
| - ✅ Better performance | ||
| - ✅ PostgreSQL included | ||
|
|
||
| --- | ||
|
|
||
| ## 🔍 Testing Your Deployment | ||
|
|
||
| ### 1. Test Backend Health: | ||
| ```bash | ||
| curl https://your-bridge.onrender.com/health | ||
| # Expected: {"status":"ok","cache_size":0,"mcp_connected":false} | ||
| ``` | ||
|
|
||
| ### 2. Test Repository Endpoint: | ||
| ```bash | ||
| curl https://your-bridge.onrender.com/api/repos | ||
| # Expected: [{"id":"...","name":"...","hasDocFolder":true}] | ||
| ``` | ||
|
|
||
| ### 3. Test Frontend: | ||
| - Open: `https://your-frontend.onrender.com` | ||
| - Check: DevTools → Console (should see MCP logs) | ||
| - Check: DevTools → Network (requests to bridge URL) | ||
|
|
||
| --- | ||
|
|
||
| ## 🚨 Troubleshooting | ||
|
|
||
| ### Backend takes 30s to respond: | ||
| **Cause:** Free tier service spun down | ||
| **Solution:** This is normal on Render free tier. First request wakes it up. | ||
|
|
||
| ### CORS errors: | ||
| **Cause:** Frontend URL not in CORS_ORIGINS | ||
| **Solution:** Update CORS_ORIGINS in backend to include your frontend URL: | ||
| ``` | ||
| CORS_ORIGINS=https://your-frontend.onrender.com,* | ||
| ``` | ||
|
|
||
| ### Build fails: | ||
| **Cause:** Missing environment variables | ||
| **Solution:** Double-check all environment variables are set in Render dashboard | ||
|
|
||
| ### MCP Server not connected: | ||
| **Cause:** MCP Server needs separate implementation | ||
| **Solution:** This is expected - endpoints will return 503 until MCP Server is running | ||
|
|
||
| --- | ||
|
|
||
| ## 💡 Recommended Setup | ||
|
|
||
| **For Testing (Free Forever):** | ||
| ``` | ||
| Frontend: Render Static Site (fast enough) | ||
| Backend: Render Web Service (free) | ||
| Trade-off: 30s cold start acceptable for testing | ||
| ``` | ||
|
|
||
| **For Better Performance:** | ||
| ``` | ||
| Frontend: Vercel (no cold starts, CDN) | ||
| Backend: Render Web Service (free) | ||
| Trade-off: Mixed platforms, but better UX | ||
| ``` | ||
|
|
||
| **For Production:** | ||
| ``` | ||
| Consider Railway ($5/month) or upgrade Render to paid tier | ||
| No cold starts, better reliability | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 🎉 Success! | ||
|
|
||
| Once deployed, your architecture looks like: | ||
|
|
||
| ``` | ||
| User Browser | ||
| ↓ | ||
| Vercel/Render Frontend (Static Site) | ||
| ↓ (HTTPS) | ||
| Render Backend (MCP Bridge) | ||
| ↓ | ||
| MCP Server (embedded) | ||
| ↓ | ||
| GitHub API | ||
| ``` | ||
|
|
||
| All hosted for **FREE** and accessible from anywhere! 🌍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Build stage | ||
| FROM node:18-alpine AS builder | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Install dependencies | ||
| COPY package*.json ./ | ||
| RUN npm ci | ||
|
|
||
| # Copy source | ||
| COPY . . | ||
|
|
||
| # Build arguments | ||
| ARG VITE_MCP_BRIDGE_URL | ||
| ARG VITE_GITHUB_ORGANIZATION | ||
|
|
||
SPerekrestova marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # Build | ||
| RUN npm run build | ||
|
|
||
| # Production stage | ||
| FROM nginx:alpine | ||
|
|
||
| # Copy built files | ||
| COPY --from=builder /app/dist /usr/share/nginx/html | ||
|
|
||
| # Copy nginx config (if you have custom config) | ||
| # COPY nginx.conf /etc/nginx/nginx.conf | ||
|
|
||
| EXPOSE 80 | ||
|
|
||
| CMD ["nginx", "-g", "daemon off;"] | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.