Automatically wrap any REST/HTTP service described by an OpenAPI 3.0 / 3.1 spec and expose it as a fully‑featured Hyperia MCP server—no hand‑rolled glue code required.
Added in v2.0 (major revamp v2.2) – point Hyperia at your .json, hand it an httpx.AsyncClient, and receive tools/resources/prompts ready for LLMs.
1 Quick Start
import httpx, asynciofrom hyperia import Hyperiaspec ="https://api.example.com/openapi.json"# or dict loaded from filespec = httpx.get(spec).json()api = httpx.AsyncClient(base_url="https://api.example.com")mcp = Hyperia.from_openapi(openapi_spec= spec,client= api,name="ExampleAPI",# optional, appears in rootstimeout=8.0,# secs per request)if__name__=="__main__": mcp.run(transport="streamable-http",port=9000)
Hyperia parses the spec, builds Tools for mutating endpoints, Resources/Templates for GET routes, and wires a response mapper that converts JSON → TextContent automatically.
2 Mapping Rules
HTTP Method
Path Params
Component
Example
GET
none
Resource
GET /stats → resource://stats
GET
present
ResourceTemplate
GET /users/{id} → users://{id}
any other (POST, PUT, PATCH, DELETE, …)
n/a
Tool
POST /login → login
This is implemented via a priority‑ordered RouteMap list.
all_routes_as_tools=True is a convenience flag that sets one catch‑all map; use when building agent backends that only need actions.
3 Request Construction
Hyperia uses the path templating, parameter schema, and requestBody definitions from the spec to build the outbound HTTP request.
3.1 Query Params Filtering
None or empty strings are omitted to avoid ?max=&sort= noise.
Boolean false is still sent (flag=false).
3.2 Path Params Validation
Required placeholders must be non‑null; else ValueError.
3.3 Request Bodies
JSON – dict/list sent via json=
multipart/form‑data – files or nested models (OpenAPI encoding) supported
application/x‑www‑form‑urlencoded – auto encoded
If the spec marks a request body as optional you may omit it.
4 Response Mapping
Response Content-Type
Mapped MCP Content
application/json
TextContent with JSON string
text/*
TextContent
image/*
ImageContent
other / binary
BlobResourceContents
Hyperia strips unknown fields and honours schema.examples when generating the description shown to LLMs.
5 Advanced Options
5.1 Global Timeout
Applies to every outbound HTTP call; per‑tool override coming in v2.5.
5.2 Auth Injection
Because you provide the httpx.AsyncClient, you control headers, OAuth middleware, mTLS, or cookies there. Example Bearer token refresher:
5.3 Server Prefix
Pass route_prefix="/v2" if your OpenAPI paths are rooted differently than the runtime base URL.
6 Validation & Error Propagation
HTTP 4xx/5xx are translated into MCP errors so the client can handle gracefully. Response body (up to 2 KB) is forwarded in ToolError unless redact_errors=True.