> ## Documentation Index
> Fetch the complete documentation index at: https://docs.thunderphone.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 將 ThunderPhone 作為 MCP 伺服器使用

> 將任何 Streamable HTTP MCP 用戶端連線至 ThunderPhone，以列出智慧體、檢視通話與逐字稿，並使用組織 API 金鑰撥打外撥電話。

ThunderPhone 在以下位置提供 Model Context Protocol 伺服器：

```text theme={null}
https://api.thunderphone.com/v1/mcp
```

將 MCP 用戶端指向該可串流 HTTP 端點，即可將你組織的智慧體和通話作為工具使用。這與[將遠端 MCP 伺服器連線至語音智慧體](/zh-Hant/guides/mcp-servers)的方向相反：

| 方向                            | 結果                                     |
| ----------------------------- | -------------------------------------- |
| 遠端 MCP 伺服器 → ThunderPhone 智慧體 | 你的語音智慧體可以呼叫遠端伺服器的工具。                   |
| ThunderPhone → 你的 MCP 用戶端     | 你的 MCP 用戶端可以呼叫 ThunderPhone 的智慧體與通話工具。 |

## 驗證身分

在 **組織 → 金鑰** 下建立 `sk_live_` 金鑰，並將其作為 Bearer 權杖傳送。MCP 端點接受組織 API 金鑰，不接受控制台工作階段 Cookie 或可公開使用的小工具金鑰。

```json Generic client configuration theme={null}
{
  "mcpServers": {
    "thunderphone": {
      "url": "https://api.thunderphone.com/v1/mcp",
      "headers": {
        "Authorization": "Bearer sk_live_YOUR_API_KEY"
      }
    }
  }
}
```

<Warning>
  `sk_live_` 金鑰可存取組織資料並撥打電話。請勿將其放入瀏覽器程式碼、儲存庫、螢幕截圖或聊天紀錄中。使用 MCP 用戶端支援的祕密儲存區；如果金鑰外洩，請立即撤銷。
</Warning>

## 可用工具

| 工具                    | 引數                                   | 功能                            |
| --------------------- | ------------------------------------ | ----------------------------- |
| `list_agents`         | 無                                    | 列出組織智慧體，包含 id、名稱、產品和語音。       |
| `get_agent`           | `agent_id`                           | 擷取單一智慧體。                      |
| `place_call`          | `agent_id`、`from_number`、`to_number` | 以與 REST 通話端點相同的驗證及計費檢核機制撥出電話。 |
| `get_call`            | `call_id`                            | 擷取通話狀態、摘要和評分。                 |
| `list_calls`          | 選填 `limit`（1–100）、選填 `status`        | 列出最近的通話。                      |
| `get_call_transcript` | `call_id`                            | 擷取通話的完整逐字稿。                   |

所有工具的範圍皆限定於與 API 金鑰綁定的組織。來自其他組織的 id 會被視為不可用。

## 通訊協定方法

此端點實作可串流 HTTP 用戶端所需的 MCP JSON-RPC 方法：

* `initialize`
* `notifications/initialized`
* `tools/list`
* `tools/call`

你可以直接查看工具目錄：

```bash theme={null}
curl -X POST https://api.thunderphone.com/v1/mcp \
  -H "Authorization: Bearer sk_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/list",
    "params": {}
  }'
```

使用工具名稱和引數呼叫工具：

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "list_calls",
    "arguments": { "limit": 20, "status": "completed" }
  }
}
```

工具結果為 MCP 文字內容項目。工具失敗會在結果中以 `isError: true` 傳回；未知的 JSON-RPC 方法會傳回通訊協定錯誤。

## 安全地撥打電話

`place_call` 遵循與
[`POST /v1/call`](/api-reference/outbound-calls)相同的規則：智慧體和號碼必須屬於該金鑰的組織、號碼必須符合撥出電話資格、組織必須有足夠餘額，且任何適用的撥出電話確認程序都必須完成。

將可存取 `place_call` 的用戶端視為正式環境的撥號端。限制可使用該用戶端的人員，在其提示中清楚說明預定使用的智慧體和號碼，並在通話紀錄中檢視通話。

## 完整通訊參考

請參閱 [MCP 伺服器 API](/api-reference/mcp-servers#thunderphone-as-an-mcp-server)，瞭解回應範例、JSON-RPC 錯誤及遠端伺服器管理 API。
