AgentAPIGate
OpenAPI 3.1 Vendor Extensions · MCP Tool Annotations · RFC 9727 Discovery

OpenAPI x-agent Extensions & OpenAPI-to-MCP Compiler Guide

Architectural Summary (BLUF)

Standard OpenAPI 3.1 tells an HTTP client how to serialize parameters, but omits three invariants autonomous AI agents need before calling a tool: deterministic per-call USD price (x-price-usd & x-bonus-eligible), side-effect safety (x-agent-read-only → MCP readOnlyHint), and context compression mode (x-agent-token-compact: "md"). Across AgentAPIGate’s 400+ live endpoints, one single-source-of-truth registry compiles OpenAPI 3.1 extensions directly into Remote Streamable HTTP MCP and /openapi.json.

Zero-Latency Client Validator · 100% In-Browser

OpenAPI x-agent-* Validator & MCP inputSchema Compiler

Compiled MCP Tool Schema (~256 tokens)
{
  "name": "search_google_web",
  "description": "Real-time Google Web SERP search with ranked organic URLs and snippets ($0.0010/call · bonusEligible=true)",
  "annotations": {
    "title": "Real-time Google Web SERP search with ranked organic URLs and snippets",
    "readOnlyHint": true,
    "destructiveHint": false,
    "idempotentHint": true,
    "openWorldHint": true
  },
  "inputSchema": {
    "type": "object",
    "required": [
      "query"
    ],
    "properties": {
      "query": {
        "type": "string",
        "minLength": 1,
        "description": "Search keywords or operator query (e.g. \"openapi x-agent extensions\")"
      },
      "count": {
        "type": "integer",
        "minimum": 1,
        "maximum": 20,
        "default": 10,
        "description": "Maximum organic results to return (1-20)"
      }
    }
  },
  "_meta": {
    "openapi_path": "/v1/search/google/web",
    "http_method": "GET",
    "price_usd": 0.001,
    "bonus_eligible": true,
    "preferred_format": "md"
  }
}
Valid MCP tool name from operationId ("search_google_web").
Deterministic cost extension detected (x-price-usd = $0.0010/call).
Mapped MCP safety annotations: readOnlyHint=true, destructiveHint=false, idempotentHint=true.
All input parameters include explicit descriptions and JSON Schema types.
Protocol Stack Comparison

OpenAPI x-agent-* vs Remote MCP vs agents.json vs RFC 9727

SpecificationLive AgentAPIGate ArtifactToken FootprintCore Engineering RoleKey Tradeoff
OpenAPI 3.1 + x-agent-* Extensions/openapi.jsonHigh if loaded raw; ~180 tokens per compiled operationUniversal REST contract + deterministic x-price-usd, x-bonus-eligible, and safety hintsRequires an OpenAPI-to-MCP compiler or lazy meta-hub to avoid flooding LLM context
Remote Streamable HTTP MCPhttps://mcp.agentapigate.ai/mcp~680 tokens (lazy 4-tool discovery hub)Native tools/list & tools/call execution with OAuth 2.1 PKCE and boolean tool annotationsExposes single-step tool primitives rather than multi-step orchestration chains
agents.json Workflow Chains/v1/recipes (or agents.json)~320 tokens per multi-step recipeDefines ordered multi-endpoint chains and parameter bindings on top of OpenAPILess standardized across IDE clients than native MCP or SKILL.md
RFC 9727 API Catalog Linkset/.well-known/api-catalog~260 tokens (application/linkset+json)IETF standard root discovery linking OpenAPI 3.1, llms.txt, /mcp, /v1/quote, and /a2aEntrypoint index only — delegates parameter schemas to linked OpenAPI / MCP specs
Live Pre-Flight Discovery Receipt · $0.00 Keyless

How Agents Combine OpenAPI Extensions with GET /v1/quote

Autonomous agents discover endpoints via /.well-known/api-catalog (RFC 9727), inspect x-price-usd and x-bonus-eligible on /openapi.json or query GET /v1/quote at $0.00, replay a recorded fixture via X-Sandbox: 1, and then execute with a scoped aag_agent_* key:

HTTP 200 OK · GET /v1/quote?endpoint=search.google.web&calls=1000X-AAG-Cost-USD: 0.000000 · Keyless Pre-Flight Quote
{
  "ok": true,
  "meta": {
    "request_id": "req_quote_4e82a910c31f8b04",
    "endpoint": "catalog.quote",
    "format": "json",
    "cost_usd": 0,
    "tokens_est": 248,
    "latency_ms": 3,
    "cached": true
  },
  "data": {
    "matched_by": "endpoint",
    "query": "search.google.web",
    "calls_requested": 1000,
    "currency": "USD",
    "primary": {
      "endpoint_id": "search.google.web",
      "route_path": "/v1/search/google/web",
      "price_per_call_usd": 0.001,
      "cost_for_n_calls_usd": 1,
      "bonus_eligible": true,
      "sandbox": {
        "supported": true,
        "cost_usd": 0,
        "header": "X-Sandbox: 1",
        "try_url": "https://api.agentapigate.ai/v1/search/google/web?query=ai+agents&count=10&sandbox=1"
      },
      "mcp": {
        "hub_url": "https://mcp.agentapigate.ai/mcp?mode=lazy",
        "tool_name": "search_google_web"
      }
    }
  }
}
Distribution Matrix

Agent Skills Marketplace Guide →

Compare Claude Code Remote MCP, Vercel skills.sh, GitHub SKILL.md, Official MCP Registry, and Smithery.

Skill Compiler

Claude SKILL.md Generator →

Export deterministic YAML-frontmatter SKILL.md bundles from our 400+ OpenAPI endpoint registry in one click.

$0.00 Replay

Zero-Key API Sandbox →

Test response schemas and compact Markdown token savings across all 400+ endpoints using X-Sandbox: 1.

OpenAPI x-agent Extensions & MCP FAQ

What are OpenAPI x-agent extensions?

OpenAPI 3.1 allows vendor extensions prefixed with x- on any path or operation object. x-agent-* (and billing extensions such as x-price-usd and x-bonus-eligible) enrich human-oriented REST specs with machine-actionable metadata for AI agents: whether an operation is strictly read-only, idempotent, safe for autonomous retries, what each call costs in USD, and which compact output format minimizes LLM tokens.

Why not load a 400-endpoint openapi.json file directly into Claude or GPT context?

A production OpenAPI 3.1 document for 400+ endpoints exceeds 150,000 tokens, exhausting context windows and degrading tool-selection accuracy. Instead, compile individual OpenAPI operations into focused MCP tools (<=12 tools per vertical pack) or mount a lazy 4-tool MCP discovery hub (search_endpoints -> get_endpoint_schema -> call_endpoint) in ~680 tokens.

How do OpenAPI x-agent extensions map to MCP tool annotations?

MCP 2025-03-26 defines four boolean hints on every tool: readOnlyHint, destructiveHint, idempotentHint, and openWorldHint. Setting x-agent-read-only, x-agent-destructive, and x-agent-idempotent in your single-source-of-truth OpenAPI spec lets your gateway auto-generate accurate MCP annotations so ChatGPT, Claude, and Cursor know when human confirmation is required.

How does agents.json relate to OpenAPI x-agent extensions and MCP?

OpenAPI + x-agent-* describes atomic HTTP operations and their per-call cost/safety invariants, MCP exposes those atomic operations over Streamable HTTP JSON-RPC, and agents.json (or AgentAPIGate /v1/recipes) layers multi-step workflow sequences on top when a task spans several endpoints in order.