> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alignr.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Link source clients with MCP

> Match an existing PSA or RMM remote record to an existing Alignr client with a recoverable first link.

Use this workflow when a connected PSA or RMM already has a remote-company record and Alignr already has the corresponding Organization. One first link associates those existing records so a later source collection can attribute new evidence to the selected client. Linking does not import people, collect devices, move historical facts or run an assessment.

> [!NOTE]
>
> Check the [live MCP reference](https://docs.alignr.io/api-reference/live-schema.md) for `list_source_client_mappings` and `link_source_client` before use.

## Prepare a user-owned key

In **MCP → + Generate token**, grant `integration:read` for discovery and `integration:map` for the first link. The key's active owner must currently hold `integration.read` and `integration.manage`, respectively, with no required password change. A service key can read when granted `integration:read`, but cannot link. Add `organization:read` if your assistant will use `list_organizations` to find the existing client ID.

REST uses the separate dot-separated scopes `integration.read` and `integration.manage`; see the [REST linking guide](https://docs.alignr.io/api-reference/link-source-clients.md).

## 1. Choose the source and exact records

First find the connection ID with `list_evidence_sources`, then call `list_source_client_mappings` for that exact `integration_id`:

```json theme={null}
{"integration_id":"11111111-1111-4111-8111-111111111111","assignment":"unassigned","limit":25,"offset":0}
```

The supported first-link sources are ConnectWise Manage, HaloPSA, Autotask, Datto RMM and NinjaOne. Microsoft client selection and built-in domain mappings have separate workflows. Mapping discovery reads **persisted** records; it does not call the vendor or create a record. If the intended remote record is absent, complete the connector's client-directory setup in Alignr and return here.

The result includes `id` (the mapping UUID), `remoteId`, display-only `remoteName`, `organizationId` (null when unassigned) and `revision`. You can filter by exact `remote_id` or `organization_id`. Pages are ordered by remote name and mapping UUID, with `limit` 1–50 and `offset` 0–10,000. The revision is short-lived and bound to the calling key, source and exact mapping state. It is not a credential, and it cannot be reused by another key.

Find the intended **existing** Organization UUID using `list_organizations` or the Clients page. Confirm the remote ID as well as the displayed name; similar names can refer to different vendor records. A client in another MSP workspace is never a valid target.

## 2. First-link once

Save one new canonical UUID for this exact intention, then call `link_source_client` with the discovered mapping ID, chosen client ID and current revision:

```json theme={null}
{"integration_id":"11111111-1111-4111-8111-111111111111","mapping_id":"22222222-2222-4222-8222-222222222222","organization_id":"33333333-3333-4333-8333-333333333333","revision":"<revision from discovery>","idempotency_key":"44444444-4444-4444-8444-444444444444"}
```

A new success returns a receipt with `id`, `integrationId`, `mappingId`, `organizationId`, `remoteId`, `outcome: linked` and `replayed: false`. If the response times out, repeat **the same key and identical arguments**. A committed link returns the same receipt with `replayed: true`, even if that source or client was later deleted. Reusing a key for a different payload is refused. Do not make a fresh key to blindly retry an uncertain link.

Only an unassigned record can be linked this way. The server refuses a stale or expired revision, a running source collection, a changed source or remote identity, an archived client, or a record already assigned to another client. Read fresh mappings and resolve the reason before trying a new intention. This tool cannot unlink or reassign a record; use the signed-in mapping controls and your normal review process for those changes.

## 3. Collect and assess separately

If you intend to collect evidence, follow [Refresh evidence with MCP](https://docs.alignr.io/mcp/refresh-evidence.md). Its `request_source_refresh` operation covers **all clients mapped to that connection**, not just the client you linked. `completed` means that exact collection finished; inspect new facts and run or read a separate assessment before reporting control status. Missing or stale evidence never counts as passing.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.