z-yapi-mcp 1.0.3 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -51
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,71 +1,43 @@
|
|
|
1
|
-
|
|
1
|
+
# z-yapi-mcp 运行说明
|
|
2
2
|
|
|
3
3
|
这是一个基于 `@modelcontextprotocol/sdk` 实现的 **MCP stdio 服务**,通过调用 YApi 接口提供工具能力。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
# 使用
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"mcpServers": {
|
|
10
|
+
"z-yapi-mcp": {
|
|
11
|
+
"command": "npx",
|
|
12
|
+
"args": [
|
|
13
|
+
"z-yapi-mcp",
|
|
14
|
+
"--stdio",
|
|
15
|
+
"--yapi-base-url=https://api.psvmc.com/",
|
|
16
|
+
"--yapi-token=yourtoken"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
17
21
|
```
|
|
18
22
|
|
|
19
|
-
### 配置 YApi 相关环境变量
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
# 环境准备
|
|
22
25
|
|
|
23
|
-
-
|
|
24
|
-
-
|
|
26
|
+
- **Node.js**:建议 20+ 版本
|
|
27
|
+
- **操作系统**:Windows / macOS / Linux 均可
|
|
25
28
|
|
|
26
|
-
|
|
29
|
+
## 安装依赖
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
在项目根目录执行:
|
|
29
32
|
|
|
30
33
|
```bash
|
|
31
34
|
cd d:\Project\ai\z-yapi-mcp
|
|
32
|
-
npm
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
2. **以 Node 直接运行 dist 入口**
|
|
36
|
-
|
|
37
|
-
```powershell
|
|
38
|
-
cd d:\Project\ai\z-yapi-mcp
|
|
39
|
-
|
|
40
|
-
$env:YAPI_BASE_URL = "https://yapi.example.com"
|
|
41
|
-
$env:YAPI_TOKEN = "your-yapi-token"
|
|
42
|
-
|
|
43
|
-
node .\dist\index.js --stdio --yapi-base-url=$env:YAPI_BASE_URL --yapi-token=$env:YAPI_TOKEN
|
|
35
|
+
npm install
|
|
44
36
|
```
|
|
45
37
|
|
|
46
|
-
该方式适合被 MCP 客户端通过命令配置拉起,例如:
|
|
47
38
|
|
|
48
|
-
```json
|
|
49
|
-
{
|
|
50
|
-
"mcpServers": {
|
|
51
|
-
"z-yapi-mcp": {
|
|
52
|
-
"command": "node",
|
|
53
|
-
"args": [
|
|
54
|
-
"d:/Project/ai/z-yapi-mcp/dist/index.js",
|
|
55
|
-
"--stdio",
|
|
56
|
-
"--yapi-base-url=https://yapi.example.com",
|
|
57
|
-
"--yapi-token=your-yapi-token"
|
|
58
|
-
],
|
|
59
|
-
"env": {
|
|
60
|
-
"YAPI_BASE_URL": "https://yapi.example.com",
|
|
61
|
-
"YAPI_TOKEN": "your-yapi-token"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
39
|
|
|
68
|
-
|
|
40
|
+
# 本地测试脚本
|
|
69
41
|
|
|
70
42
|
仓库中提供了一个简单的本地测试脚本 `test-tools-list.mjs`,可以在不依赖外部 MCP 客户端的前提下验证服务是否正常返回工具列表。
|
|
71
43
|
|