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

# MCP (Model Context Protocol)

> Conectá herramientas externas a tus agentes usando el estándar MCP.

El **Model Context Protocol (MCP)** es un estándar abierto que permite conectar herramientas externas a modelos de lenguaje de forma segura y estandarizada. Horneross soporta MCP de forma nativa, permitiéndote extender las capacidades de tus agentes.

## ¿Qué es MCP?

MCP define cómo los agentes de IA pueden:

* **Descubrir** herramientas disponibles en un servidor
* **Invocar** herramientas con parámetros validados
* **Recibir** resultados de forma estructurada

<CardGroup cols={2}>
  <Card title="Composio" icon="puzzle-piece">
    +100 integraciones pre-configuradas (Gmail, Calendar, Slack, etc.)
  </Card>

  <Card title="HTTP/SSE" icon="globe">
    Conectá cualquier servidor MCP personalizado
  </Card>
</CardGroup>

## Arquitectura

```
┌─────────────┐      ┌─────────────┐      ┌─────────────┐
│   Agente    │ ──── │  Horneross  │ ──── │ MCP Server  │
│   de IA     │      │   (Client)  │      │  (Tools)    │
└─────────────┘      └─────────────┘      └─────────────┘
                            │
                            ▼
                     ┌─────────────┐
                     │  Composio   │
                     │  (100+ apps)│
                     └─────────────┘
```

## Tipos de MCP soportados

### 1. Composio (Recomendado)

Composio provee +100 integraciones listas para usar:

| Categoría     | Apps                              |
| ------------- | --------------------------------- |
| Email         | Gmail, Outlook, SendGrid          |
| Calendar      | Google Calendar, Outlook Calendar |
| CRM           | HubSpot, Salesforce, Pipedrive    |
| Comunicación  | Slack, Discord, Teams             |
| Productividad | Notion, Airtable, Google Sheets   |
| Desarrollo    | GitHub, Jira, Linear              |

### 2. HTTP Streamable

Servidores MCP accesibles via HTTP con streaming.

```
POST https://tu-servidor.com/mcp
Content-Type: application/json
```

### 3. SSE (Server-Sent Events)

Servidores MCP que usan SSE para comunicación en tiempo real.

## Configurar MCP en un agente

### Via Dashboard

1. Andá a tu agente → **Configuración** → **Herramientas**
2. Click en **"Agregar MCP"**
3. Seleccioná el tipo (Composio o HTTP)
4. Configurá la conexión
5. Seleccioná las herramientas a habilitar

### Via API

```json theme={null}
{
  "name": "Mi Agente con MCP",
  "versionConfig": {
    "modelName": "gpt-4o",
    "tools": {
      "custom_mcp": [
        {
          "name": "gmail",
          "type": "composio",
          "toolkit_slug": "gmail",
          "config": {
            "profile_id": "profile_abc123"
          },
          "enabledTools": [
            "GMAIL_SEND_EMAIL",
            "GMAIL_GET_EMAILS",
            "GMAIL_SEARCH_EMAILS"
          ]
        },
        {
          "name": "mi-servidor",
          "type": "streamable-http",
          "config": {
            "url": "https://mi-servidor.com/mcp"
          },
          "enabledTools": ["tool1", "tool2"]
        }
      ]
    }
  }
}
```

## Descubrir herramientas

Antes de configurar un MCP, podés descubrir qué herramientas ofrece:

```
POST /api/mcp/discover-tools
```

### Request

```json theme={null}
{
  "type": "streamable-http",
  "config": {
    "url": "https://mi-servidor.com/mcp"
  }
}
```

### Response

```json theme={null}
{
  "tools": [
    {
      "name": "send_email",
      "description": "Envía un email a un destinatario",
      "inputSchema": {
        "type": "object",
        "properties": {
          "to": {
            "type": "string",
            "description": "Email del destinatario"
          },
          "subject": {
            "type": "string",
            "description": "Asunto del email"
          },
          "body": {
            "type": "string",
            "description": "Contenido del email"
          }
        },
        "required": ["to", "subject", "body"]
      }
    }
  ]
}
```

## Composio: Configuración

### 1. Crear perfil de conexión

Primero necesitás crear un perfil de Composio con las credenciales OAuth:

1. En el Dashboard, andá a **Settings** → **Integraciones** → **Composio**
2. Click en **"Nueva conexión"**
3. Seleccioná la app (ej: Gmail)
4. Autenticá con OAuth
5. Guardá el `profile_id` generado

### 2. Vincular al agente

