# MCP integrations

An **integration** is an HTTP MCP server of yours that you register in your workspace. Meteor validates it, caches its tools and makes them available for your Mets — and your code — to run. It is the self-service way to give your Mets capabilities of their own without waiting for Meteor to ship them.

> **Not to be confused with `mcp.html`.** This guide is about connecting *your* MCP server **to Meteor** (`met.integrations`). The [Meteor as an MCP server](../../mcp.html) guide is the opposite: connecting Meteor **as** an MCP server to Cursor or Claude. Two different directions.

## Register your MCP server

```ts
const met = new Met(process.env.MET_API_KEY, { workspaceId: 42 });

const integration = await met.integrations.register({
  name: 'My CRM',
  endpoint: 'https://mcp.mycompany.com',
  auth_header: 'Authorization: Bearer {token}',
  credentials: { token: process.env.CRM_TOKEN },
});

console.log(integration.id);           // 'int_…' — use it as the key
console.log(integration.tools_count);  // tools discovered
```

On registration, Meteor calls `tools/list` against your `endpoint` to **validate** that it answers and to **cache** its tools. If the server doesn't respond, registration fails.

The `id` it returns is the integration's **`key`**: you use it in `tools`, `execute`, `activate` and `deactivate`.

Secrets go in `credentials` (write-only: they are never returned) and get filled into the `auth_header` template. In the example, `{token}` is replaced by `credentials.token` on every call to your server.

## List and explore tools

```ts
const integrations = await met.integrations.list();

const tools = await met.integrations.tools(integration.id);
for (const t of tools) {
  console.log(t.name, '—', t.description);  // t.input_schema holds the JSON Schema
}
```

## Run a tool

```ts
const result = await met.integrations.execute(integration.id, 'find_customer', {
  email: 'ana@example.com',
});

console.log(result.status);             // 'success'
console.log(result.output);             // whatever your tool returns
console.log(result.execution_time_ms);  // execution latency
```

The `input` is an object that satisfies the tool's `input_schema`. Once registered and active, the integration is also available to the orchestrator: your Mets can call these tools on their own during a [Run](run-mets.html).

## Activate and deactivate

```ts
await met.integrations.deactivate(integration.id);
await met.integrations.activate(integration.id, { credentials: { token: newToken } });
```

`activate` is how you reconnect and, along the way, **rotate credentials**: pass `credentials` to replace the stored secrets.

## Scopes and live mode

- `integrations:read` — list integrations and see their tools.
- `integrations:manage` — register, activate and deactivate.
- `integrations:execute` — run tools.

Integrations always operate against your real server, so use a **live key** (not sandbox).

> **Image generation is already set up.** You don't need to register anything: it is a built-in integration. See [Images](images.html).
