home / mcp / mcp startup framework
Provides OAuth, PostgreSQL data storage, and Stripe-powered paid tools for MCP servers.
Configuration
View docs{
"mcpServers": {
"f-mcp-startup-framework": {
"url": "https://your-domain.workers.dev/sse",
"headers": {
"BASE_URL": "https://your-domain.workers.dev",
"JWT_SECRET": "supersecretJWT",
"DATABASE_URL": "postgresql://user:pass@host:5432/db",
"STRIPE_SECRET_KEY": "sk_test_XXXX",
"COOKIE_ENCRYPTION_KEY": "abcdefghijklmnopqrstuvwxyz123456",
"STRIPE_PRICE_ID_FOR_PREMIUM_MATH": "price_1Hxxxx"
}
}
}
}You are building an MCP server that provides OAuth authentication, a PostgreSQL-backed data store, and a framework for offering paid MCP tools via Stripe. This setup lets you create secure, scalable endpoints and deliver both free and premium capabilities to your MCP clients, with a clean path to deployment on Cloudflare Workers or other platforms.
You interact with this MCP server through MCP clients. After you start the development server, you can register tools that your clients will use, create REST API routes for status, profile data, or custom functionality, and expose privacy terms, terms of service, and documentation pages through custom views. For paid tools, subscribers can access premium functionality via Stripe-powered plans. You will also have a streamable HTTP transport endpoint you can connect to with local tooling.
Prerequisites you need before installation include Node.js 18 or newer, a Cloudflare account, a PostgreSQL database, and a Stripe account for paid tools.
# Clone the project
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.varsConfigure environment variables to connect to your database, enable JWT authentication, and set up Stripe payments. You will store sensitive values in your environment and reference them at runtime.
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 the development server, initialize the database, and access the UI to register users and manage tools.
# Start development server
npm run dev
# Initialize database (in another terminal)
curl -X POST http://localhost:8787/init-db
# Visit the local UI to register/login
http://localhost:8787From the main entry point, you register MCP tools and define REST API routes for your server. You can mix free and paid tools and secure routes with authentication.
// 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 })
);Extend MCP with custom pages for privacy policies, terms of service, and documentation. This helps you present compliance information and maintain transparent UI components.
backend
.route('GET', '/privacy', (c) => c.html(generatePrivacyPage()))
.route('GET', '/terms', (c) => c.html(generateTermsPage()))
.route('GET', '/docs', (c) => c.html(generateDocsPage()));Adds a basic MCP tool that performs a simple action and is available to all users.
Registers a tool that returns a greeting message or customizable responses.
Registers a paid tool that offers advanced mathematical calculations behind a Stripe subscription.