Converting OpenAPI to MCP means turning the operations in your API description into Model Context Protocol tools that an AI agent can discover and call. A generator can map every endpoint to a tool in one pass. Getting tools that an agent uses correctly, and that are safe to put in front of business data, takes curation: clear names, business-language descriptions, a decision on reads versus writes, and permissions on every call.
Whether you convert OpenAPI to an MCP server yourself or use a product that does it for you, the work is the same. This guide walks through it step by step, with a before-and-after example. The same steps apply when you start from Swagger, a Postman collection or a SOAP/WSDL service.
Why a 1:1 endpoint-to-tool conversion is not enough
Swagger to MCP converters exist, and they are useful for a quick look. On a real business system, a straight conversion runs into four problems.
- Too many tools. ERP and CRM APIs often expose hundreds of operations. Put them all in front of a model and it picks the wrong one, or spends its context reading tool lists instead of answering.
- Unclear names. Operation IDs like
getApiV2ArDocsorpost_1tell a model nothing. Many specs have empty descriptions, or descriptions written for developers who already know the system. - Writes without control. POST, PUT and DELETE operations become callable functions. Without a review step, an agent can create orders or change prices as freely as it reads them.
- Technical parameters. Internal status codes, paging tokens and expand flags leak into the tool interface, and the model has to guess what
st=Omeans.
Step by step: from spec to reviewed tools
1. Get the spec
Collect the most accurate machine-readable description you have:
- OpenAPI 3.x in JSON or YAML, the current standard for HTTP APIs.
- Swagger 2.0, the earlier version of the same specification, published as OpenAPI 2.0 and formerly known as the Swagger RESTful API Documentation Specification.
- Postman collections, often the most up-to-date description an internal team maintains.
- WSDL for SOAP services, common in older ERP systems.
If the system has no API, read-only SQL views over its database can serve as the source. Whatever the format, check that it matches the version actually deployed.
2. Clean operation IDs and descriptions
The OpenAPI Specification defines operationId as a unique string that identifies an operation, and notes that tools may use it to identify operations. Make every one present, unique and meaningful. Use summary for a short statement of what the operation does and description for the details a model needs: what the data means, units, currency, limits.
3. Decide read versus write
Mark each operation explicitly. HTTP methods are a hint, not a rule: some POST endpoints are searches, and some GET endpoints trigger actions. Reads can be offered to the agent once permissions are in place. Writes should create a draft that a person approves, never run directly. See human-in-the-loop approval.
4. Group and name tools in business language
Keep the operations that answer real questions and drop the rest. Name tools after the business action, list_overdue_receivables instead of get_ar_docs, and group them by domain: receivables, payables, stock, orders. One tool that answers a common question is better than three that must be chained.
5. Shape parameters and pagination
Replace internal codes with documented enums, use ISO dates, and set sensible defaults. Fix parameters the agent should never change inside the tool. Decide how paging works: the tool fetches all pages up to a limit, or returns a cursor and states clearly when a result is truncated.
6. Keep authentication on the server
API keys, OAuth client secrets and service accounts stay on the server that executes the tool. They never appear in the tool schema, the model’s context or the MCP client’s configuration. People authenticate to the tool server; the tool server authenticates to the business system.
7. Review
Someone who knows the business system reads every tool before it goes live: name, description, parameters, read or write. This is where most wrong-tool errors are prevented.
8. Set permissions
Decide which roles may use each tool, which rows they see and which fields are masked. A policy engine should enforce this on every call, with default deny.
9. Test with real questions
Write twenty questions your team actually asks and run them. Check which tools were chosen, with which parameters, and whether the answer is right. When the agent picks the wrong tool, the fix is usually in the description.
Before and after: a raw endpoint and a tool definition
A raw operation, as it often appears in a Swagger file:
paths:
/api/v2/ar/docs:
get:
operationId: getApiV2ArDocs
parameters:
- name: st
in: query
schema: { type: string }
- name: dd_to
in: query
schema: { type: string }
- name: pg
in: query
schema: { type: integer }
responses:
'200':
description: OK
The same operation as a reviewed tool:
{
"name": "list_overdue_receivables",
"title": "List overdue receivables",
"description": "Unpaid customer invoices due before the given date. Use for questions about overdue balances or collections. Amounts are in the invoice currency; at most 500 rows.",
"inputSchema": {
"type": "object",
"properties": {
"due_before": { "type": "string", "format": "date", "description": "Due date cut-off, YYYY-MM-DD." },
"customer_id": { "type": "string", "description": "Optional. Limit to one customer." }
},
"required": ["due_before"],
"additionalProperties": false
},
"annotations": { "readOnlyHint": true }
}
The status filter st is fixed to open documents inside the tool, pg is handled by the server, and dd_to has become a clearly named date. The description tells the model when to use the tool and what the numbers mean. The read-only hint helps clients, but the real limit is the server’s own read/write marking and policy check.
Checklist for OpenAPI spec to MCP tools
- Every tool has a unique, readable name and a description written for the question it answers.
- Every tool is marked read or write; writes go through approval.
- No credentials in schemas or client configuration.
- Parameters use business terms, and truncated results say so.
- Permissions, row filters and field masks are enforced on the server.
- The tool set has been tested with real questions.
How ORQEN handles it
ORQEN imports OpenAPI, Swagger, Postman collections, SOAP/WSDL or SQL views and turns endpoints into tools with meaningful names and descriptions. Each tool is marked as read or write, and no tool can be used until your team has reviewed it. Credentials stay in your environment, roles and policies apply on every call, and writes wait as drafts for approval. The reviewed tools serve ORQEN’s own chat and can be opened to MCP clients over OAuth 2.1 with the same permissions; see MCP for business. For a system with its own in-house API, start with custom API integration; for what the result looks like in practice, see the finance and accounting use case. Short definitions of OpenAPI and Swagger are in the glossary.