fold

fold

Enterprise MCP gateway that unifies multiple MCP servers behind one governed endpoint, providing federation, authentication, policy enforcement, caching, rate limiting, and audit.

Category
Visit Server

README

fold

fold is the one. fold.run is the execution.

The high-performance enterprise MCP gateway: one governed endpoint between every MCP client and every MCP server. fold sits in front of any number of upstream MCP servers — in any language, on any SDK, from any team or vendor — providing federation, enterprise auth, policy, caching, rate limiting, and audit, while staying automatically aligned with the MCP specification, SEPs, and official SDK releases.

Use cases

  • Unify a federation. Acquisitions, child orgs, and teams each ship their own MCP servers; fold presents them as one virtual server with namespaced tools — no team rewrites anything.
  • Draw the security boundary. One choke point for authentication, deny-by-default tool allowlists, per-principal visibility, and an audit event for every request including denials.
  • Insulate protocol eras. fold speaks 2026-07-28 natively and translates in both directions — teams migrate off legacy SDKs on their own schedule while clients never notice.
  • Broker credentials. Clients hold one token with fold as audience; fold exchanges it per upstream (RFC 8693) or injects service credentials — API keys never reach agents.
  • Protect fragile services. SEP-2549 caching, global and per-upstream rate limits, and circuit breakers stand between agent traffic storms and your internal systems.
  • Govern vendor MCP servers. Put third-party/SaaS MCP endpoints behind your own auth, policy, and audit instead of scattering per-user API keys.
  • Expose tools outward, carefully. Offer partners or customers a curated, policy-scoped subset of internal tools on one hardened endpoint — self-hosted or at the edge on Cloudflare Workers.

Highlights

  • Native 2026-07-28 stateless core. Routes on the Mcp-Method/Mcp-Name headers (SEP-2243) without parsing request bodies; responses stream through untouched.
  • Legacy compatible. Stateful 2025-era clients and upstream servers work through the gateway during the deprecation window.
  • Portable. One TypeScript core built on web-standard APIs, deployable on Node.js (Docker/k8s) and Cloudflare Workers.
  • Conformant, provably. The official @modelcontextprotocol/conformance suite runs against fold fronting a reference server — 40/40 scenarios on Node.js AND on Cloudflare Workers (workerd), with ~1.8 ms p50 added latency on Node.
  • Enterprise-governed. OAuth 2.0 resource server (RFC 9207/8707/9728), Enterprise-Managed Authorization (ID-JAG exchange), per-upstream token exchange (RFC 8693), deny-by-default tool allowlists with per-principal list filtering, and an audit event for every request including denials.

Try it now

A live demo gateway runs at https://demo.fold.run/mcp — Cloudflare's modern 2026-07-28 docs server, GitMCP (a stateful 2025-era server), and a task-minting demo server, unified behind one endpoint. Point any MCP client at it:

https://demo.fold.run/mcp

You'll see cfdocs__*, git__*, and jobs__* tools side by side; the legacy upstream is translated live through a held session in a Durable Object. Call jobs__start_job, poll it with tasks/get, or watch subscriptions/listen — long-running work flows across the federation with fold routing every poll to the owning server. Rate-limited, unauthenticated, no warranty.

Quick start

cat > fold.config.json <<'EOF'
{
  "upstreams": [
    { "id": "github", "url": "https://mcp.example.com/mcp", "namespace": "github" }
  ]
}
EOF

npx @fold-run/gateway --config fold.config.json --port 8080
# MCP endpoint: http://localhost:8080/mcp

Embedding in your own Node service is one call: createFoldGateway(config) from the same package.

Edge deployment (same core, Durable Object-backed sessions and rate limits):

cd apps/gateway-workers
# set FOLD_CONFIG in wrangler.jsonc vars (or a secret), then:
npx wrangler deploy

A single upstream without a namespace runs in zero-copy passthrough mode. Multiple upstreams require namespaces; tools are exposed as {namespace}__{name}.

A federated multi-org config — each upstream owned by a different team, in any language:

{
  "upstreams": [
    {
      "id": "github-tools",
      "url": "https://mcp.platform.acme.com/mcp",
      "namespace": "gh",
      "owner": { "org": "acme-platform", "team": "devex" }
    },
    {
      "id": "ml-search",
      "url": "https://mcp.ml.acquired-co.com/mcp",
      "namespace": "search",
      "owner": { "org": "acquired-co", "team": "ml" },
      "rateLimit": { "requestsPerMinute": 600 },
      "circuitBreaker": { "failureThreshold": 5, "halfOpenAfterMs": 30000 }
    }
  ],
  "server": { "rateLimit": { "requestsPerMinute": 6000 } }
}

fold fans list requests out across all upstreams, merges and namespaces the results (honoring SEP-2549 ttlMs/cacheScope caching), synthesizes server/discover for the virtual server, degrades gracefully when an upstream is down (_meta["run.fold/partialFailure"]), and short-circuits unhealthy upstreams with a per-upstream circuit breaker. Set REDIS_URL to share cache, rate-limit, and breaker state across instances.

Repository layout

Path Purpose
packages/contracts Shared types: runtime ports, request context, middleware, hooks
packages/core Gateway engine: pipeline, routing, proxying, stores
packages/protocol Wire helpers: header routing, namespacing, version detection
packages/config Zod config schema
packages/auth OAuth resource server, EMA token endpoint, upstream credentials
packages/policy Allowlist policy engine + per-principal list filtering
packages/audit Audit events + sinks
packages/bridge Held SDK sessions to pre-2026 legacy upstreams
packages/runtime-node Node.js adapter (in-memory or Redis stores)
packages/runtime-workers Cloudflare Workers adapter (KV + Durable Objects)
apps/gateway-workers Edge artifact (wrangler deploy)
packages/testkit SDK-built fixture upstreams + integration harness
packages/gateway The published artifact: fold CLI + createFoldGateway (bundled)
spec-alignment.json Source of truth for spec/SEP/SDK alignment status

Portable packages may only use web-standard APIs (enforced by pnpm lint). Only runtime-* packages touch node:* / cloudflare:*.

Development

pnpm check          # boundaries + typecheck + tests
pnpm test           # unit + integration (real SDK client/server fixtures)

Conformance gate (requires the conformance repo's everything-server as upstream):

npx @modelcontextprotocol/conformance server --url http://localhost:8080/mcp

Documentation

Live docs: docs.fold.run — searchable, with /llms.txt for AI agents. Source lives in apps/docs; in-repo copies below.

License

Apache-2.0 © fold.run

Status

All planned milestones are shipped: federation + caching/rate limiting, enterprise auth (EMA, token exchange, policy) with audit and OpenTelemetry, bidirectional legacy↔stateless translation (including the durable MRTR parking bridge), federated tasks with the subscriptions/listen fan-in, the Cloudflare Workers runtime, and the automated spec/SEP/SDK alignment pipeline. Per-SEP coverage lives in spec-alignment.json / SPEC_ALIGNMENT.md — every row is implemented or not-applicable.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured