# Connect your agent

> Connect Claude Code or another MCP client to your organization's records and operations.

Your own agent, such as Claude Code, can find, read, and change your organization's records through
the same Queries and Actions people use, under the same permissions and policies.

## Before you start

You need:

- The **Admin** role in your organization. Only administrators create service accounts and issue
  API keys.
- An MCP client that can send an `Authorization` header to a remote server. Continual does not run
  an OAuth flow for MCP.

## Get an API key

<Steps>
  <Step title="Open Settings › Service accounts">
    Choose **Add service account**.
  </Step>
  <Step title="Name the account and choose its kind">
    Enter a **Name**, such as "Claude Code". For **Kind**, choose **Agent**.
  </Step>
  <Step title="Choose a role">
    The **Role** decides what your agent can read and change. Then choose
    **Add**.
  </Step>
  <Step title="Copy the key">
    Choose **Copy and close**. The key starts with `cos_`, and Continual shows
    it only once. Store it somewhere safe.
  </Step>
</Steps>

Give each agent its own service account. Its changes are then attributed to it, and you can revoke
its key on its own.

<Callout type="warning">
  An app's roles that everyone gets, such as Sales **Member**, never reach a
  service account. A service account given **Member** reaches no deals or
  projects until you add app roles: on its row in **Settings › Service
  accounts**, open the menu and choose them under **Apps**.
</Callout>

## Connect your agent

Your MCP endpoint is your Continual address followed by `/api/mcp`. **Settings › MCP** shows your
exact endpoint.

<Tabs>
  <Tab title="Claude Code">
    Run this command, with your endpoint and key:

    ```bash
    claude mcp add --transport http continual "https://<your Continual address>/api/mcp" \
      --header "Authorization: Bearer $CONTINUAL_API_KEY"
    ```

  </Tab>
  <Tab title="Other MCP clients">
    Add a remote MCP server with these settings:

    | Setting   | Value                                      |
    | --------- | ------------------------------------------ |
    | URL       | `https://<your Continual address>/api/mcp` |
    | Transport | Streamable HTTP                            |
    | Header    | `Authorization: Bearer cos_…`              |

  </Tab>
</Tabs>

## Tell your agent how to work

Copy this prompt into your agent, or into its instructions file, such as `CLAUDE.md`.

<AgentPrompt title="Work with Continual">
You are connected to Continual, our business's system of record, through the `continual` MCP server.

Before you change anything, find the operation with `model_operations_list`, then read its input with
`model_operations_get`. Run it with its own tool, such as `sales_deals_list`, or with
`run_operation`. To understand a kind of record, such as a deal, use `model_objects_get`. To find
records, use `records_search` and `records_batchGet`.

If a call fails with `APPROVAL_REQUIRED`, a policy holds it for a person. Run `approvals.request` to
ask for approval, tell me what you asked for, and wait. When a result includes links to records,
give them to me so I can open them.

</AgentPrompt>

## What your agent can do

The server offers every Query and Action as a tool named by its ID, such as `sales_deals_list`.
These find and read what the agent needs:

| Tool                    | What it does                                                 |
| ----------------------- | ------------------------------------------------------------ |
| `model_operations_list` | Finds operations by keywords, such as "list deals"           |
| `model_operations_get`  | Returns one operation's input schema                         |
| `model_objects_get`     | Returns a kind of record's fields, relations, and operations |
| `records_search`        | Finds records by text                                        |
| `records_batchGet`      | Reads records by ID                                          |

A client that cannot hold that many tools connects to `/api/mcp?tools=discovery`, which offers
these and `run_operation`, which runs any operation by ID. See [MCP](/docs/developers/mcp).

Each call runs as the service account. Its role decides what the agent reaches, and finding an
operation does not grant it. By default, an **Agent** account's commits and deletions, such as
issuing an invoice, wait for a person to approve them. A commit is a change the business is bound
by. See [approvals and
policies](/docs/concepts/approvals).

<Callout type="note">
  The MCP server runs only the calls your agent makes. It does not schedule your
  agent or run work in the background.
</Callout>

## Next steps

<Cards cols={3}>
  <Card title="MCP reference" href="/docs/developers/mcp" icon="plug">
    Every tool, and every operation as its own tool.
  </Card>
  <Card title="API reference" href="/docs/developers/api" icon="code">
    Call the same operations over REST.
  </Card>
  <Card
    title="Approvals and policies"
    href="/docs/concepts/approvals"
    icon="shield"
  >
    Decide what your agent may do alone.
  </Card>
</Cards>
