Back to blog
Tutorial • 6 min read

From OpenAPI to a Running MCP Server

Turn an existing REST API specification into a Model Context Protocol server your AI agents can call. Here is the full workflow, from upload to first tool call.

Most teams already describe their API in OpenAPI or Swagger. MCP Studio takes that same document and generates a server that exposes each operation as an MCP tool, so an AI client can discover and invoke it without bespoke glue code.

The whole loop is four steps: prepare the spec, generate the server, run the bundle, and connect a client.

1. Prepare the specification

Export your API definition as JSON or YAML. OpenAPI 3.0, 3.1, and Swagger 2.0 are supported. Before uploading, confirm that the document has a top-level paths object and that every operation has a unique operationId; those identifiers become stable tool names.

For a deeper review of naming, descriptions, schemas, and safety signals, read Best Practices for Designing OpenAPI Specs for AI Agents.

Tip: Remove internal or deprecated endpoints from the document first. Every remaining operation becomes a tool the model can see.

2. Upload and choose a runtime

Open the dashboard, upload the file, and select a target language. MCP Studio supports TypeScript, Python, Java, and PHP. Set the API base URL the generated server should call; secrets such as API keys are supplied later through environment variables rather than being written into the output.

The parser walks each path, method, parameter, request body, and response schema, then normalizes the result into the tool definitions used during generation.

3. Download and run the bundle

Generation produces a ready-to-run bundle: dependencies, an entry point, and a client configuration snippet. Install dependencies, set the environment variables named in the bundle README, and start the server.

terminal
# TypeScript
npm install
npm start

# Python
pip install -r requirements.txt
python server.py

# PHP
composer install
php server.php

The exact command is listed in the generated README. Java bundles are built with Maven and launched from the produced JAR.

4. Connect a client and call a tool

Add the generated server command to your MCP client. After a restart the client performs the protocol handshake and lists the tools derived from your operations. The protocol revision is 2026-07-28, so any compatible client can connect.

Start with a read-only operation to verify authentication and base URL wiring. Once that call succeeds, the remaining tools follow the same path.

Where to go next

Every uploaded spec is stored by UUID in the API Specs library, and every build is tracked in Generated Servers. That means you can regenerate with a different runtime or re-download a bundle without uploading the specification again.

If you have not connected a client yet, continue with Connecting Generated MCP Servers to Claude Desktop and Cursor.

Start with your own specification

Upload an OpenAPI file and generate a server bundle in seconds.

Upload Spec