docs: add /mcp endpoint to OpenAPI spec (JSON-RPC, 13 paths)
This commit is contained in:
@@ -514,6 +514,68 @@ paths:
|
||||
m_strTradeTime: 094648
|
||||
m_dCommission: 2.0
|
||||
m_dTradeAmount: 2812.0
|
||||
/mcp:
|
||||
post:
|
||||
summary: MCP 端点(Model Context Protocol,AI 助手接入)
|
||||
description: 'JSON-RPC 2.0 应用协议端点,非 REST 资源接口。
|
||||
|
||||
供支持 MCP 的 AI 客户端(Claude Desktop / Cursor 等)通过 tools/call 调用桥的行情/交易能力。
|
||||
|
||||
支持方法: initialize、notifications/initialized、ping、tools/list、tools/call。
|
||||
|
||||
9 个工具(qmt_kline / qmt_quote / qmt_tick / qmt_instrument / qmt_trading_dates /
|
||||
|
||||
qmt_positions / qmt_asset / qmt_orders / qmt_trades)与各 HTTP 查询接口 1:1。
|
||||
|
||||
请求/响应均为 JSON-RPC 2.0 信封;JSON-RPC 错误(parse/invalid/method not found/
|
||||
|
||||
invalid params/internal)走 HTTP 200;非法 body 走 400 {"detail":...}。
|
||||
|
||||
鉴权: 复用桥 TOKEN(X-Token header 或 ?token=)。
|
||||
|
||||
不做订阅/长连接(实时数据走 HTTP 订阅 + WS /ws 推送)。
|
||||
|
||||
详细设计见 docs/迭代记录/MCP服务.md。
|
||||
|
||||
'
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
description: JSON-RPC 2.0 请求对象(jsonrpc/id/method/params)
|
||||
example:
|
||||
jsonrpc: '2.0'
|
||||
id: 1
|
||||
method: tools/call
|
||||
params:
|
||||
name: qmt_quote
|
||||
arguments:
|
||||
code: 600519.SH
|
||||
responses:
|
||||
'200':
|
||||
description: JSON-RPC 2.0 响应对象(含 result 或 error)
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
description: JSON-RPC 2.0 响应信封
|
||||
example:
|
||||
jsonrpc: '2.0'
|
||||
id: 1
|
||||
result:
|
||||
content:
|
||||
- type: text
|
||||
text: '{"ok": true, "code": "600519.SH", "data": {...}}'
|
||||
'400':
|
||||
description: 非法 body(非 JSON-RPC 格式)
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
example:
|
||||
detail: parse error
|
||||
components:
|
||||
schemas:
|
||||
ErrorResponse:
|
||||
|
||||
Reference in New Issue
Block a user