This commit adds a complete deployment solution for running Claude OS's MCP (Model Context Protocol) server as a standalone service, separate from the full coding environment. This allows other applications to access the knowledge bases without requiring the CLI or coding tools. Features: - Docker-based deployment with Ollama integration - Automated setup script with model pulling - Read-only database mounting by default - CORS and authentication configuration - Complete API documentation and examples - Python and JavaScript client examples Also includes alternative Cloudflare Workers implementation: - TypeScript starter template - D1 and Vectorize integration examples - Migration scripts and documentation - Deployment comparison guide Files added: - deployment/mcp-only/Dockerfile - deployment/mcp-only/docker-compose.yml - deployment/mcp-only/requirements.txt - deployment/mcp-only/setup.sh - deployment/mcp-only/.env.example - deployment/mcp-only/.dockerignore - deployment/mcp-only/README.md - deployment/mcp-only/DEPLOYMENT_COMPARISON.md - deployment/mcp-only/examples/chat-integration.py - deployment/mcp-only/examples/chat-integration.js - deployment/mcp-only/cloudflare-workers/* This addresses the need to expose MCP data to other applications (knowledge base access, live chat) without deploying the full Claude OS environment to production servers.
11 KiB
Deployment Options: Your Server vs Cloudflare Workers
You have two main options for deploying your MCP server. Here's a detailed comparison to help you choose.
Option 1: Docker on Your Server (This Repo)
What It Is
- Run the MCP server as a Docker container on your own server
- Sits alongside your other applications
- Uses your existing SQLite database directly
Pros ✅
-
Dead Simple Setup
- Your database is already there
- Just mount it as a volume
- No data migration needed
-
Zero Code Changes
- Use the exact Python code from Claude OS
- No rewriting required
- Full feature parity
-
Fast Local Access
- Your other apps can access via
http://mcp-server:8051 - No network latency
- Can use Docker networks
- Your other apps can access via
-
Full Control
- Choose your own models (Ollama)
- Adjust configuration freely
- Access to all RAG features (hybrid, rerank, agentic)
-
Cost
- Free (you're already paying for the server)
- No additional services needed
-
Debugging
- Direct access to logs
- Can inspect database
- Easy to troubleshoot
Cons ❌
-
Server Requirements
- Needs ~500MB disk space
- ~200-500MB RAM
- Must manage Docker containers
-
Scaling
- Limited to your server's resources
- Need load balancer for multiple instances
-
Availability
- Single point of failure
- Need to manage uptime yourself
When to Choose This
✅ Use Docker on your server if:
- Your apps are already on that server
- You want the simplest setup
- You have a single server or small deployment
- You want to use your existing database directly
- You need all RAG features (hybrid search, reranking)
- You don't need global distribution
Example Architecture
┌──────────────────────────────────┐
│ Your Server │
│ │
│ ┌──────────┐ ┌──────────┐ │
│ │ Chat App │───▶│MCP Server│ │
│ └──────────┘ └─────┬────┘ │
│ │ │
│ ┌──────────┐ │ │
│ │ Docs App │─────────┤ │
│ └──────────┘ │ │
│ ▼ │
│ ┌──────────┐ │
│ │SQLite DB │ │
│ └──────────┘ │
│ │
└──────────────────────────────────┘
Option 2: Cloudflare Workers (Like cloudflare_mcp)
What It Is
- Serverless functions running on Cloudflare's edge network
- JavaScript/TypeScript only
- Uses Cloudflare D1 (SQLite) and Vectorize (vectors)
How It Works
-
Export your SQLite data to Cloudflare D1
# Export schema and data sqlite3 data/claude-os.db .dump > dump.sql # Import to D1 wrangler d1 execute claude-os-db --file=dump.sql -
Rewrite MCP endpoints in JavaScript
- Translate Python → TypeScript
- Use Cloudflare APIs instead of SQLiteManager
- Use Cloudflare AI for embeddings
-
Deploy to Workers
wrangler deploy
Pros ✅
-
Global Distribution
- Runs in 300+ cities worldwide
- Ultra-low latency for users anywhere
- Automatic geo-routing
-
Auto-Scaling
- Handles 0 to millions of requests
- No capacity planning
- Pay per use
-
High Availability
- Built-in redundancy
- 100% uptime SLA (on paid plans)
- No maintenance windows
-
No Server Management
- Completely serverless
- Automatic updates
- No Docker, no VMs
-
Free Tier
- 100,000 requests/day free
- 10GB D1 storage free
- Good for most use cases
Cons ❌
-
Major Rewrite Required
- Must port Python → JavaScript/TypeScript
- Reimplement all RAG logic
- Could take days/weeks
-
Cloudflare Limitations
- D1: 500MB database limit (free tier)
- Workers: 10ms CPU time per request (free tier)
- Must use Cloudflare AI models (different from Ollama)
-
Data Migration
- Must export SQLite → D1
- Must export vectors → Vectorize
- Complex migration process
-
Limited RAG Features
- Cloudflare AI has fewer models
- Harder to implement advanced features
- No LlamaIndex integration
-
Debugging
- Harder to debug serverless
- Limited logging (on free tier)
- Can't inspect database easily
-
Vendor Lock-in
- Tied to Cloudflare ecosystem
- Migration away is difficult
When to Choose This
✅ Use Cloudflare Workers if:
- Your apps are distributed globally
- You need extreme scalability
- You want zero server management
- You're comfortable rewriting in JavaScript
- Your database is < 500MB (or you can split it)
- You don't need advanced RAG features
Example Architecture
Global Users
│
▼
┌───────────────────────┐
│ Cloudflare Edge │
│ (300+ locations) │
│ │
│ ┌─────────────────┐ │
│ │ MCP Worker │ │
│ │ (TypeScript) │ │
│ └────┬────────────┘ │
│ │ │
│ ├──▶ D1 (SQLite)│
│ └──▶ Vectorize │
│ │
└───────────────────────┘
▲
│
Your Chat/Docs Apps
Side-by-Side Comparison
| Feature | Your Server (Docker) | Cloudflare Workers |
|---|---|---|
| Setup Time | 5 minutes | Days (rewrite code) |
| Code Changes | None | Full rewrite |
| Data Migration | None | Complex |
| Server Management | Yes | No |
| Scaling | Manual | Automatic |
| Global Latency | Higher | Ultra-low |
| Cost (small) | $0 (existing server) | $0 (free tier) |
| Cost (large) | Fixed | Pay-per-use |
| Database Size | Unlimited | 500MB (free tier) |
| RAG Features | Full | Limited |
| Model Choice | Any (Ollama) | Cloudflare AI only |
| Debugging | Easy | Harder |
| Vendor Lock-in | None | Cloudflare |
Recommended Approach
For Your Use Case
Based on what you described:
- ✅ You have MCPs populated with data locally
- ✅ You have other apps that need this data
- ✅ One needs it as a knowledge base
- ✅ Another needs it for live chat
I recommend: Start with Docker on your server (Option 1)
Why?
- Fastest to deploy - 5 minutes vs days
- No code changes - Use existing Python code
- No data migration - Mount your existing DB
- Full features - All RAG capabilities work
- Same server - Your apps can access locally
Migration Path (If Needed Later)
Phase 1: Docker on your server (NOW)
↓
Get your apps working
Test performance
Measure traffic
↓
Phase 2: Evaluate needs (LATER)
↓
If scaling is needed → Consider Cloudflare
If working well → Stay with Docker
Quick Start: Docker on Your Server
# 1. Navigate to deployment directory
cd deployment/mcp-only/
# 2. Run setup script
./setup.sh
# 3. Done! MCP server is running at http://localhost:8051
# 4. Update your apps to use:
# http://mcp-server:8051 (if on same Docker network)
# http://localhost:8051 (if on same server)
Hybrid Approach (Best of Both Worlds)
You can also do both:
┌────────────────────────────────┐
│ Your Server (Primary) │
│ ┌────────┐ ┌────────────┐ │
│ │Chat App│───▶│MCP (Docker)│ │
│ └────────┘ └────────────┘ │
│ ┌────────┐ ▲ │
│ │Docs App│──────────┘ │
│ └────────┘ │
└────────────────────────────────┘
│
│ (Optional: Sync to Cloudflare)
▼
┌────────────────────────────────┐
│ Cloudflare (Secondary) │
│ ┌──────────────────────────┐ │
│ │ Read-only MCP (Workers) │ │
│ │ For public docs search │ │
│ └──────────────────────────┘ │
└────────────────────────────────┘
Use Docker for:
- Internal apps (chat, docs)
- Write operations
- Full RAG features
Use Cloudflare for:
- Public-facing documentation search
- Global users
- Read-only queries
Example: Cloudflare Workers Code (If You Choose That Path)
See the cloudflare-workers/ directory for a basic example of how to implement the MCP endpoints on Cloudflare Workers.
Note: This is a simplified example. A full implementation would require:
- Complete D1 database migration
- Vector embeddings in Vectorize
- All 12 MCP tools reimplemented
- Proper error handling and auth
- Testing and deployment
Decision Flowchart
Do you need global distribution?
├─ No → Use Docker on your server ✅
│
└─ Yes
│
Are your apps < 100k requests/day?
├─ Yes
│ │
│ Is your database < 500MB?
│ ├─ Yes → Consider Cloudflare Workers
│ └─ No → Use Docker on your server ✅
│
└─ No → Use Docker + CDN or multiple regions
My Recommendation
Start with Docker on your server. It's:
- ✅ 10x faster to set up
- ✅ No code changes
- ✅ Uses your existing data
- ✅ Full feature set
- ✅ Easy to debug
Then, if you need global scaling, consider:
- Adding a CDN in front of your Docker deployment
- Deploying Docker containers in multiple regions
- Only then consider Cloudflare Workers (requires significant effort)
Most applications don't need Cloudflare-level scaling. Your Docker deployment will likely handle thousands of requests per second, which is probably more than enough.
Questions?
See:
README.md- Full Docker setup guideexamples/- Integration examplescloudflare-workers/- Cloudflare Workers starter (if you choose that path)