yapi
Original:🇺🇸 English
Translated
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.
10installs
Added on
NPX Install
npx skill4agent add leeguooooo/cross-request-master yapiTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →YApi interface docs
Install / update
Preferred install / refresh flow:
bash
npx skills add leeguooooo/cross-request-master -y -gPreferred config bootstrap after skill install:
bash
yapi config init --base-url=https://your-yapi-domain.com --auth-mode=global --email=YOUR_EMAIL
yapi login --base-url=https://your-yapi-domain.com --browserCompatibility path when the user also wants to write in one step:
~/.yapi/config.tomlbash
npm install -g @leeguoo/yapi-mcp
yapi install-skill --yapi-base-url=https://your-yapi-domain.com --yapi-auth-mode=global --yapi-email=YOUR_EMAIL --forceCommand policy
Prefer command. If missing, fallback to one-shot npx without forcing global install:
yapibash
yapi -h
# fallback:
npx -y -p @leeguoo/yapi-mcp yapi -hIn command examples below, can be replaced by .
When CLI version is newer than the installed skill snapshot, warns and asks to rerun:
yapinpx -y -p @leeguoo/yapi-mcp yapiyapibash
npx skills add leeguooooo/cross-request-master -y -g
# compatibility:
npx -y -p @leeguoo/yapi-mcp yapi install-skill --forceSetup / auth bootstrap
- Read configured from
base_urlwhen available.~/.yapi/config.toml - If config is missing, prefer browser login bootstrap:
bash
yapi login --base-url https://your-yapi-domain.com --browser
# optional explicit page:
yapi login --base-url https://your-yapi-domain.com --login-url https://your-yapi-domain.com/- If the user provides email/password, global auth also works:
bash
yapi login --base-url https://your-yapi-domain.com --email you@example.com --password '***'- Validate login before deeper operations:
bash
yapi whoamiQuick workflow
- If user gives a YApi URL, verify it belongs to configured .
base_url - Confirm auth (), then run
yapi whoamiwhen needed (open base URL, finish login in browser, then press Enter to sync cookie).yapi login --browser - Resolve target by / keyword / category.
api_id - Fetch raw JSON first, then summarize: method, path, headers, params, body, response schema/examples.
- For docs sync tasks, do first, then real sync.
--dry-run - If docs sync still hits , note that CLI already retries the file with
413; if it still fails, split the doc or reduce embedded diagrams.--mermaid-classic
URL detection
- Read configured from
base_url.~/.yapi/config.toml
bash
rg -n "^base_url\\s*=" ~/.yapi/config.toml- If URL origin matches , extract IDs from path:
base_url- ->
/project/123/...project_id=123 - ->
.../api/456api_id=456 - ->
.../api/cat_789catid=789
- Prefer direct lookup when exists:
api_id
bash
yapi --path /api/interface/get --query id=<api_id>Common commands
bash
# version/help
yapi --version
yapi self-update
yapi -h
# auth
yapi whoami
yapi login --base-url https://your-yapi-domain.com --browser
yapi login --browser
yapi login --login-url https://your-yapi-domain.com/
yapi logout
# search / fetch
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 --path /api/interface/list_cat --query "catid=4631&limit=50&page=1"
# browse entities
yapi group list
yapi project list --group-id 129 --page 1 --limit 10
yapi project get --id 365
yapi project token --project-id 365
yapi interface list-menu --project-id 365
yapi interface list --project-id 365 --limit all
yapi interface get --id 31400
yapi interface cat add --project-id 365 --name "公共分类" --desc ""
yapi interface cat update --cat-id 3722 --name "公共分类 1" --desc "公共分类"
yapi interface cat delete --cat-id 4169
yapi env --project-id 365
yapi member list --project-id 365
yapi follow
yapi user search --q keyword
yapi log list --type group --type-id 129 --page 1 --limit 10
# exports / test collections
yapi export --project-id 365 --type swagger --name openapi.json
yapi col list --project-id 365
yapi col cases --id 12 --project-id 365Config cache locations:
- Config:
~/.yapi/config.toml - Auth cache:
~/.yapi-mcp/auth-*.json
Browser login dependency:
bash
agent-browser-stealth -V
# install once if missing browser runtime
agent-browser-stealth installDocs sync
Binding mode (recommended):
bash
yapi docs-sync bind add --name projectA --dir docs/release-notes --project-id 267 --catid 3667
yapi docs-sync bind list
yapi docs-sync bind get --name projectA
yapi docs-sync bind update --name projectA --source-file architecture.md
yapi docs-sync --binding projectA --dry-run
yapi docs-sync --binding projectA --source-file architecture.md
yapi docs-sync --binding projectANotes:
- Binding file:
.yapi/docs-sync.json - Mapping outputs: ,
.yapi/docs-sync.links.json,.yapi/docs-sync.projects.json.yapi/docs-sync.deployments.json - When bindings live under the global , relative
~/.yapi/docs-sync.jsonvalues are resolved from the current git project root and stored as--dir-relative paths.$HOME - Default behavior syncs changed files only; use for full sync.
--force - Compatible with directory config as fallback (without binding).
.yapi.json - removes a binding.
yapi docs-sync bind remove --name projectA - overrides binding
--source-file;source_filesclears the stored list on bind update.--clear-source-files - prints per-file preview lines with Markdown/HTML/payload sizes before upload.
--dry-run - If upload hits , the CLI first retries that file with
413 Payload Too Large, then reports payload size, parsed server limit (when available), and the largest Mermaid block if it still fails.--mermaid-classic - Mermaid/PlantUML/Graphviz/D2 rendering depends on local tool availability; missing tools do not block basic sync.
Interface creation guardrails
- Always set (use
req_body_typeif unsure) and providejson(prefer JSON Schema) when creating/updating interfaces.res_body - Put structured request/response fields in /
req_*, not only in free-textres_body/desc.markdown