不限语言/框架。下面是 cURL 示例:
1. 初始化握手
curl -X POST https://api.clawhas.com/api/mcp/v1/rpc \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {}
}
}'
2. 列出工具
curl -X POST https://api.clawhas.com/api/mcp/v1/rpc \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list"
}'
3. 调用工具(搜酒店)
curl -X POST https://api.clawhas.com/api/mcp/v1/rpc \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "search_hotels",
"arguments": {
"city": "深圳",
"district": "南山区",
"max_price": 300
}
}
}'