How to get your API used by AI agents
Steps to turn your OpenAPI spec into MCP tools and make your API available to ChatGPT, Claude, and Cursor.
Goal
You want AI agents (ChatGPT, Claude, Cursor, or your own) to call your API. To do that, agents need your API exposed as MCP tools—operations they can discover and invoke. This guide shows how to get from an OpenAPI spec to a running MCP server so your API is available to those agents.
How to turn OpenAPI into MCP (overview)
- Have an OpenAPI spec for your API (JSON or YAML).
- Generate an MCP server that exposes your API as tools (e.g. with Api2Agent).
- Run the server locally or deploy it where your agent can reach it.
- Configure your agent (Cursor, Claude, etc.) to use that MCP server.
Step 1: Get your OpenAPI spec
If you already have a REST API, you may have an OpenAPI (Swagger) document. If not, many frameworks can generate one, or you can write it by hand. The spec should describe your paths, methods, parameters, and request/response schemas. Api2Agent accepts JSON or YAML—upload a file or paste the spec.
Step 2: Generate an MCP server from your spec
Use a generator to convert OpenAPI to MCP: each endpoint (or a subset you choose) becomes an MCP tool. Api2Agent produces a TypeScript MCP server scaffold—tool handlers, config, README, and .env.example. You download a ZIP and own the project; we don’t host it.
Generate your MCP server from OpenAPI on the Api2Agent homepage.
Step 3: Run or deploy the MCP server
After downloading the scaffold, install dependencies, set environment variables (e.g. API keys), and run the server locally. For Cursor or Claude Desktop, you point them at this server (e.g. stdio or SSE). For production, deploy the server wherever your agents can reach it (your own infra—no hosted dependency on us).
Step 4: Give your agent access to the MCP server
In Cursor, add the MCP server in settings. In Claude Desktop or other MCP clients, configure the server URL or command. Once connected, the agent discovers the tools and can call your API through them.
How to convert OpenAPI to MCP tools
Conversion is automatic when you use a generator: the tool maps OpenAPI operations to MCP tools (name, description, parameters from the spec). You can then tweak the generated code (e.g. rename tools, add auth). The result is an MCP server that wraps your API—no need to hand-write each tool.
How to make your API available to ChatGPT, Claude, or Cursor
Same idea: expose your API as an MCP server (or the tool format each platform uses). For Cursor and Claude, an MCP server from your OpenAPI spec is the standard path. For ChatGPT, the integration may differ by product (e.g. actions, plugins); the underlying need is still “tools that call my API,” which an MCP server provides. Start by generating the server from OpenAPI, then connect it to the agent you care about.
Try Api2Agent — paste your spec, download the scaffold, and run it locally.