item-wms-public-api-tool 2.0.7 → 2.0.8

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.
@@ -26,7 +26,7 @@ MCP (Model Control Plane) 通过以下机制实现与AI工具的集成:
26
26
  ```
27
27
 
28
28
  ```json
29
- {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"post_v1_public_user_login","arguments":{"username":"testuser","password":"testpass"},"options":{"baseUrl":"https://wms-staging.item.com/api/public"}}}
29
+ {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"user_login","arguments":{"username":"testuser","password":"testpass"},"options":{"baseUrl":"https://wms-staging.item.com/api/public"}}}
30
30
  ```
31
31
 
32
32
  ### 1.3 Prompts(代码生成提示)
@@ -49,7 +49,7 @@ MCP (Model Control Plane) 通过以下机制实现与AI工具的集成:
49
49
  CLI/脚本 → 读取 openapi.yaml → 动态生成命令 → 直接调用 HTTP API
50
50
  ```
51
51
 
52
- 说明:工具名称由 OpenAPI 自动生成(`<method>_<path>`),CLI 与 MCP 使用同一套工具名。可用 `list/describe` 查看工具详情。
52
+ 说明:工具名称由 OpenAPI 自动生成(`<path>`,先移除 `/v1/public/` 前缀),CLI 与 MCP 使用同一套工具名。可用 `list/describe` 查看工具详情;如有重名会追加请求方式后缀。
53
53
 
54
54
  ## 2. mcp.json文件分析
55
55
 
@@ -81,7 +81,7 @@ CLI/脚本 → 读取 openapi.yaml → 动态生成命令 → 直接调用 HTTP
81
81
 
82
82
  ```json
83
83
  {
84
- "name": "post_v1_public_user_login",
84
+ "name": "user_login",
85
85
  "description": "User authentication and access token retrieval for system access",
86
86
  "inputSchema": {
87
87
  "type": "object",
@@ -122,12 +122,12 @@ AI工具根据用户需求选择合适的工具:
122
122
  // 根据功能描述匹配工具
123
123
  const loginTool = mcpConfig.tools.find(tool =>
124
124
  tool.description.includes('authentication') ||
125
- tool.name === 'post_v1_public_user_login'
125
+ tool.name === 'user_login'
126
126
  );
127
127
 
128
128
  // 根据名称精确匹配
129
129
  const orderQueryTool = mcpConfig.tools.find(tool =>
130
- tool.name === 'post_v1_public_edi_outbound_order_level_search_by_paging'
130
+ tool.name === 'edi_outbound_order_level_search_by_paging'
131
131
  );
132
132
  ```
133
133
 
@@ -149,8 +149,8 @@ console.log('必传参数:', requiredParams);
149
149
  AI工具根据工具名称和参数构造 MCP `tools/call` 请求:
150
150
 
151
151
  ```javascript
152
- // 工具名由 <method>_<path> 生成
153
- const toolName = 'post_v1_public_user_login';
152
+ // 工具名由 <path> 生成(先移除 /v1/public/ 前缀)
153
+ const toolName = 'user_login';
154
154
 
155
155
  const request = {
156
156
  jsonrpc: '2.0',
@@ -214,7 +214,7 @@ if (result.success) {
214
214
 
215
215
  // 使用token调用其他工具
216
216
  const orderResult = await executeMCPCommand(
217
- `${mcpConfig.entrypoint} call post_v1_public_edi_outbound_order_level_search_by_paging --json '{"Paging":{"page":1,"pageSize":10}}' --token ${result.onAuthToken}`
217
+ `${mcpConfig.entrypoint} call edi_outbound_order_level_search_by_paging --json '{"Paging":{"page":1,"pageSize":10}}' --token ${result.onAuthToken}`
218
218
  );
219
219
 
220
220
  console.log('订单查询结果:', orderResult);
@@ -259,7 +259,7 @@ node test-ai-integration.js
259
259
  ✅ 工具数量: <N>
260
260
 
261
261
  2. 验证工具定义
262
- 1. post_v1_public_user_login
262
+ 1. user_login
263
263
  描述: User authentication and access token retrieval for system access
264
264
  输入Schema: 有效
265
265
  必传参数: ["username","password"]
@@ -327,7 +327,7 @@ class MCPIntegration {
327
327
  // 登录方法
328
328
  async login(username, password, baseUrl) {
329
329
  this.baseUrl = baseUrl;
330
- const result = await this.executeCommand('post_v1_public_user_login', {
330
+ const result = await this.executeCommand('user_login', {
331
331
  username,
332
332
  password
333
333
  });
@@ -342,7 +342,7 @@ class MCPIntegration {
342
342
 
343
343
  // 订单查询方法
344
344
  async queryOrders(params) {
345
- return this.executeCommand('post_v1_public_edi_outbound_order_level_search_by_paging', params);
345
+ return this.executeCommand('edi_outbound_order_level_search_by_paging', params);
346
346
  }
347
347
 
348
348
  // 发现工具
@@ -398,7 +398,7 @@ const uploadTools = mcp.getAllTools().filter(tool =>
398
398
  console.log('文件上传相关工具:', uploadTools.map(tool => tool.name));
399
399
 
400
400
  // 精确查找工具
401
- const loginTool = mcp.findTool('post_v1_public_user_login');
401
+ const loginTool = mcp.findTool('user_login');
402
402
  console.log('登录工具:', loginTool.name, '-', loginTool.description);
403
403
  ```
