A production-ready framework for building remote MCP servers that handle authentication, payments, and database operations. You get OAuth 2.1 user registration, PostgreSQL integration with connection pooling, and Stripe-powered premium tools out of the box. Deploys to Cloudflare Workers by default but works on Vercel, Railway, or AWS Lambda. Includes modular tool registration, REST API routes, and custom UI views for terms/privacy pages. Connects to Claude Desktop via mcp-remote or directly to claude.ai Pro through SSE endpoints. Reach for this when you need to build commercial MCP services with user accounts and paid features rather than simple local tools.
A complete framework for building remote Model Context Protocol (MCP) servers on Cloudflare Workers with OAuth authentication, PostgreSQL database, and Stripe-powered paid tools.
mcp-remote for local Claude Desktop integration# Clone the repository
git clone https://github.com/f/mcp-startup-framework
cd mcp-startup-framework
# Install dependencies
npm install
# Copy environment template
cp .dev.vars.example .dev.vars
Edit .dev.vars with your settings:
DATABASE_URL="postgresql://username:password@host:port/database"
JWT_SECRET="your-super-secret-jwt-key"
COOKIE_ENCRYPTION_KEY="32-character-encryption-key"
STRIPE_SECRET_KEY="sk_test_your_stripe_key"
STRIPE_PRICE_ID_FOR_PREMIUM_MATH="price_your_stripe_price_id"
BASE_URL="https://your-domain.workers.dev"
# Start development server
npm run dev
# Initialize database (in another terminal)
curl -X POST http://localhost:8787/init-db
# Visit http://localhost:8787 to register/login
Everything starts from src/index.ts:
// Register MCP tools
backend
.registerTool(registerAddTool)
.registerTool(registerGreetingTool)
.registerTool(registerPremiumMathTool);
// Add REST API routes
backend
.route('GET', '/api/status', (c) => c.json({ status: 'ok' }))
.authRoute('GET', '/api/profile', (c, userContext) =>
c.json({ user: userContext })
);
See Tools Guide and Routes Guide for details.
Extend beyond MCP with custom pages:
// Add privacy policy, terms of service, documentation
backend
.route('GET', '/privacy', (c) => c.html(generatePrivacyPage()))
.route('GET', '/terms', (c) => c.html(generateTermsPage()))
.route('GET', '/docs', (c) => c.html(generateDocsPage()));
See Views Guide for creating custom pages.
# Set production secrets
wrangler secret put JWT_SECRET
wrangler secret put COOKIE_ENCRYPTION_KEY
wrangler secret put STRIPE_SECRET_KEY
# Set custom price IDs per paid tool
wrangler secret put STRIPE_PRICE_ID_FOR_PREMIUM_MATH
# Deploy to Cloudflare
npm run deploy
See Deployment Guide for full instructions.
For claude.ai Pro users, you can integrate directly:
https://your-domain.workers.dev/sseFor local Claude Desktop app:
npm install -g mcp-remote
Open Claude Desktop settings: Settings > Developer > Edit Config
Add to your claude_desktop_config.json:
{
"mcpServers": {
"my-startup": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://your-domain.workers.dev/mcp"
]
}
}
}
After saving, restart Claude Desktop. Your MCP tools will appear in the chat interface.
The framework supports multiple transport protocols:
/mcp endpoint/sse endpointBoth work seamlessly with mcp-remote for local development and production use.
While optimized for Cloudflare Workers, this framework runs anywhere:
@vercel/node runtimeSimply update your database connection and deployment configuration!
The framework works with any PostgreSQL provider:
All providers support the scalability needed for production MCP servers.
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE file for details.
hovecapital/read-only-local-postgres-mcp-server
cocaxcode/database-mcp
io.github.infoinlet-marketplace/mcp-mysql
io.github.cybeleri/database-admin
io.github.yash-0620/postgres-mcp-secured