MCP Startup Framework MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add -e "DATABASE_URL=${DATABASE_URL}" -e "JWT_SECRET=${JWT_SECRET}" -e "COOKIE_ENCRYPTION_KEY=${COOKIE_ENCRYPTION_KEY}" -e "STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY}" -e "STRIPE_PRICE_ID_FOR_PREMIUM_MATH=${STRIPE_PRICE_ID_FOR_PREMIUM_MATH}" -e "BASE_URL=${BASE_URL}" mcp-startup-framework -- npx -y mcp-remote https://your-domain.workers.dev/mcp
Required:DATABASE_URLJWT_SECRETCOOKIE_ENCRYPTION_KEYSTRIPE_SECRET_KEYSTRIPE_PRICE_ID_FOR_PREMIUM_MATHBASE_URL
README.md

A framework for building remote MCP servers on Cloudflare Workers

MCP Startup Framework

A complete framework for building remote Model Context Protocol (MCP) servers on Cloudflare Workers with OAuth authentication, PostgreSQL database, and Stripe-powered paid tools.

🚀 Features

  • 🔐 OAuth 2.1 Provider - Complete authentication with user registration/login
  • 🗄️ PostgreSQL Integration - Scalable production-ready database with connection pooling
  • 💳 Paid Tools Framework - Stripe-powered premium tools with subscription support
  • 🌐 Platform Agnostic - Optimized for Cloudflare Workers but deployable anywhere (Vercel, Railway, AWS, self-hosted)
  • 🛠️ MCP Tools Framework - Modular tool system with user context
  • 🔌 REST API Routes - Easy-to-use system for adding custom endpoints
  • 🎨 Custom Views - Extensible UI system for privacy policies, ToS, documentation pages
  • 📡 Streamable HTTP Transport - Works with mcp-remote for local Claude Desktop integration
  • 📱 Cross-Platform - Works on desktop, web, and mobile MCP clients

⚡ Quick Start

Prerequisites

  • Node.js 18+
  • Cloudflare account
  • PostgreSQL database (see database setup)
  • Stripe account (for paid tools)

Installation

# 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

Configuration

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"

Development

# 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

🛠️ Adding Tools & Routes

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.

Custom Views

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.

🚀 Deployment

# 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.

🔗 Integration Options

Using claude.ai (Pro Plan)

For claude.ai Pro users, you can integrate directly:

  1. Navigate to claude.ai settings
  2. Click "Add Integration"
  3. Enter your server URL: https://your-domain.workers.dev/sse
  4. Complete the OAuth flow

Using Claude Desktop

For local Claude Desktop app:

1. Install MCP Remote Client
npm install -g mcp-remote
2. Configure Claude Desktop

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"
      ]
    }
  }
}
3. Restart Claude Desktop

After saving, restart Claude Desktop. Your MCP tools will appear in the chat interface.

Transport Options

The framework supports multiple transport protocols:

  • Streamable HTTP (default) - /mcp endpoint
  • Server-Sent Events (SSE) - /sse endpoint

Both work seamlessly with mcp-remote for local development and production use.

🌐 Platform Flexibility

While optimized for Cloudflare Workers, this framework runs anywhere:

  • Vercel: Deploy with @vercel/node runtime
  • Railway: One-click deploy with built-in PostgreSQL
  • AWS Lambda: Use with RDS or Aurora Serverless
  • Google Cloud Run: Deploy with Cloud SQL
  • Self-hosted: Run with Docker on any VPS

Simply update your database connection and deployment configuration!

Production Database

The framework works with any PostgreSQL provider:

  • Neon - Serverless PostgreSQL with autoscaling
  • Supabase - PostgreSQL with

Tools (3)

addPerforms addition operations
greetingReturns a greeting message
premiumMathPerforms premium mathematical operations requiring a subscription

Environment Variables

DATABASE_URLrequiredPostgreSQL connection string
JWT_SECRETrequiredSecret key for JWT authentication
COOKIE_ENCRYPTION_KEYrequired32-character key for cookie encryption
STRIPE_SECRET_KEYrequiredStripe API secret key
STRIPE_PRICE_ID_FOR_PREMIUM_MATHrequiredStripe price ID for premium tool access
BASE_URLrequiredThe public URL of the deployed worker

Configuration

claude_desktop_config.json
{"mcpServers": {"my-startup": {"command": "npx", "args": ["-y", "mcp-remote", "https://your-domain.workers.dev/mcp"]}}}

Try it

Perform a calculation using the premium math tool.
Get a greeting from the MCP server.
Check the status of the API endpoint.

Frequently Asked Questions

What are the key features of MCP Startup Framework?

OAuth 2.1 provider for user registration and authentication. PostgreSQL integration with connection pooling. Stripe-powered paid tools framework. Platform agnostic deployment (Cloudflare Workers, Vercel, AWS). Support for custom REST API routes and custom UI views.

What can I use MCP Startup Framework for?

Building monetized MCP tools that require user subscriptions. Creating secure, authenticated MCP servers for enterprise use. Deploying scalable MCP tools on serverless infrastructure. Adding custom web pages like privacy policies or documentation to an MCP server.

How do I install MCP Startup Framework?

Install MCP Startup Framework by running: npm install -g mcp-remote

What MCP clients work with MCP Startup Framework?

MCP Startup Framework works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep MCP Startup Framework docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare