Skip to content

OpenAPI to MCP Generator

Convert an OpenAPI 3.x JSON spec into MCP tool definitions, one per endpoint, and export config JSON or a TypeScript or Python server.

OpenAPI to MCP Generator

Endpoints (5/5)

{
  "name": "Pet Store",
  "version": "1.0.0",
  "description": "A sample pet store API",
  "tools": [
    {
      "name": "listpets",
      "description": "List all pets — Returns a list of all pets in the store",
      "inputSchema": {
        "type": "object",
        "properties": {
          "limit": {
            "type": "integer",
            "default": 20,
            "description": "Maximum number of pets to return"
          },
          "status": {
            "type": "string",
            "enum": [
              "available",
              "pending",
              "sold"
            ],
            "description": "Filter by status"
          }
        }
      }
    },
    {
      "name": "createpet",
      "description": "Create a pet — Add a new pet to the store",
      "inputSchema": {
        "type": "object",
        "properties": {
          "body": {
            "type": "object",
            "description": "Request body",
            "properties": {
              "name": {
                "type": "string",
                "description": "The pet's name"
              },
              "species": {
                "type": "string",
                "enum": [
                  "dog",
                  "cat",
                  "bird",
                  "fish"
                ]
              },
              "age": {
                "type": "integer",
                "description": "Age in years",
                "minimum": 0
              },
              "tags": {
                "type": "array",
                "description": "Optional tags",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "name",
              "species"
            ]
          }
        },
        "required": [
          "body"
        ]
      }
    },
    {
      "name": "getpet",
      "description": "Get a pet by ID",
      "inputSchema": {
        "type": "object",
        "properties": {
          "petId": {
            "type": "string",
            "description": "The pet ID"
          }
        },
        "required": [
          "petId"
        ]
      }
    },
    {
      "name": "updatepet",
      "description": "Update a pet",
      "inputSchema": {
        "type": "object",
        "properties": {
          "petId": {
            "type": "string",
            "description": "The pet ID"
          },
          "body": {
            "type": "object",
            "description": "Request body",
            "properties": {
              "name": {
                "type": "string"
              },
              "species": {
                "type": "string",
                "enum": [
                  "dog",
                  "cat",
                  "bird",
                  "fish"
                ]
              },
              "age": {
                "type": "integer",
                "minimum": 0
              },
              "status": {
                "type": "string",
                "enum": [
                  "available",
                  "pending",
                  "sold"
                ]
              }
            }
          }
        },
        "required": [
          "petId",
          "body"
        ]
      }
    },
    {
      "name": "deletepet",
      "description": "Delete a pet",
      "inputSchema": {
        "type": "object",
        "properties": {
          "petId": {
            "type": "string",
            "description": "The pet ID"
          }
        },
        "required": [
          "petId"
        ]
      }
    }
  ]
}

Updated . Provided as is. Check the output before you rely on it in production.

How to use OpenAPI to MCP Generator

  1. 1

    Paste your OpenAPI spec

    Enter your OpenAPI 3.x specification in JSON format. You can also click Load Sample to see a working example.

  2. 2

    Select endpoints

    Use the endpoint checklist to choose which API endpoints to convert into MCP tools. By default, all endpoints are selected.

  3. 3

    Choose output format

    Select your preferred output: MCP Config JSON for direct use, TypeScript Server for a full server scaffold, or Python Server for a Python-based implementation.

  4. 4

    Copy or download

    Review the generated MCP tool definitions in the output panel. Click Copy to clipboard or Download to save the file directly.

Questions and answers

What is OpenAPI to MCP Generator?
MCP (Model Context Protocol) lets an AI client call external tools, each with a name, description and JSON Schema input. This generator reads an OpenAPI JSON spec, turns each endpoint into such a tool from its parameters and request body, resolves $ref and allOf, and exports config JSON or a TS or Python server.
What output formats are available?
Three formats: MCP config JSON (for direct use), TypeScript MCP server scaffold (using the official SDK), and Python MCP server scaffold. All include tool definitions with proper input schemas.
Does it send my API spec to a server?
No. All conversion happens in your browser. Your API specification never leaves your device.
Does it handle $ref references in OpenAPI specs?
Yes. The tool resolves $ref references inline, handles allOf/oneOf schemas, and properly converts nested object structures into JSON Schema format compatible with MCP tool definitions.
For AI agents: how to call this tool

Machine-readable contract, endpoints and examples. Humans can ignore this section.

Best Path For Builders

Browser workflow

Runs instantly in the browser with private local processing and copy/export-ready output.

Browser Workflow

This tool is optimized for instant in-browser execution with local data handling. Run it here and copy/export the output directly.

/openapi-to-mcp/

For automation planning, fetch the canonical contract at /api/tool/openapi-to-mcp.json.