Convert OpenAPI v3 specifications into MCP servers using HAPI CLI. Supports local, Docker, and Cloudflare Workers deployment. Zero code required...
Convert OpenAPI v3 specifications into fully functional MCP (Model Context Protocol) servers using HAPI CLI โ no code required.
Verify HAPI CLI installation
hapi --version
If not installed, install using:
curl -fsSL https://get.mcp.com.ai/hapi.sh | bashirm https://get.mcp.com.ai/hapi.ps1 | iexhapimcp/hapi-cli:latest image directlyValidate OpenAPI spec is v3.x (not v2/Swagger). HAPI requires OpenAPI 3.0+ specifications.
Start local MCP server
hapi serve <project-name> \
--openapi <path-or-url-to-openapi-spec> \
--url <backend-api-url> \
--headless \
--port 3030
Verify server health
curl -s http://localhost:3030/health
# Expected: 200 OK
curl -s http://localhost:3030/mcp/ping
# Expected: pong
Test MCP endpoint โ The MCP transport is available at /mcp using Streamable HTTP:
POST /mcp โ JSON-RPC messagesGET /mcp โ Server info (returns 204)Choose deployment target based on requirements:
Authenticate (first time only):
hapi login
Deploy:
hapi deploy \
--openapi <path-or-url-to-openapi-spec> \
--url <backend-api-url> \
--name <worker-name> \
--project <project-name>
Verify deployment:
curl -s https://<worker-name>.<account>.workers.dev/health
docker run --name hapi-<project> -d --rm \
-p 3030:3030 \
hapimcp/hapi-cli:latest serve <project-name> \
--openapi <openapi-url> \
--url <backend-api-url> \
--port 3030 \
--headless
Before considering deployment complete:
/health returns 200 OK/mcp/ping returns pongUse --headless flag when the MCP server proxies requests to an existing backend API. Without this flag, HAPI serves the OpenAPI spec documentation UI.
HAPI uses Streamable HTTP (not stdio). MCP clients connect via HTTP POST to /mcp endpoint. SSE is supported for streaming responses.
HAPI accepts specs from:
--openapi ./specs/api.yaml--openapi https://api.example.com/openapi.json~/.hapi/specs/<project>/For detailed documentation, consult:
hapi serve petstore \
--openapi https://petstore3.swagger.io/api/v3/openapi.json \
--url https://petstore3.swagger.io/api/v3 \
--headless --port 3030
hapi serve my-api \
--openapi https://my-api.example.com/openapi.json \
--url https://my-api.example.com \
--headless --port 3030
hapi deploy \
--openapi https://my-api.example.com/openapi.json \
--url https://my-api.example.com \
--name my-api-mcp