跳至主要内容

連線與驗證

Endpoint​

用途規範URL
MCP EndpointJSON-RPC 2.0 over HTTPhttps://api.hanakoi.ai/api/v1/mcp
Protected Resource MetadataRFC 9728https://api.hanakoi.ai/.well-known/oauth-protected-resource
Authorization Server MetadataRFC 8414https://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"}'

參考規範​