404
404
 
@@ -485,7 +485,7 @@ console.log('登录工具:', loginTool.name, '-', loginTool.description);
485
485
  本MCP设计符合AI工具集成的最佳实践,通过:
486
486
 
487
487
  1. **自描述配置**:完整的工具定义和参数说明
488
- 2. **标准化接口**:统一的工具命名规则(`<method>_<path>`)
488
+ 2. **标准化接口**:统一的工具命名规则(`<path>`)
489
489
  3. **结构化输出**:JSON格式结果
490
490
  4. **清晰的文档**:详细的集成指南
491
491
 
package/HELP.md CHANGED
@@ -39,7 +39,7 @@ item-wms-public-api-tool <toolName> [options]
39
39
  item-wms-public-api-tool call <toolName> [options]
40
40
  ```
41
41
 
42
- 工具名称根据 OpenAPI 自动生成:`<method>_<path>`(非字母数字替换为 `_`),例如 `post_v1_public_user_login`。
42
+ 工具名称根据 OpenAPI 自动生成:`<path>`(先移除 `/v1/public/` 前缀,非字母数字替换为 `_`),例如 `user_login`;如有重名会追加请求方式后缀。
43
43
 
44
44
  ### 动态工具发现
45
45
 
@@ -52,13 +52,13 @@ item-wms-public-api-tool describe <toolName>
52
52
 
53
53
  ```bash
54
54
  # 单个字段(可重复)
55
- item-wms-public-api-tool post_v1_public_user_login --param username=test --param password=pass
55
+ item-wms-public-api-tool user_login --param username=test --param password=pass
56
56
 
57
57
  # 直接传 JSON
58
- item-wms-public-api-tool post_v1_public_user_login --json '{"username":"test","password":"pass"}'
58
+ item-wms-public-api-tool user_login --json '{"username":"test","password":"pass"}'
59
59
 
60
60
  # 从文件读取 JSON
61
- item-wms-public-api-tool post_v1_public_user_login --file ./payload.json
61
+ item-wms-public-api-tool user_login --file ./payload.json
62
62
  ```
63
63
 
64
64
  ### 全局选项
@@ -96,7 +96,7 @@ export WMS_FACILITY_ID=889
96
96
  export WMS_CUSTOMER_ID=FLAANT0001
97
97
 
98
98
  # 现在可以直接执行命令,无需重复输入 baseUrl、token、CompanyID、FacilityID、CustomerID
99
- item-wms-public-api-tool post_v1_public_edi_outbound_order_level_search_by_paging \
99
+ item-wms-public-api-tool edi_outbound_order_level_search_by_paging \
100
100
  --json '{"Paging":{"page":1,"pageSize":10}}'
101
101
  ```
102
102
 
@@ -113,13 +113,13 @@ item-wms-public-api-tool list
113
113
  ### 2. 用户登录
114
114
 
115
115
  ```bash
116
- item-wms-public-api-tool post_v1_public_user_login --param username=testuser --param password=testpass
116
+ item-wms-public-api-tool user_login --param username=testuser --param password=testpass
117
117
  ```
118
118
 
119
119
  ### 3. 按订单维度查询订单
120
120
 
121
121
  ```bash
122
- item-wms-public-api-tool post_v1_public_edi_outbound_order_level_search_by_paging \
122
+ item-wms-public-api-tool edi_outbound_order_level_search_by_paging \
123
123
  --json '{"CompanyID":"TEST_COM","CustomerID":"TEST_CUST","FacilityID":"TEST_FAC","Paging":{"page":1,"pageSize":10}}' \
124
124
  --token YOUR_TOKEN
125
125
  ```
@@ -127,7 +127,7 @@ item-wms-public-api-tool post_v1_public_edi_outbound_order_level_search_by_pagin
127
127
  ### 4. 批量导入物品主数据
128
128
 
129
129
  ```bash
130
- item-wms-public-api-tool post_v1_public_edi_item_master_import \
130
+ item-wms-public-api-tool edi_item_master_import \
131
131
  --json '{"items":[{"itemID":"ITEM001","itemDescription":"测试物品","companyId":"TEST_COM","customerId":"TEST_CUST"}]}' \
132
132
  --token YOUR_TOKEN
133
133
  ```
@@ -147,7 +147,7 @@ npx item-wms-public-api-tool --help
147
147
  A: 通过登录接口获取:
148
148
 
149
149
  ```bash
150
- item-wms-public-api-tool post_v1_public_user_login --param username=YOUR_USERNAME --param password=YOUR_PASSWORD
150
+ item-wms-public-api-tool user_login --param username=YOUR_USERNAME --param password=YOUR_PASSWORD
151
151
  ```
152
152
 
