連線與驗證
Endpoint
| 用途 | 規範 | URL |
|---|---|---|
| MCP Endpoint | JSON-RPC 2.0 over HTTP | https://api.hanakoi.ai/api/v1/mcp |
| Protected Resource Metadata | RFC 9728 | https://api.hanakoi.ai/.well-known/oauth-protected-resource |
| Authorization Server Metadata | RFC 8414 | https://api.hanakoi.ai/.well-known/oauth-authorization-server |
驗證方式
- OAuth 2.1 access_token(JWT,1 小時有效,30 天 refresh):Claude.ai connector OAuth flow 產物,推薦方式。
- Hanakoi API Key(hk_... 字首):Claude Desktop / Claude Code / 指令碼直連場景,直接放 Bearer header。
API Key 以 hk_ 開頭,請像密碼一樣保管,不要貼到公開的地方。
Claude.ai(Connector)
在 Claude.ai 新增自訂 Connector,填入上方的 MCP Endpoint,依畫面完成 OAuth 授權即可,不需要 API Key。
Claude Code
claude mcp add --transport http hanakoi https://api.hanakoi.ai/api/v1/mcp \
--header "Authorization: Bearer hk_YOUR_API_KEY"
Claude Desktop 與其他客戶端
在客戶端的 mcpServers 設定中加入:
{
"mcpServers": {
"hanakoi": {
"type": "http",
"url": "https://api.hanakoi.ai/api/v1/mcp",
"headers": {
"Authorization": "Bearer hk_YOUR_API_KEY"
}
}
}
}
用 curl 驗證
確認 API Key 有效:
curl -X POST https://api.hanakoi.ai/api/v1/mcp \
-H "Authorization: Bearer hk_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize"}'
列出可用工具:
curl -X POST https://api.hanakoi.ai/api/v1/mcp \
-H "Authorization: Bearer hk_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'