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

# MCP Servers

> Conecta MCP Servers para acceder a sistemas estandarizados

**MCP (Model Context Protocol)** es un protocolo abierto que permite al agente conectarse a sistemas externos de forma estandarizada. Thaliq actua como gateway MCP, ruteando las llamadas del agente a tus MCP Servers.

<Note>
  Disponible desde **Growth**.
</Note>

## Como funciona

```
Agente Claude
    |
    | Decide usar tool MCP
    v
Thaliq MCP Gateway
    |
    | JSON-RPC 2.0
    v
Tu MCP Server
    |
    | Ejecuta accion
    v
Resultado -> Agente -> Respuesta al usuario
```

## Como llegar

`thaliq.com/agents/:agentId/mcp` (tab MCP del agente). Los MCP Servers son **propios de cada agente** — el server "GitHub MCP" del agente "DevOps" no aparece para el agente "Soporte".

## Agregar un MCP Server

1. Ir a **Agente > MCP**
2. Click en **Agregar MCP Server**
3. Configurar:

| Campo              | Descripcion                                              |
| ------------------ | -------------------------------------------------------- |
| **Nombre**         | Nombre identificativo (ej: `github-mcp`)                 |
| **URL**            | URL del MCP Server                                       |
| **Tipo de auth**   | `none`, `bearer`, `api_key`, `custom`                    |
| **Credenciales**   | Token o API key (encriptadas con AES-256-GCM en backend) |
| **Custom headers** | Headers adicionales para cada request                    |
| **Requires auth**  | Si necesita token del usuario final (passthrough)        |

## Descubrir e importar tools

Una vez agregado el MCP Server:

1. Click en **Descubrir tools**
2. Thaliq llama al MCP Server (`tools/list` JSON-RPC)
3. Selecciona las tools que querias habilitar
4. Click en **Importar**

Las tools importadas aparecen en la tab **Tools** con tipo `MCP_REMOTE`. Heredan los `customHeaders` del MCP Server padre (visibles en readonly).

## Token Passthrough — auth del usuario final

Si tu MCP Server necesita el token del **usuario final** (no del tenant):

1. Marca `Requires auth: Si` en el MCP Server
2. El frontend (widget / SDK) envia el token via header `X-MCP-Tokens`:

```json theme={null}
{
  "github-mcp": "ghp_...",
  "jira-mcp": "eyJh..."
}
```

3. Thaliq rutea cada token al MCP Server correspondiente (por su ID)
4. Los tokens **nunca se almacenan** en Thaliq — son passthrough puro

<Warning>
  Las tools de MCP Servers con `requiresAuth: true` **no estan disponibles en el widget anonimo** (solo via SDK con token o API directa con `X-MCP-Tokens`).
</Warning>

## Custom headers heredados

Los `customHeaders` del MCP Server se heredan a **todas sus tools**. Utiles para:

* Headers de region (`x-country: PE`)
* Versionado (`x-api-version: v2`)
* Identificacion del tenant downstream (`x-tenant-id`)

Las tools MCP muestran los headers heredados como readonly en la UI. Si necesitas override por tool, podes agregar headers extra a nivel tool (precedencia descrita en [Tools > Custom headers](/platform/tools#custom-headers)).

## Seguridad

* **Credenciales encriptadas** con AES-256-GCM antes de persistir
* **Token passthrough** del usuario final no se almacena
* **Aislamiento por agente** — cada agente solo ve sus propios MCP Servers
* **Audit logs** de cada invocacion (en planes Scale+)

## Que sigue

<CardGroup cols={2}>
  <Card title="Tools" icon="wrench" href="/platform/tools">
    Como aparecen las tools MCP una vez importadas.
  </Card>

  <Card title="Studio (Tokens MCP)" icon="key" href="/platform/studio#tokens-mcp">
    Como configurar tokens passthrough en el test panel.
  </Card>
</CardGroup>
