# Deployment Guide
## Quick Deploy to Render
**One-Click Deploy:**
[](https://render.com/deploy)
---
## Manual Render Deployment
### Step 1: Prepare Your Repository
```bash
# Ensure all files are committed
git add .
git commit -m "Ready for deployment"
git push origin main
```
### Step 2: Create Render Account
1. Go to [render.com](https://render.com)
2. Sign up with GitHub
3. Grant Render access to your repository
### Step 3: Create Web Service
1. Click **"New +"** → **"Web Service"**
2. Select your `ytmcp` repository
3. Configure:
| Field | Value |
|-------|-------|
| **Name** | `ytmcp` |
| **Environment** | `Python 3` |
| **Region** | Choose closest to your users |
| **Branch** | `main` |
| **Build Command** | `pip install -e .` |
| **Start Command** | `ytmcp --transport streamable-http --host 0.0.0.0 --port $PORT` |
4. **Environment Variables:**
- `PYTHON_VERSION` = `3.13`
- `FASTMCP_LOG_LEVEL` = `INFO`
5. Click **"Create Web Service"**
### Step 4: Verify Deployment
**Check Health:**
```bash
curl https://ytmcp-<your-id>.onrender.com/health
```
**Expected Response:**
```json
{
"status": "healthy",
"service": "ytmcp",
"version": "0.1.0",
"tools_count": 16
}
```
### Step 5: Connect MCP Client
**Update your MCP client configuration:**
```json
{
"mcpServers": {
"ytmcp-prod": {
"url": "https://ytmcp-<your-id>.onrender.com/mcp",
"description": "YouTube MCP Server (Production)"
}
}
}
```
---
## Custom Domain (Optional)
1. Go to Render Dashboard → Your Service → **Settings**
2. Click **"Add Custom Domain"**
3. Enter your domain: `ytmcp.yourdomain.com`
4. Add DNS record (Render will show instructions)
5. Render auto-provisions SSL certificate
**Update MCP config:**
```json
{
"url": "https://ytmcp.yourdomain.com/mcp"
}
```
---
## Environment Variables
Configure in **Dashboard → Service → Environment**:
| Variable | Description | Example |
|----------|-------------|---------|
| `FASTMCP_LOG_LEVEL` | Logging verbosity | `INFO`, `DEBUG`, `WARNING` |
| `FASTMCP_DEBUG` | Enable debug mode | `false` (production) |
---
## Monitoring
### View Logs
```bash
# Install Render CLI
npm install -g render-cli
render login
# Stream logs
render logs ytmcp --tail
```
### Health Checks
Render automatically monitors `/health` endpoint.
**Manual check:**
```bash
watch -n 5 curl https://ytmcp-<your-id>.onrender.com/health
```
---
## Scaling
**Free Tier:**
- 750 hours/month
- Auto-sleep after 15min inactivity
- Wakes on first request (~30s cold start)
**Upgrade to Paid:**
- Always-on instances
- Faster startup
- More memory/CPU
---
## CI/CD (Auto-Deploy)
**Already Configured!**
Every push to `main` branch triggers:
1. Render pulls latest code
2. Runs build command
3. Restarts service
4. Health check verification
**Disable auto-deploy:**
Dashboard → Service → Settings → **Auto-Deploy** → OFF
---
## Troubleshooting
### Build Fails
**Check `runtime.txt`:**
```
python-3.13
```
**Force rebuild:**
```bash
render services:restart ytmcp
```
### Service Crashes
**View logs:**
```bash
render logs ytmcp --num 100
```
**Common issues:**
- Missing dependencies → Check `pyproject.toml`
- Port binding → Ensure `--port $PORT`
- Health check failing → Verify `/health` endpoint
### Slow Cold Starts
**Upgrade to paid plan** or use **cron-job.org** to ping every 10 minutes:
```bash
curl https://ytmcp-<your-id>.onrender.com/health
```
---
## Cost Estimation
| Plan | Cost | Features |
|------|------|----------|
| **Free** | $0/month | 750 hours, auto-sleep, 512MB RAM |
| **Starter** | $7/month | Always-on, 512MB RAM |
| **Standard** | $25/month | 2GB RAM, priority support |
**Recommended:** Start with **Free**, upgrade if needed.
---
## Backup & Disaster Recovery
### Backup Strategy
**Code:**
- GitHub is source of truth
- Render auto-syncs on push
**Data:**
- Server is stateless (no DB)
- No backup needed
### Disaster Recovery
1. Redeploy from GitHub
2. Create new Render service
3. Update MCP client URLs
**Recovery Time:** ~5 minutes
---
## Security Best Practices
1. **HTTPS Only** - Render provides free SSL
2. **Environment Variables** - Never commit secrets
3. **Rate Limiting** - Built-in (0.75s delay)
4. **Health Monitoring** - Set up alerts (Render dashboard)
---
## Next Steps
- [ ] Deploy to Render
- [ ] Test `/health` endpoint
- [ ] Connect MCP client
- [ ] Monitor logs for 24 hours
- [ ] Set up custom domain (optional)
- [ ] Configure monitoring alerts
---
**Need Help?**
- [Render Docs](https://render.com/docs)
- [YtMCP Issues](https://github.com/yourusername/ytmcp/issues)
- [MCP Spec](https://modelcontextprotocol.io/)