OpenAPI

Expose an OpenAPI server on the agentgateway.

Configure the agentgateway

  1. Download the OpenAPI schema for the Petstore app.

    curl -o ./examples/openapi/openapi.json https://raw.githubusercontent.com/agentgateway/agentgateway/refs/heads/main/examples/openapi/openapi.json
  2. Create an OpenAPI configuration for your agentgateway. In this example, the agentgateway is configured as follows:

    • Listener: An HTTP listener is configured and exposed on port 3000.
    • Backend: The agentgateway connects to a Swagger UI endpoint that exposes the OpenAPI spec for the Petstore sample app. You also include the OpenAPI schema that you downloaded earlier.
    cat <<EOF > config.yaml
    binds:
       - port: 3000
         listeners:
         - routes:
           - backends:
             - mcp:
                 name: default
                 targets:
                 - name: openapi
                   openapi:
                     schema:
                       file: ./examples/openapi/openapi.json
                     host: localhost
                     port: 8080
    EOF
  3. Run the agentgateway.

    agentgateway -f config.yaml