返回顶部
y

yapiYApi接口文档

Query and sync YApi interface documentation. Use when user mentions "yapi 接口文档", YAPI docs, asks for request/response details, or needs docs sync. Also triggers when user pastes a YApi URL that matches the configured base_url.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.1
安全检测
已通过
1,777
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

yapi

YApi 接口文档

命令策略

优先使用 yapi 命令。若缺失,则回退到一次性 npx 执行,不强制全局安装:

bash
yapi -h

回退方案:


npx -y @leeguoo/yapi-mcp -h

在以下命令示例中,yapi 可替换为 npx -y @leeguoo/yapi-mcp。

快速工作流

  1. 1. 若用户提供 YApi URL,验证其属于已配置的 baseurl。
  2. 确认认证状态(yapi whoami),仅在需要时执行 yapi login。
  3. 通过 apiid / 关键词 / 分类解析目标。
  4. 先获取原始 JSON,再总结:方法、路径、请求头、参数、请求体、响应结构/示例。
  5. 对于文档同步任务,先执行 --dry-run,再进行实际同步。

URL 检测

  1. 1. 从 ~/.yapi/config.toml 读取已配置的 base_url。
bash rg -n ^base_url\\s*= ~/.yapi/config.toml
  1. 2. 若 URL 来源与 base_url 匹配,从路径中提取 ID:
- /project/123/... -> project_id=123 - .../api/456 -> api_id=456 - .../api/cat_789 -> catid=789
  1. 3. 当存在 api_id 时,优先直接查找:
bash yapi --path /api/interface/get --query id=

常用命令

bash

版本/帮助


yapi --version
yapi -h

认证

yapi whoami yapi login

搜索/获取

yapi search --q keyword --project-id 310 yapi --path /api/interface/get --query id=123 yapi --path /api/interface/list_cat --query catid=123

配置缓存位置:

  • - 配置文件:~/.yapi/config.toml
  • 认证缓存:~/.yapi-mcp/auth-*.json

文档同步

绑定模式(推荐):
bash
yapi docs-sync bind add --name projectA --dir docs/release-notes --project-id 267 --catid 3667
yapi docs-sync --binding projectA --dry-run
yapi docs-sync --binding projectA

注意事项:

  • - 绑定文件:.yapi/docs-sync.json
  • 映射输出:.yapi/docs-sync.links.json、.yapi/docs-sync.projects.json、.yapi/docs-sync.deployments.json
  • 默认行为仅同步变更文件;使用 --force 进行全量同步。
  • 兼容目录 .yapi.json 配置作为回退方案(无绑定时)。
  • Mermaid/PlantUML/Graphviz/D2 渲染依赖本地工具可用性;缺失工具不会阻塞基本同步。

接口创建规范

  • - 创建/更新接口时,务必设置 reqbodytype(不确定时使用 json)并提供 resbody(优先使用 JSON Schema)。
  • 将结构化的请求/响应字段放入 req* / res_body,而非仅放在自由文本的 desc/markdown 中。

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 yapi-1776368239 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 yapi-1776368239 技能

通过命令行安装

skillhub install yapi-1776368239

下载

⬇ 下载 yapi v1.0.1(免费)

文件大小: 1.83 KB | 发布时间: 2026-4-17 15:22

v1.0.1 最新 2026-4-17 15:22
- Prefer using the global yapi CLI; if missing, fallback to npx for command execution.
- Streamlined workflow steps for authentication, URL matching, and data fetching.
- Clarified command usage, including direct npx alternatives and project/category resolution.
- Updated docs sync instructions to emphasize binding mode and dry-run before syncing.
- Revised config and cache path guidance; expanded tool dependencies for sync/rendering.
- Added stronger recommendations for correct interface creation and field placement.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部