Chloe

Reference

@chloejs/core/connections

A service's MCP server, for an agent's connections.

The connections an agent can list in its connections, to the repo that installs chloe. Google and Resend are not here: their tools say they need them, so an agent that binds one has the connection with nothing to list.

import { mcpConnection } from "@chloejs/core/connections";
connections: [mcpConnection({ name: "github", url, token: process.env.GITHUB_TOKEN })]

Same rule as index.ts: adding a name here is publishing it.

mcpConnectionMcpOptions

mcpConnectionfunction

export function mcpConnection(options: McpOptions): McpConnection

Connects an agent to a service's MCP server. An MCP server is a list of tools that a service offers to models, reached over HTTP. Put the result in the agent's connections, and the agent gets those tools with no code of your own.

chloe asks the server for its tools when the agent loads. If the server does not answer, the agent loads without them and the dashboard says why. Throws at once if name is not one word starting with a small letter.

The tools can do whatever the key allows. Use tools to give the agent only the ones it needs.

connections: [mcpConnection({ name: "github", url: "https://api.githubcopilot.com/mcp/",
  token: process.env.GITHUB_TOKEN, tools: ["list_issues", "get_issue"] })]

connections/mcp.ts:85

McpOptionsinterface

export interface McpOptions {
  /**
   * The connection's name: one word that starts with a small letter, such as
   * `"github"`. It is also the first word of every tool name it adds:
   * the server's `list_issues` becomes `githubListIssues`. Required.
   */
  name: string;
  /** The server's address, from the service's docs. It must speak MCP over HTTP ("Streamable HTTP"). Required. */
  url: string;
  /**
   * The key, sent as `Authorization: Bearer <key>`. Give the key itself, as
   * `process.env.SOME_NAME`, or a function that returns one. The function is
   * called each time chloe talks to the server, which suits keys that expire
   * soon. Not sent if not set.
   */
  token?: string | (() => string | undefined | Promise<string | undefined>);
  /** Other headers to send, for a server that takes its key some other way. */
  headers?: Record<string, string>;
  /** Only these tools, by the server's own names, such as `["list_issues"]`. Default: all of the server's tools. */
  tools?: string[];
  /** What the connection is for, in one line, shown on the dashboard. Default: "The tools <host> publishes for models." */
  does?: string;
}

The options for mcpConnection: which server, its key, and which of its tools to use.

connections/mcp.ts:23