mcp接口增加分页

This commit is contained in:
andy committed 2026-09-06 17:57:58 +08:00
1 parent 7243319bbb
commit 7f4adad7b1
16 files changed
+1157 -281

No files matched your search

@@ -488,11 +488,18 @@ curl --fail \
-H "Authorization: Bearer $MCP_BEARER" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
--data '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"fire_safety_search_place_candidates","arguments":{"place_name":"观水镇","limit":3}}}' \
--data '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"fire_safety_search_place_candidates","arguments":{"place_name":"观水镇","limit":1,"offset":0}}}' \
'https://agent.nianxx.com/mcp'
curl --fail \
-H "Authorization: Bearer $MCP_BEARER" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
--data '{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"fire_safety_search_place_candidates","arguments":{"place_name":"观水镇","limit":1,"offset":1}}}' \
'https://agent.nianxx.com/mcp'
~~~
确认第一步固定返回 `result.protocolVersion: 2025-06-18`,第二步返回 HTTP 202,第三步列出 7 个固定工具,第四步至少完成一个受控只读 `tools/call`。这四步 `initialize` → `notifications/initialized` → `tools/list` → `tools/call` 才是 SuperAgent 能调用消防 MCP 的验收链路;只看到 initialize 成功不能宣称接通。版本 Header 不需要配置或继续携带。再用无敏感信息的已知地名/点位做少量只读调用,核对正确 Bearer 成功、错误/缺失 Bearer 为 401、warnings 保留、非法参数不会变成任意 SQL。查询到资源记录不代表实时可用、路线已规划或正式集结点。
确认第一步固定返回 `result.protocolVersion: 2025-06-18`,第二步返回 HTTP 202,第三步列出 7 个固定工具,第四、五步完成同一受控查询的相邻分页。两页应分别回显 `limit=1`、`offset=0/1`,`total_count` 应一致,`result_count` 为当前页数量;第一页 `has_more=true` 时 `next_offset` 应为 `1`,第二页不得重复第一页记录。只有完整的 `initialize` → `notifications/initialized` → `tools/list` → `tools/call` 才能证明 SuperAgent 能调用消防 MCP;只看到 initialize 成功不能宣称接通。版本 Header 不需要配置或继续携带。再用无敏感信息的已知地名/点位做少量只读调用,核对正确 Bearer 成功、错误/缺失 Bearer 为 401、warnings 保留、非法参数不会变成任意 SQL。查询到资源记录不代表实时可用、路线已规划或正式集结点。
完成 MCP 测试后清理当前 shell 中的临时变量: