Skip to content

Work90210/APIFold


APIFold

Turn any REST API into an MCP server. No code required.

CI License Transformer Node pnpm

APIFold reads an OpenAPI 3.x or Swagger 2.x specification and generates a live, production-ready MCP server endpoint. AI agents — Claude, Cursor, Copilot, or any MCP-compatible client — can connect immediately. Tool calls execute real HTTP requests to real upstream APIs with securely stored credentials. No stubs, no mocks, no glue code.

Table of Contents:

Installation

Before running the installation command, make sure you have Node.js 20+, pnpm 9+, and Docker installed on your machine:

git clone https://github.com/Work90210/APIFold.git
cd APIFold
pnpm install

Self-Hosting

APIFold is designed to run in a containerized environment. Running your own instance is as easy as running one command from your terminal:

Development

cp .env.example .env
docker compose -f infra/docker-compose.dev.yml up -d
pnpm dev

Open http://localhost:3000 to access the dashboard.

Production

cp .env.example .env
# Edit .env with your production values (database, Redis, vault secret)
docker compose -f infra/docker-compose.yml up -d

The production stack includes Nginx reverse proxy, Next.js web app, Express MCP runtime, Postgres 16, and Redis 7 — all behind a single command. For advanced configuration, check out the environment variables and self-hosting guide.

Getting Started

Using the Transformer Library

The core conversion logic is published as a standalone MIT-licensed npm package. You can use it in your own tools without any AGPL obligations:

npm install @apifold/transformer
import { transform } from "@apifold/transformer";

const tools = transform(myOpenAPISpec);
// Returns MCP-compatible tool definitions

Connecting an AI Agent

Once you've imported a spec and created an MCP server through the dashboard:

Claude Desktop — add to your claude_desktop_config.json:

{
  "mcpServers": {
    "my-api": {
      "url": "http://localhost:3001/mcp/my-api/sse"
    }
  }
}

Cursor — add the same endpoint URL in Cursor Settings > MCP Servers.

Available Commands

Command Description
pnpm dev Start all services with hot-reload
pnpm build Build all packages
pnpm test Run tests
pnpm lint Lint all packages
pnpm typecheck Type-check all packages
pnpm format Format all files with Prettier
pnpm db:migrate Run database migrations
pnpm db:seed Seed development data
pnpm db:studio Open Drizzle Studio

Architecture

graph LR
    Spec["OpenAPI / Swagger\nSpec"] --> Transformer

    subgraph MT["APIFold"]
        Transformer["Transformer\n(MIT lib)"]
        Transformer --> Runtime["Runtime\nExpress + SSE"]
        Web["Web App\nNext.js"] --> DB["Postgres 16\nRedis 7"]
        Runtime --> DB
    end

    Runtime --> Upstream["Upstream API\n(Stripe, GitHub, etc.)"]
    Agent["AI Agent\nClaude, Cursor,\nCopilot, etc."] -- "MCP / SSE" --> Runtime
Loading

APIFold uses a monorepo architecture built with Turborepo and pnpm workspaces:

Component Path Description
Transformer packages/transformer Core conversion library. Spec in, MCP tools out. Pure functions, no side effects. MIT licensed.
Runtime apps/runtime Express server hosting live MCP endpoints over SSE. Handles credential decryption and upstream proxying.
Web App apps/web Next.js 14 dashboard. Import specs, configure servers, manage credentials, test tools, inspect logs.
Types packages/types Shared TypeScript type definitions.
UI packages/ui Design system and component library.

You can learn more about the architecture in the Architecture Decision Records.

Contributing

All code contributions, including those of people having commit access, must go through a pull request and be approved before being merged. This is to ensure a proper review of all the code.

We truly ❤️ pull requests! If you wish to help, you can learn more about how you can contribute to this project in the contribution guide.

Security

For security issues, please refer to our security policy for responsible disclosure guidelines. Do not post security vulnerabilities as public GitHub issues.

License

This repository uses a dual-license model:

This is the same model used by Grafana, Plausible, and PostHog.

About

Turn any REST API into an MCP server. No code required.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors