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

# MCP Tool (voice)

> Connect your voice agent to external tools via Model Context Protocol (MCP) servers it consumes during a call.

# MCP Tool (voice)

The **MCP Tool** turns your voice agent into an MCP *client*. The agent connects to an external MCP server during the call, discovers its tools, and uses them in-flight — for custom business logic, proprietary APIs, or third-party integrations without writing custom tool code.

<Note>
  **This page is about the MCP *client* side — your voice agent *consuming* external MCP servers mid-call.**
  Looking for the other direction? thinnestAI is *itself* an MCP server that Claude Desktop, ChatGPT, and Cursor can talk to. See [MCP Server](/docs/integrations/mcp-server).
</Note>

## How It Works

```
Caller: "Can you check my loyalty points balance?"
Agent: "Let me look that up for you."
-> Agent calls mcp_call with tool_name="get_loyalty_balance"
-> MCP server processes the request and returns the balance
Agent: "You have 2,450 loyalty points, which is worth $24.50 in rewards."
```

## Configuration

```json theme={null}
{
  "mcpServerEnabled": true,
  "mcpServerUrl": "https://mcp.your-company.com",
  "mcpServerApiKey": "mcp_key_...",
  "mcpAutoDiscoverTools": true,
  "mcpAllowedTools": ["get_loyalty_balance", "create_ticket", "lookup_order"],
  "mcpTimeout": 10000
}
```

| Setting                | Type      | Default | Description                                   |
| ---------------------- | --------- | ------- | --------------------------------------------- |
| `mcpServerEnabled`     | boolean   | `false` | Enable MCP integration                        |
| `mcpServerUrl`         | string    | —       | MCP server URL                                |
| `mcpServerApiKey`      | string    | —       | API key for authentication                    |
| `mcpAutoDiscoverTools` | boolean   | `true`  | Auto-discover available tools from the server |
| `mcpAllowedTools`      | string\[] | `[]`    | Allowlist of tool names (empty = allow all)   |
| `mcpTimeout`           | integer   | `10000` | Timeout in milliseconds                       |

## LLM Tool

**Tool name:** `mcp_call`

Call any tool on the connected MCP server.

```
Parameters:
  tool_name: string (name of the MCP tool to call)
  parameters: string (JSON object of parameters)

Returns: JSON result from the MCP server
```

If the tool is not in the allowlist:

```
Returns: "Tool 'tool_name' is not in the allowed tools list."
```

## Security

* **Allowlist:** Use `mcpAllowedTools` to restrict which MCP tools the agent can call
* **Authentication:** The `mcpServerApiKey` is sent as a Bearer token in the Authorization header
* **Timeout:** Configurable per-call timeout prevents hanging calls

## Example — Create Agent with MCP Integration

```bash theme={null}
curl -X POST https://api.thinnest.ai/v1/agents \
  -H "Authorization: Bearer $THINNESTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Loyalty Program Agent",
    "model": "gpt-4o",
    "instructions": "You help callers with their loyalty program. Use the mcp_call tool to check balances, redeem points, and look up order history. Available tools: get_loyalty_balance, redeem_points, lookup_order.",
    "voiceEnabled": true,
    "transcriber": { "provider": "deepgram", "model": "nova-2-conversationalai" },
    "voice": { "provider": "deepgram", "voiceId": "aura-2-thalia-en" },
    "mcpServerEnabled": true,
    "mcpServerUrl": "https://mcp.your-company.com",
    "mcpServerApiKey": "mcp_key_...",
    "mcpAutoDiscoverTools": true,
    "mcpAllowedTools": ["get_loyalty_balance", "redeem_points", "lookup_order"],
    "mcpTimeout": 10000
  }'
```
