{
  "openapi": "3.1.0",
  "info": {
    "title": "AgentNDX API",
    "description": "Network registry for the agentic web. MCP servers, A2A agents, x402-enabled services.",
    "version": "1.0.0",
    "contact": {
      "url": "https://agentndx.ai"
    }
  },
  "servers": [
    {
      "url": "https://agentndx.ai",
      "description": "Production"
    }
  ],
  "paths": {
    "/api/servers.json": {
      "get": {
        "summary": "Full server index",
        "description": "Returns all indexed MCP servers, A2A agents, and x402-enabled services.",
        "operationId": "listServers",
        "responses": {
          "200": {
            "description": "Server list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "servers": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Server"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "updated": {
                      "type": "string",
                      "format": "date"
                    },
                    "source": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/categories.json": {
      "get": {
        "summary": "Category list",
        "operationId": "listCategories",
        "responses": {
          "200": {
            "description": "Categories with counts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/stats.json": {
      "get": {
        "summary": "Registry statistics",
        "operationId": "getStats",
        "responses": {
          "200": {
            "description": "Stats",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": {
                      "type": "integer"
                    },
                    "mcp": {
                      "type": "integer"
                    },
                    "a2a": {
                      "type": "integer"
                    },
                    "x402": {
                      "type": "integer"
                    },
                    "verified": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/search": {
      "get": {
        "summary": "Search servers",
        "description": "Search the full Railway-backed index (15K+ entries) by keyword, category, or protocol. x402 payment required ($0.005 USDC on Base mainnet). Returns 402 if unpaid.",
        "operationId": "searchServers",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Search query"
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Filter by category slug"
          },
          {
            "name": "protocols",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated: MCP,A2A,x402"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 10
            },
            "description": "Max results"
          }
        ],
        "responses": {
          "200": {
            "description": "Search results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Server"
                      }
                    },
                    "total": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment required — x402 protocol, $0.005 USDC on Base mainnet"
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "summary": "MCP endpoint",
        "description": "Full MCP server. Tools: search_servers (x402, $0.005 USDC), list_categories (free), get_server (free), get_stats (free).",
        "operationId": "mcpEndpoint",
        "responses": {
          "200": {
            "description": "MCP response"
          },
          "402": {
            "description": "Payment required — x402 protocol, $0.005 USDC on Base mainnet"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Server": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "endpoint": {
            "type": "string",
            "format": "uri"
          },
          "protocols": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "MCP",
                "A2A",
                "x402",
                "NLWeb"
              ]
            }
          },
          "transport": {
            "type": "string",
            "enum": [
              "stdio",
              "http",
              "sse"
            ]
          },
          "auth": {
            "type": "string",
            "enum": [
              "none",
              "api-key",
              "oauth",
              "x402"
            ]
          },
          "x402": {
            "type": "boolean"
          },
          "x402_price": {
            "type": "string"
          },
          "verified": {
            "type": "boolean"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "health": {
            "type": "string",
            "enum": [
              "active",
              "inactive",
              "unknown"
            ]
          }
        }
      }
    }
  }
}