{
  "openapi": "3.1.0",
  "info": {
    "title": "增爱 AI 工具导航 API",
    "description": "提供 AI 工具、MCP Server、Agent Skill 的搜索、推荐和组合教程数据。所有接口均为公开接口，无需认证。支持 DeepSeek function calling、Coze API 插件、Claude MCP 等接入方式。",
    "version": "1.1.0",
    "contact": { "name": "zengai.com", "url": "https://www.zengai.com" }
  },
  "servers": [
    { "url": "https://www.zengai.com", "description": "Production" },
    { "url": "http://localhost:3000", "description": "Development" }
  ],
  "paths": {
    "/api/v1/ai/summary": {
      "get": {
        "operationId": "aiSummary",
        "summary": "站点摘要（轻量版）",
        "description": "精简的站点概览，包含 Top 20 工具、分类列表和统计信息。适合 AI 工具快速了解站点内容。",
        "tags": ["ai"],
        "security": [],
        "responses": {
          "200": {
            "description": "站点摘要",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": {
                      "type": "object",
                      "properties": {
                        "site": { "$ref": "#/components/schemas/SiteInfo" },
                        "stats": { "$ref": "#/components/schemas/SiteStats" },
                        "topTools": { "type": "array", "items": { "$ref": "#/components/schemas/ToolBrief" } },
                        "categories": { "type": "array", "items": { "$ref": "#/components/schemas/CategoryBrief" } },
                        "endpoints": { "type": "object" }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ai/site-index": {
      "get": {
        "operationId": "aiSiteIndex",
        "summary": "站点全貌（完整版）",
        "description": "完整的站点数据，包含所有工具名称+分类+统计信息。适合 AI Agent 全面索引站点内容。",
        "tags": ["ai"],
        "security": [],
        "responses": {
          "200": {
            "description": "站点全貌",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": {
                      "type": "object",
                      "properties": {
                        "site": { "$ref": "#/components/schemas/SiteInfo" },
                        "stats": { "$ref": "#/components/schemas/SiteStats" },
                        "allTools": { "type": "array", "items": { "$ref": "#/components/schemas/ToolBrief" } },
                        "categories": { "type": "array", "items": { "$ref": "#/components/schemas/CategoryBrief" } },
                        "endpoints": { "type": "object" }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ai/tools": {
      "get": {
        "operationId": "aiToolsSearch",
        "summary": "AI 工具搜索",
        "description": "搜索 AI 工具、MCP Server、Agent Skill 等，返回结构化 JSON。",
        "tags": ["ai", "search"],
        "security": [],
        "parameters": [
          { "name": "q", "in": "query", "schema": { "type": "string" }, "description": "搜索关键词" },
          { "name": "type", "in": "query", "schema": { "type": "string", "enum": ["ai_tool", "mcp_server", "agent_skill", "cursor_rule", "claude_plugin", "chatgpt_gpt"] }, "description": "按类型过滤" }
        ],
        "responses": {
          "200": {
            "description": "搜索结果",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": {
                      "type": "object",
                      "properties": {
                        "tools": { "type": "array", "items": { "$ref": "#/components/schemas/ToolBrief" } },
                        "total": { "type": "integer" }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ai/recommend": {
      "get": {
        "operationId": "aiRecommend",
        "summary": "智能推荐工具",
        "description": "根据关键词推荐最匹配的 AI 工具。支持按名称、描述、标签等多维度匹配。",
        "tags": ["ai", "recommend"],
        "security": [],
        "parameters": [
          { "name": "q", "in": "query", "required": true, "schema": { "type": "string" }, "description": "搜索关键词，如 'AI 绘图'、'代码审查'" }
        ],
        "responses": {
          "200": {
            "description": "推荐结果",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": {
                      "type": "object",
                      "properties": {
                        "query": { "type": "string" },
                        "tools": { "type": "array", "items": { "$ref": "#/components/schemas/ToolBrief" } },
                        "total": { "type": "integer" }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ai/llms-full": {
      "get": {
        "operationId": "aiLlmsFull",
        "summary": "完整工具索引",
        "description": "生成 llms-full.txt 内容，包含所有工具名称+描述的完整列表。支持 text/plain 和 JSON 两种格式。",
        "tags": ["ai"],
        "security": [],
        "parameters": [
          { "name": "Accept", "in": "header", "schema": { "type": "string" }, "description": "设为 'text/plain' 返回纯文本，否则返回 JSON" }
        ],
        "responses": {
          "200": {
            "description": "完整工具索引",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": {
                      "type": "object",
                      "properties": {
                        "content": { "type": "string" },
                        "toolCount": { "type": "integer" },
                        "generatedAt": { "type": "string", "format": "date-time" }
                      }
                    }
                  }
                }
              },
              "text/plain": {
                "schema": { "type": "string", "description": "llms-full.txt 格式的纯文本内容" }
              }
            }
          }
        }
      }
    },
    "/api/v1/ai/config/{slug}": {
      "get": {
        "operationId": "aiToolConfig",
        "summary": "Claude Desktop 配置",
        "description": "获取工具的 Claude Desktop MCP 配置。",
        "tags": ["ai"],
        "security": [],
        "parameters": [
          { "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": {
            "description": "工具配置",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": {
                      "type": "object",
                      "properties": {
                        "tool": { "$ref": "#/components/schemas/ToolBrief" },
                        "config": { "type": "object" },
                        "configPath": { "type": "string" },
                        "instructions": { "type": "string" }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ai/combination-reports": {
      "get": {
        "operationId": "aiCombinationReports",
        "summary": "工具组合教程列表（AI 格式）",
        "description": "AI 可读的组合教程列表，返回机器可读 JSON 格式。",
        "tags": ["ai", "reports"],
        "security": [],
        "parameters": [
          { "name": "q", "in": "query", "schema": { "type": "string" } }
        ],
        "responses": {
          "200": {
            "description": "教程列表",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": {
                      "type": "object",
                      "properties": {
                        "query": { "type": "string" },
                        "reports": { "type": "array", "items": { "type": "object" } },
                        "total": { "type": "integer" }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ai/combination-reports/{slug}": {
      "get": {
        "operationId": "aiCombinationReportDetail",
        "summary": "单条组合教程详情（AI 格式）",
        "tags": ["ai", "reports"],
        "security": [],
        "parameters": [
          { "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": {
            "description": "教程详情",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": { "type": "object" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/search": {
      "get": {
        "operationId": "fullTextSearch",
        "summary": "全文搜索",
        "description": "支持模糊搜索和排序的工具搜索 API。",
        "tags": ["search"],
        "security": [],
        "parameters": [
          { "name": "q", "in": "query", "required": true, "schema": { "type": "string" } },
          { "name": "page", "in": "query", "schema": { "type": "integer", "default": 1 } },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 20 } },
          { "name": "sortBy", "in": "query", "schema": { "type": "string", "enum": ["relevance", "popularity", "rating", "newest"] } }
        ],
        "responses": {
          "200": {
            "description": "搜索结果",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": {
                      "type": "object",
                      "properties": {
                        "tools": { "type": "array", "items": { "$ref": "#/components/schemas/ToolBrief" } },
                        "pagination": { "$ref": "#/components/schemas/Pagination" }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/search/semantic": {
      "get": {
        "operationId": "semanticSearch",
        "summary": "语义搜索",
        "description": "基于向量相似度的语义搜索，理解自然语言查询的含义。",
        "tags": ["search"],
        "security": [],
        "parameters": [
          { "name": "q", "in": "query", "required": true, "schema": { "type": "string" } },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 10 } }
        ],
        "responses": {
          "200": {
            "description": "语义搜索结果",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": { "type": "object" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/search/suggestions": {
      "get": {
        "operationId": "searchSuggestions",
        "summary": "搜索建议",
        "description": "输入时实时返回搜索建议词。",
        "tags": ["search"],
        "security": [],
        "parameters": [
          { "name": "q", "in": "query", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": {
            "description": "搜索建议列表",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": { "type": "object" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/search/hot-keywords": {
      "get": {
        "operationId": "hotKeywords",
        "summary": "热门搜索词",
        "description": "返回当前热门搜索关键词列表。",
        "tags": ["search"],
        "security": [],
        "responses": {
          "200": {
            "description": "热门关键词",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": { "type": "object" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/batch": {
      "get": {
        "operationId": "batchGetTools",
        "summary": "批量获取工具详情",
        "description": "一次获取多个工具详情，支持 ID 或 slug。最多 20 个。",
        "tags": ["tools"],
        "security": [],
        "parameters": [
          { "name": "ids", "in": "query", "schema": { "type": "string" }, "description": "逗号分隔的工具 ID，如 '1,2,3'" },
          { "name": "slugs", "in": "query", "schema": { "type": "string" }, "description": "逗号分隔的工具 slug，如 'chatgpt,cursor'" }
        ],
        "responses": {
          "200": {
            "description": "工具列表",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": { "type": "array", "items": { "$ref": "#/components/schemas/ToolDetail" } }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/{idOrSlug}": {
      "get": {
        "operationId": "getToolDetail",
        "summary": "工具详情",
        "tags": ["tools"],
        "security": [],
        "parameters": [
          { "name": "idOrSlug", "in": "path", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": {
            "description": "工具详情",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": { "$ref": "#/components/schemas/ToolDetail" }
                  }
                }
              }
            }
          },
          "404": {
            "description": "工具不存在",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/categories": {
      "get": {
        "operationId": "listCategories",
        "summary": "分类列表",
        "tags": ["categories"],
        "security": [],
        "parameters": [
          { "name": "type", "in": "query", "schema": { "type": "string", "enum": ["ai_tool", "mcp_server", "agent_skill"] } }
        ],
        "responses": {
          "200": {
            "description": "分类列表",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": { "type": "array", "items": { "$ref": "#/components/schemas/Category" } }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/stats/top-tools": {
      "get": {
        "operationId": "topTools",
        "summary": "热门工具排行",
        "description": "获取热门工具排行（公开接口，无需权限）。按 rankScore 降序排列。",
        "tags": ["stats"],
        "security": [],
        "parameters": [
          { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 10, "maximum": 100 } }
        ],
        "responses": {
          "200": {
            "description": "热门工具排行",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": { "type": "array", "items": { "$ref": "#/components/schemas/ToolBrief" } }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/reports": {
      "get": {
        "operationId": "listReports",
        "summary": "行业报告列表",
        "tags": ["reports"],
        "security": [],
        "parameters": [
          { "name": "page", "in": "query", "schema": { "type": "integer", "default": 1 } },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 20 } },
          { "name": "categoryId", "in": "query", "schema": { "type": "string" } }
        ],
        "responses": {
          "200": {
            "description": "报告列表",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": { "type": "object" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/topics": {
      "get": {
        "operationId": "listTopics",
        "summary": "专题合集列表",
        "tags": ["topics"],
        "security": [],
        "responses": {
          "200": {
            "description": "专题列表",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": { "type": "object" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/combination-reports": {
      "get": {
        "operationId": "listCombinationReports",
        "summary": "工具组合教程列表",
        "tags": ["reports"],
        "security": [],
        "responses": {
          "200": {
            "description": "教程列表",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": { "type": "object" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/platforms/coze/search": {
      "get": {
        "operationId": "cozeSearch",
        "summary": "豆包/Coze 专用搜索",
        "description": "为 Coze 平台优化的搜索端点。",
        "tags": ["platforms"],
        "security": [],
        "parameters": [
          { "name": "q", "in": "query", "schema": { "type": "string" } },
          { "name": "type", "in": "query", "schema": { "type": "string" } },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 5 } }
        ],
        "responses": {
          "200": {
            "description": "Coze 格式搜索结果",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": { "type": "object" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/platforms/kb/export": {
      "get": {
        "operationId": "exportKnowledgeBase",
        "summary": "知识库导出",
        "description": "导出 JSONL 格式的工具数据，供 Coze/Dify 导入知识库。",
        "tags": ["platforms"],
        "security": [],
        "parameters": [
          { "name": "minScore", "in": "query", "schema": { "type": "integer" }, "description": "最低质量评分" },
          { "name": "type", "in": "query", "schema": { "type": "string" } }
        ],
        "responses": {
          "200": {
            "description": "JSONL 文件",
            "content": {
              "application/x-ndjson": {}
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "success": { "type": "boolean", "example": false },
          "error": {
            "type": "object",
            "properties": {
              "message": { "type": "string" },
              "code": { "type": "string" }
            }
          }
        }
      },
      "SiteInfo": {
        "type": "object",
        "properties": {
          "name": { "type": "string", "example": "增AI (zengai.com)" },
          "url": { "type": "string", "format": "uri", "example": "https://www.zengai.com" },
          "description": { "type": "string" },
          "note": { "type": "string" }
        }
      },
      "SiteStats": {
        "type": "object",
        "properties": {
          "aiTools": { "type": "integer" },
          "mcpServers": { "type": "integer" },
          "agentSkills": { "type": "integer" },
          "categories": { "type": "integer" },
          "reports": { "type": "integer" }
        }
      },
      "ToolBrief": {
        "type": "object",
        "properties": {
          "name": { "type": "string" },
          "alternateName": { "type": "string" },
          "slug": { "type": "string" },
          "description": { "type": "string" },
          "type": { "type": "string", "enum": ["ai_tool", "mcp_server", "agent_skill", "cursor_rule", "claude_plugin", "chatgpt_gpt"] },
          "category": { "type": "string" },
          "stars": { "type": "integer" },
          "url": { "type": "string", "format": "uri" }
        }
      },
      "ToolDetail": {
        "allOf": [
          { "$ref": "#/components/schemas/ToolBrief" },
          {
            "type": "object",
            "properties": {
              "id": { "type": "integer" },
              "logo": { "type": "string", "format": "uri" },
              "website": { "type": "string", "format": "uri" },
              "fullDescription": { "type": "string" },
              "tags": { "type": "string" },
              "features": { "type": "string" },
              "viewCount": { "type": "integer" },
              "clickCount": { "type": "integer" },
              "rankScore": { "type": "number" },
              "rating": { "type": "number" },
              "installCommand": { "type": "string" },
              "npmPackage": { "type": "string" },
              "registryUrl": { "type": "string" },
              "category": { "$ref": "#/components/schemas/Category" }
            }
          }
        ]
      },
      "Category": {
        "type": "object",
        "properties": {
          "id": { "type": "integer" },
          "name": { "type": "string" },
          "slug": { "type": "string" },
          "icon": { "type": "string" },
          "description": { "type": "string" }
        }
      },
      "CategoryBrief": {
        "type": "object",
        "properties": {
          "name": { "type": "string" },
          "slug": { "type": "string" },
          "icon": { "type": "string" },
          "url": { "type": "string", "format": "uri" }
        }
      },
      "Pagination": {
        "type": "object",
        "properties": {
          "page": { "type": "integer" },
          "pageSize": { "type": "integer" },
          "total": { "type": "integer" },
          "hasMore": { "type": "boolean" }
        }
      }
    }
  },
  "tags": [
    { "name": "ai", "description": "AI Agent 专用接口" },
    { "name": "search", "description": "搜索相关接口" },
    { "name": "recommend", "description": "推荐相关接口" },
    { "name": "tools", "description": "工具相关接口" },
    { "name": "categories", "description": "分类相关接口" },
    { "name": "reports", "description": "报告/教程接口" },
    { "name": "topics", "description": "专题合集接口" },
    { "name": "stats", "description": "统计接口" },
    { "name": "platforms", "description": "外部平台适配接口" }
  ],
  "security": []
}