```json theme={null}
{
  "custom_mcp": [
    {
      "name": "gmail",
      "type": "composio",
      "toolkit_slug": "gmail",
      "config": {
        "profile_id": "profile_abc123"
      },
      "enabledTools": [
        "GMAIL_SEND_EMAIL",
        "GMAIL_GET_EMAILS"
      ]
    }
  ]
}
```

### 3. Herramientas de Composio disponibles

<Accordion title="Gmail">
  * `GMAIL_SEND_EMAIL` - Enviar emails
  * `GMAIL_GET_EMAILS` - Obtener emails recientes
  * `GMAIL_SEARCH_EMAILS` - Buscar emails
  * `GMAIL_CREATE_DRAFT` - Crear borrador
  * `GMAIL_DELETE_EMAIL` - Eliminar email
</Accordion>

<Accordion title="Google Calendar">
  * `GOOGLECALENDAR_CREATE_EVENT` - Crear evento
  * `GOOGLECALENDAR_GET_EVENTS` - Listar eventos
  * `GOOGLECALENDAR_UPDATE_EVENT` - Actualizar evento
  * `GOOGLECALENDAR_DELETE_EVENT` - Eliminar evento
  * `GOOGLECALENDAR_FIND_FREE_SLOTS` - Buscar disponibilidad
</Accordion>

<Accordion title="Slack">
  * `SLACK_SEND_MESSAGE` - Enviar mensaje
  * `SLACK_GET_CHANNEL_MESSAGES` - Obtener mensajes
  * `SLACK_CREATE_CHANNEL` - Crear canal
  * `SLACK_SEARCH_MESSAGES` - Buscar mensajes
</Accordion>

<Accordion title="HubSpot">
  * `HUBSPOT_CREATE_CONTACT` - Crear contacto
  * `HUBSPOT_GET_CONTACTS` - Listar contactos
  * `HUBSPOT_CREATE_DEAL` - Crear negocio
  * `HUBSPOT_UPDATE_DEAL` - Actualizar negocio
</Accordion>

## Flujo de ejecución

Cuando un agente usa una herramienta MCP:

```
1. Usuario: "Enviá un email a juan@ejemplo.com"

2. Agente detecta la intención → selecciona tool "send_email"

3. Horneross:
   - Valida parámetros con JSON Schema
   - Llama al servidor MCP
   - Recibe resultado

4. Agente formula respuesta:
   "Listo, envié el email a juan@ejemplo.com"
```

## Seguridad

### Autenticación de servidores MCP

Los servidores HTTP pueden requerir autenticación:

```json theme={null}
{
  "name": "mi-servidor-seguro",
  "type": "streamable-http",
  "config": {
    "url": "https://mi-servidor.com/mcp",
    "headers": {
      "Authorization": "Bearer mi_token_secreto",
      "X-API-Key": "key_123"
    }
  }
}
```

### Permisos por herramienta

Podés limitar qué herramientas están disponibles para cada agente usando `enabledTools`:

```json theme={null}
{
  "enabledTools": [
    "GMAIL_GET_EMAILS",     // Solo lectura
    // "GMAIL_SEND_EMAIL"   // Envío deshabilitado
  ]
}
```

## Casos de uso

<CardGroup cols={2}>
  <Card title="Asistente de ventas" icon="handshake">
    * Crear leads en HubSpot
    * Agendar reuniones en Calendar
    * Enviar emails de seguimiento
  </Card>

  <Card title="Soporte técnico" icon="headset">
    * Crear tickets en Jira
    * Buscar documentación en Notion
    * Notificar en Slack
  </Card>

  <Card title="Automatización" icon="robot">
    * Procesar archivos en Drive
    * Actualizar spreadsheets
    * Sincronizar datos entre apps
  </Card>

  <Card title="Productividad" icon="clock">
    * Gestionar tareas en Todoist
    * Organizar notas en Notion
    * Agendar eventos automáticamente
  </Card>
</CardGroup>

## Próximos pasos

<CardGroup cols={3}>
  <Card title="Horneross MCP Server" icon="satellite-dish" href="/developers/mcp/horneross-server">
    Gestioná Horneross desde Claude Code, Cursor y más
  </Card>

  <Card title="Herramientas MCP" icon="wrench" href="/developers/mcp/tools">
    Lista completa de herramientas disponibles
  </Card>

  <Card title="Servidores custom" icon="server" href="/developers/mcp/custom-servers">
    Crear tu propio servidor MCP
  </Card>
</CardGroup>
