Skip to content

Commit 9df1b12

Browse files
committed
feat(yapi-skill): load template from package
1 parent e2a7de6 commit 9df1b12

File tree

5 files changed

+152
-536
lines changed

5 files changed

+152
-536
lines changed

packages/yapi-mcp/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ npx -y @leeguoo/yapi-mcp install-skill \
7171
--yapi-password=your_password
7272
```
7373

74+
Skill 模板来源:`packages/yapi-mcp/skill-template/SKILL.md`(发布后从包内复制到技能目录)。
75+
7476
CLI 使用示例(走同一份 `~/.yapi/config.toml`):
7577

7678
```bash

packages/yapi-mcp/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@leeguoo/yapi-mcp",
3-
"version": "0.3.10",
3+
"version": "0.3.11",
44
"description": "YApi Auto MCP Server - Model Context Protocol server for YApi integration, enables AI tools like Cursor to interact with YApi API documentation",
55
"main": "dist/index.js",
66
"bin": {
@@ -10,7 +10,8 @@
1010
},
1111
"files": [
1212
"dist",
13-
"README.md"
13+
"README.md",
14+
"skill-template"
1415
],
1516
"scripts": {
1617
"build": "tsc && tsc-alias",
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: yapi
3+
description: Query and sync YApi interface documentation. Use when user mentions "yapi 接口文档", YAPI docs, asks for request/response details, or needs docs sync.
4+
---
5+
6+
# YApi interface docs
7+
8+
## Workflow
9+
1. Load config from `~/.yapi/config.toml` (base_url, auth_mode, email/password or token, optional project_id).
10+
2. Identify the target interface by id or keyword; ask for project/category ids if needed.
11+
3. Call YApi endpoints with the CLI (see examples below) to fetch raw JSON.
12+
4. Summarize method, path, headers, query/body schema, response schema, and examples.
13+
14+
## CLI
15+
- Install & run: `npx -y @leeguoo/yapi-mcp yapi -h` (or install globally and use `yapi`).
16+
- Use the same config as the skill: `~/.yapi/config.toml`.
17+
- Examples:
18+
- `yapi --path /api/interface/get --query id=123`
19+
- `yapi search --q keyword`
20+
- `yapi whoami`
21+
22+
## Docs sync
23+
- Bind local docs to YApi category with `yapi docs-sync bind add --name <binding> --dir <path> --project-id <id> --catid <id>` (stored in `.yapi/docs-sync.json`).
24+
- Sync with `yapi docs-sync --binding <binding>` or run all bindings with `yapi docs-sync`.
25+
- Default syncs only changed files; use `--force` to sync everything.
26+
- Mermaid rendering depends on `mmdc` (auto-installed if possible; failures do not block sync).
27+
- For full Markdown render, install `pandoc` (manual install required).
28+
- Extra mappings (generated after docs-sync run in binding mode):
29+
- `.yapi/docs-sync.links.json`: local docs to YApi doc URLs.
30+
- `.yapi/docs-sync.projects.json`: cached project metadata/envs.
31+
- `.yapi/docs-sync.deployments.json`: local docs to deployed URLs.
32+
33+
## Interface creation tips
34+
- When adding interfaces, always set `req_body_type` (use `json` if unsure) and provide `res_body` (prefer JSON Schema). Empty values can make `/api/interface/add` fail.
35+
- Keep request/response structures in `req_*` / `res_body` instead of stuffing them into `desc` or `markdown`.

0 commit comments

Comments
 (0)