Get the FREE Ultimate OpenClaw Setup Guide →

API2AI

Generate production-ready MCP-use servers from any OpenAPI specification

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio vtempest-api2ai npx -y api2ai https://petstore3.swagger.io/api/v3/openapi.json ./petstore-mcp --name petstore-api

How to use

This MCP server is generated from an OpenAPI specification using the api2ai tool. It creates a complete MCP-use server with tools derived from the OpenAPI endpoints, including authentication options, inspector UI, and support for multiple transports (HTTP, SSE, and Streamable HTTP). After generation, you can explore the built-in inspector at /inspector to test tools, endpoints, and authentication flows. To run, generate the server with the OpenAPI document, install dependencies, and start the server; you’ll then be able to query MCP endpoints (such as POST /mcp) and access supporting tools through the generated UI and tool endpoints.

How to install

Prerequisites:

  • Node.js and npm installed on your machine
  • Internet access to fetch the generator via npx

Step-by-step:

  1. Ensure Node.js is installed. Verify: node -v npm -v

  2. Generate the MCP server from an OpenAPI spec (example uses the Petstore OpenAPI): npx -y api2ai https://petstore3.swagger.io/api/v3/openapi.json ./petstore-mcp --name petstore-api

  3. Navigate to the generated directory and install dependencies: cd petstore-mcp npm install

  4. Start the server: npm start

  5. Open in your browser: http://localhost:3000/inspector

Notes:

  • If you want to customize port or base URL, pass appropriate options to the generator or set environment variables as needed in the generated .env file.

Additional notes

Tips and common considerations:

  • The generated server includes an inspector UI at /inspector for interactive testing.
  • Environment variables can control port (PORT), API base URL (API_BASE_URL), and authentication credentials (API_KEY, API_AUTH_HEADER).
  • You can filter or exclude endpoints during generation using the programmatic API if you’re integrating tooling into your CI/CD.
  • Ensure CORS and API endpoint base URL settings are correct for your deployment environment (ALLOWED_ORIGINS, API_BASE_URL).
  • The server exposes /mcp for MCP protocol interactions and /sse for Server-Sent Events streams when needed.
  • For production deployments, consider using PM2, Kubernetes, or containerized deployments as indicated by the generator capabilities.

Related MCP Servers

Sponsor this space

Reach thousands of developers