153
153
  提示:在 MCP stdio 模式下,登录返回 `onAuthToken` 后会自动缓存到进程内存,后续调用未显式传 `--token` 时会自动使用;CLI 每次命令仍需传 `--token` 或设置 `WMS_TOKEN`。
@@ -162,7 +162,7 @@ A: 可能的原因及解决方法:
162
162
 
163
163
  ```bash
164
164
  # 对于WMS认证
165
- item-wms-public-api-tool post_v1_public_user_login --param username=YOUR_USERNAME --param password=YOUR_PASSWORD
165
+ item-wms-public-api-tool user_login --param username=YOUR_USERNAME --param password=YOUR_PASSWORD
166
166
  ```
167
167
 
168
168
  ### Q: 如何查看特定命令的帮助
@@ -170,8 +170,8 @@ item-wms-public-api-tool post_v1_public_user_login --param username=YOUR_USERNAM
170
170
  A: 使用 `describe` 查看接口详情,或使用 `--help` 查看命令用法:
171
171
 
172
172
  ```bash
173
- item-wms-public-api-tool describe post_v1_public_edi_outbound_order_level_search_by_paging
174
- item-wms-public-api-tool post_v1_public_edi_outbound_order_level_search_by_paging --help
173
+ item-wms-public-api-tool describe edi_outbound_order_level_search_by_paging
174
+ item-wms-public-api-tool edi_outbound_order_level_search_by_paging --help
175
175
  ```
176
176
 
177
177
  ### Q: 如何从文件读取JSON数据
@@ -180,10 +180,10 @@ A: 使用命令行参数直接传递JSON字符串,或通过脚本读取文件
180
180
 
181
181
  ```bash
182
182
  # 直接传递JSON
183
- item-wms-public-api-tool post_v1_public_edi_item_master_import --json '{"items":[{"itemID":"ITEM001","itemDescription":"测试物品"}]}' --token YOUR_TOKEN
183
+ item-wms-public-api-tool edi_item_master_import --json '{"items":[{"itemID":"ITEM001","itemDescription":"测试物品"}]}' --token YOUR_TOKEN
184
184
 
185
185
  # 或使用文件
186
- item-wms-public-api-tool post_v1_public_edi_item_master_import --file items.json --token YOUR_TOKEN
186
+ item-wms-public-api-tool edi_item_master_import --file items.json --token YOUR_TOKEN
187
187
  ```
188
188
 
189
189
  ## API 列表
package/README.md CHANGED
@@ -54,8 +54,8 @@ npx item-wms-public-api-tool --help
54
54
 
55
55
  ```bash
56
56
  item-wms-public-api-tool list
57
- item-wms-public-api-tool describe post_v1_public_user_login
58
- item-wms-public-api-tool post_v1_public_user_login --param username=USERNAME --param password=PASSWORD
57
+ item-wms-public-api-tool describe user_login
58
+ item-wms-public-api-tool user_login --param username=USERNAME --param password=PASSWORD
59
59
  ```
60
60
 
61
61
  默认 baseUrl 为 `https://wms-staging.item.com/api/public`,也可以通过 `--baseUrl` 传入覆盖。
@@ -76,7 +76,7 @@ export WMS_CUSTOMER_ID=FLAANT0001
76
76
  # 当接口包含 CompanyID/FacilityID/CustomerID 且请求未显式传递时,会自动使用配置值(未配置时使用默认值)。
77
77
 
78
78
  # 现在可以直接执行命令,无需重复输入 baseUrl/token/CompanyID/FacilityID/CustomerID
79
- item-wms-public-api-tool post_v1_public_edi_outbound_order_level_search_by_paging \
79
+ item-wms-public-api-tool edi_outbound_order_level_search_by_paging \
80
80
  --json '{"Paging":{"page":1,"pageSize":10}}'
81
81
  ```
82
82
 
@@ -93,10 +93,10 @@ item-wms-public-api-tool post_v1_public_edi_outbound_order_level_search_by_pagin
93
93
  ```
94
94
 
95
95
  ```json
96
- {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"post_v1_public_user_login","arguments":{"username":"USERNAME","password":"PASSWORD"},"options":{"baseUrl":"https://wms-staging.item.com/api/public"}}}
96
+ {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"user_login","arguments":{"username":"USERNAME","password":"PASSWORD"},"options":{"baseUrl":"https://wms-staging.item.com/api/public"}}}
97
97
  ```
98
98
 
99
- 工具名称根据 OpenAPI 自动生成:`<method>_<path>`(非字母数字替换为 `_`),例如 `post_v1_public_user_login`。完整列表请见 `mcp.json`。
99
+ 工具名称根据 OpenAPI 自动生成:`<path>`(先移除 `/v1/public/` 前缀,非字母数字替换为 `_`),例如 `user_login`;如有重名会追加请求方式后缀。完整列表请见 `mcp.json`。
100
100
  运行时工具列表同样支持 `APIFOX_PATH_PREFIX` 过滤(未设置时默认 `/v1/public/`)。
101
101
  同一 MCP 进程内,若登录返回 `onAuthToken`,服务会自动缓存并用于后续调用(未显式传 token 时)。
102
102