ChloeGet Started

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

One MCP server, for an agent's connections. Nothing is asked of it until the agent loads.

connections/mcp.ts:65

McpOptionsinterface

export interface McpOptions {
  /** What it is called, and the first word of every tool it brings: `github`. */
  name: string;
  /** The server's address, which the service's docs give. Streamable HTTP. */
  url: string;
  /**
   * The key, sent as `Authorization: Bearer`. Either the key, handed over as
   * `process.env.SOME_NAME`, or a function that fetches one when it is needed,
   * for a key kept somewhere that hands out short-lived ones.
   */
  token?: string | (() => string | undefined | Promise<string | undefined>);
  /** Other headers the server wants, for a service that does not take a bearer key. */
  headers?: Record<string, string>;
  /** Only these of the server's tools, by the server's own names. Unsaid is all of them. */
  tools?: string[];
  /** What it is for, in one line, for the setup page. */
  does?: string;
}

What mcpConnection is given: which server, its key, and which of its tools.

connections/mcp.ts:23