{
  "openapi": "3.1.0",
  "info": {
    "title": "AgentIndex API",
    "version": "1.0.0",
    "description": "Public, read-only access to the AgentIndex directory of open-source AI agents, MCP servers and developer tools, plus tool submission. No authentication required."
  },
  "servers": [{ "url": "https://agentindex.app" }],
  "paths": {
    "/api/mcp/": {
      "get": {
        "summary": "MCP server info and status",
        "description": "Returns the server name, protocol version and the list of available MCP tools. Use it as a health check.",
        "responses": {
          "200": { "description": "Server info", "content": { "application/json": { "schema": { "type": "object" } } } }
        }
      },
      "post": {
        "summary": "MCP JSON-RPC endpoint",
        "description": "Model Context Protocol over HTTP POST (JSON-RPC 2.0). Methods: initialize, tools/list, tools/call. Tools: search_tools, get_tool_detail, list_categories, get_trending, submit_tool. Call tools/list for the input schemas.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["jsonrpc", "method"],
                "properties": {
                  "jsonrpc": { "const": "2.0" },
                  "id": {},
                  "method": { "enum": ["initialize", "tools/list", "tools/call"] },
                  "params": { "type": "object" }
                }
              },
              "example": {
                "jsonrpc": "2.0",
                "id": 1,
                "method": "tools/call",
                "params": { "name": "search_tools", "arguments": { "query": "browser", "limit": 5 } }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "JSON-RPC response", "content": { "application/json": { "schema": { "type": "object" } } } },
          "400": { "description": "Request body is not valid JSON" }
        }
      }
    },
    "/api/tools/{id}/markdown/": {
      "get": {
        "summary": "Tool detail as Markdown",
        "description": "Same content as requesting /en/tool/{id}/ with Accept: text/markdown.",
        "parameters": [
          { "name": "id", "in": "path", "required": true, "schema": { "type": "string" }, "description": "Tool ID, e.g. as returned by search_tools" }
        ],
        "responses": {
          "200": { "description": "Markdown document", "content": { "text/markdown": { "schema": { "type": "string" } } } },
          "404": { "description": "Unknown tool ID" }
        }
      }
    }
  }
}
