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

# Cualquier otro cliente

> El protocolo en crudo, para construir tu propio agente de IA.

Todo lo que necesita un cliente, sin cliente.

| | |
| - | - |
| Endpoint | `https://api.minidesk.ai/mcp` |
| Método | `POST` |
| Transporte | Streamable HTTP |
| Versión del protocolo | `2025-06-18` |
| Autenticación | `Authorization: Bearer mdsk_mcp_...` |
| Tipo de contenido | `application/json` |

Las peticiones son JSON-RPC 2.0. Cada llamada es un único POST; no hay sesión
que abrir ni mantener viva.

## initialize

```bash theme={null}
curl -X POST https://api.minidesk.ai/mcp \
  -H "Authorization: Bearer $MINIDESK_MCP_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "jsonrpc": "2.0", "id": 1, "method": "initialize" }'
```

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "protocolVersion": "2025-06-18",
    "capabilities": { "tools": {} },
    "serverInfo": { "name": "minidesk", "version": "1.0.0" }
  }
}
```

## tools/list

```bash theme={null}
curl -X POST https://api.minidesk.ai/mcp \
  -H "Authorization: Bearer $MINIDESK_MCP_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "jsonrpc": "2.0", "id": 2, "method": "tools/list" }'
```

Devuelve cada herramienta con su `name`, `description` e `inputSchema`. La
lista está ordenada por nombre, así que es estable entre llamadas.

Descubre la superficie aquí en lugar de escribirla a fuego. Añadir una
herramienta es un cambio aditivo que podemos hacer en cualquier momento;
cambiar el esquema de una herramienta existente no lo es.

## tools/call

```bash theme={null}
curl -X POST https://api.minidesk.ai/mcp \
  -H "Authorization: Bearer $MINIDESK_MCP_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "tools/call",
    "params": {
      "name": "list_oldest_unanswered",
      "arguments": { "limit": 5 }
    }
  }'
```

El resultado son bloques de contenido MCP. La salida de la herramienta es
JSON dentro de un bloque de texto, que es la forma interoperable: cualquier
cliente puede leerla, y los bloques estructurados aún no tienen soporte
amplio.

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": 3,
  "result": {
    "content": [
      { "type": "text", "text": "{\n  \"as_of\": \"2026-08-28T14:22:10Z\",\n  \"data\": []\n}" }
    ],
    "isError": false
  }
}
```

Así que leer un resultado es interpretar `result.content[0].text` como JSON.

## Errores

Dos capas, y se ven distintas.

Los **errores de protocolo** vuelven como errores JSON-RPC:

| Código | Significado |
| - | - |
| `-32600` | La petición no era JSON-RPC válido |
| `-32601` | Método desconocido |

Los **errores de herramienta** son una respuesta JSON-RPC correcta con
`isError: true`, y el bloque de texto contiene `{ "error": "..." }`. Un
nombre de herramienta desconocido es uno de estos y no un no-op silencioso,
porque un cliente que cree que guardó un borrador y recibió un éxito
silencioso es el peor resultado posible.

Los **errores de transporte** son HTTP normales. Un `401` significa que
falta la credencial, está mal formada, fue revocada o es un token de API en
vez de uno MCP. Un `429` significa que superaste
[el límite de peticiones](https://docs.minidesk.ai/guides/rate-limits.md) y `Retry-After` dice cuándo
volver.

## Un cliente mínimo

```js theme={null}
async function callTool(name, args = {}) {
  const response = await fetch("https://api.minidesk.ai/mcp", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.MINIDESK_MCP_TOKEN}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      jsonrpc: "2.0",
      id: Date.now(),
      method: "tools/call",
      params: { name, arguments: args },
    }),
  });

  if (!response.ok) throw new Error(`HTTP ${response.status}`);

  const { result, error } = await response.json();

  if (error) throw new Error(error.message);

  return JSON.parse(result.content[0].text);
}

const summary = await callTool("get_support_summary");
```

## Con el SDK oficial

Cualquier SDK MCP que hable Streamable HTTP sirve. Apúntalo al endpoint y
pasa la cabecera.

```js theme={null}
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

const transport = new StreamableHTTPClientTransport(
  new URL("https://api.minidesk.ai/mcp"),
  {
    requestInit: {
      headers: { Authorization: `Bearer ${process.env.MINIDESK_MCP_TOKEN}` },
    },
  },
);

const client = new Client({ name: "my-agent", version: "1.0.0" });
await client.connect(transport);

const { tools } = await client.listTools();
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.