Architecture

DeployContext is built on a modern, edge-first architecture that enables global deployment and sub-50ms API key validation. This page explains how the system works under the hood.

System Overview

DeployContext consists of three main layers:

  • Web Application - Next.js app on Vercel for user interface and deployment orchestration
  • Edge Layer - Cloudflare Workers for global API key validation and request routing
  • Runtime Layer - Fly.io for hosting MCP servers globally

Component Architecture

1. Web Application (Vercel)

The Next.js web application handles user interactions, deployment orchestration, and database management.

  • User authentication (NextAuth.js)
  • Creator dashboard (deploy, manage MCPs)
  • Subscriber dashboard (browse, subscribe)
  • Build service (orchestrates deployment pipeline)
  • PostgreSQL database (user data, MCPs, subscriptions)

2. Edge Layer (Cloudflare Workers)

The edge layer provides global API key validation and request routing with sub-50ms latency worldwide.

  • API key validation from Cloudflare KV
  • Rate limiting (60 requests/minute per key)
  • Request routing to MCP endpoints
  • SSE/HTTP proxying
  • Global distribution (200+ edge locations)

3. Runtime Layer (Fly.io)

MCP servers run on Fly.io, providing isolated containers with automatic scaling and global distribution.

  • Isolated containers per MCP
  • HTTP/SSE transport support
  • Automatic stdio bridging (for stdio MCPs)
  • Health checks and monitoring
  • Environment variable management

Data Flow

Deployment Flow

  1. Creator enters GitHub repository URL
  2. System validates repository and detects runtime/transport
  3. Build service clones repo and generates Dockerfile
  4. Container is built and deployed to Fly.io
  5. Health check validates MCP is running
  6. Endpoint is registered in Cloudflare KV for edge routing

Request Flow

  1. Client (Claude Desktop) sends request with API key
  2. Cloudflare Worker validates API key from KV (~10ms)
  3. Worker checks rate limit and looks up MCP endpoint
  4. Worker proxies request to Fly.io backend
  5. MCP server processes request and returns response
  6. Response streams back through worker to client

Transport Modes

DeployContext supports three transport modes for MCPs:

Native HTTP/SSE

MCPs that implement HTTP/SSE directly (recommended for new MCPs).

Example: FastAPI server with SSE endpoints

stdio Bridge

Automatic bridging for stdio-only MCPs. Completely invisible to end users.

Example: Official @modelcontextprotocol packages via npx

SSE Flag

MCPs that support --transport sse flag.

Example: Qdrant MCP, PostgreSQL MCP

Authentication & Security

API Key System

API keys follow the format: mcp_[24-byte-base64url]_[4-char-checksum]

  • Generated with cryptographically secure random bytes
  • Stored as bcrypt hash in database (backup)
  • Stored in plain text in Cloudflare KV (for fast edge validation)
  • Validated at edge in <50ms globally

Rate Limiting

  • 60 requests/minute per API key
  • Enforced at edge layer (before backend)
  • Distributed via Cloudflare KV
  • Automatic per-minute window reset

Environment Variables

  • Encrypted at rest in database
  • Securely transmitted to Fly.io as secrets
  • Only accessible to MCP process

Deployment Pipeline

The build service orchestrates the complete deployment process:

  1. Cloning - Clone GitHub repository to temporary directory
  2. Validation - Detect runtime, transport mode, validate MCP SDK
  3. Build Preparation - Generate Dockerfile, setup bridge (if needed), setup database
  4. Deployment - Create Fly.io app, set secrets, deploy container
  5. Health Check - Validate MCP responds correctly
  6. Registration - Register endpoint in Cloudflare KV for edge routing

Technology Stack

Frontend

  • Next.js 14 (App Router)
  • CSS Variables (minimalist design)
  • NextAuth.js

Backend

  • Node.js 20
  • PostgreSQL (Neon)
  • Drizzle ORM

Infrastructure

  • Vercel (Web hosting)
  • Fly.io (MCP runtime)
  • Cloudflare Workers (Edge)

Storage

  • Neon PostgreSQL
  • Cloudflare KV

Learn More

For detailed technical documentation, see the architecture document in our repository.