Skip to content

MCP connectors (chat tools)

SleepyAI Chat's agent can call **tools**, and every tool it offers comes from an **MCP connector**.

SleepyAI Chat's agent can call tools, and every tool it offers comes from an MCP connector. That includes the built-in web search — it's just a seeded connector, not special-cased code.

The practical upshot: adding a tool is an admin action, not a deploy.

Where this applies

This is the chat app's tool system (chat.sleepyai.org). The API gateway itself is a separate surface; this page documents what tools the chat agent can invoke and how an admin wires more of them up. See SleepyAI Chat.

How an admin adds a tool

  1. Go to Dashboard → Admin → MCP Connectors.
  2. Add a connector: a name, a slug (the tool namespace), and either a Streamable HTTP endpoint or the built-in search adapter.
  3. Press Test connection — this runs initialize + tools/list and caches the result.
  4. Enable it.

Its tools are advertised on the next chat turn as mcp__<slug>__<tool>.

The connector list is cached in-process for ~15 seconds, so an edit made in one container shows up within that window — no restart needed. The discovered tool list is cached in the database (10-minute TTL) so a user's turn never has to wait on a third-party server.

What's allowed

  • Transports: Streamable HTTP, plus the built-in adapters (web search). stdio is refused — it would execute an admin-supplied command inside the multi-tenant chat container, next to the database URL and the auth secret. Legacy HTTP+SSE is also rejected (superseded by Streamable HTTP).
  • Secrets: connector headers are encrypted at rest (AES-256-GCM, key derived from NEXTAUTH_SECRET). The admin panel sees header names only; values are never logged or sent to a model.
  • Untrusted output: every tool result is wrapped in a nonce-delimited "untrusted data" block before it reaches the model — the same guard the search evidence uses. A page or issue body can't forge the markers.

Budgets & failure isolation

  • Tool rounds (default 8) and tool calls (default 12) per message are set from Dashboard → Admin → Settings → Chat & Agent, along with the tool loop deadline and the whole-turn wall clock — raise them for deep research or for several slow MCP servers. Per-connector timeouts live on the connector itself (Admin → MCP Connectors).
  • A connector that is down contributes no tools for that turn (it keeps its last known tool list) rather than failing the whole message.
  • A call that's over budget still gets an explicit tool result — an unanswered tool call would break the agent's next round.

What the user sees

Connector tool rounds emit no content tokens, so the UI streams tool_started / tool_completed progress frames and renders a live activity list alongside web searches. You see what the agent is doing as it does it.

Next: SleepyAI Chat · Telegram