# Connect an agent

Your agent works on documents through one MCP address of your environment. Every agent takes the same steps:

1. **Get a token.** Your backend signs it, as [Authentication](authentication.md) shows. The token names the documents that the agent may reach, and what it may do there.
2. **Connect to the [MCP address](set-up.md#find-the-mcp-address).** The client sends the token with each call. [Connect your client](https://help.cke-cs.com/toolkit/v1/docs#section/Connect-an-agent-over-MCP/Connect-your-client) in the API reference shows how to set this up in Claude Code, Cursor, the Claude Agent SDK, and other clients.
3. **Open a session on a document.** The agent opens the session itself, or your backend opens it for the agent.
4. **Read and edit the document with the tools.** The MCP server tells the agent how to use each tool. [The tools](https://help.cke-cs.com/toolkit/v1/docs#section/Tools) in the API reference lists every tool.
5. **Apply the edits, and close the session.** The agent or your backend applies them. [Who writes into the document, and when](https://help.cke-cs.com/toolkit/v1/docs#section/How-a-session-works/Who-writes-into-the-document-and-when) in the API reference explains the options.

[How Coauthor works](how-it-works.md) explains what happens in each step.

The type of document changes how the session opens and how the edits are applied. See [Document types](document-types.md).

<a id="check-the-connection"></a>

## Check the connection

Start with a small job: ask the agent for the headings of a document. The agent opens a session, reads the document, and lists the headings. If it does, the token, the session, and your editor bundle work.

If a call fails, the answer says what went wrong. [Errors](https://help.cke-cs.com/toolkit/v1/docs#section/Errors/Codes) in the API reference lists every error. If the agent is done but the document has not changed, nobody applied the edits.

<a id="next-steps"></a>

## Next steps

* **[Use cases](../../../../../ckeditor5/latest/features/editing-toolkit/editing-toolkit-coauthor.md#when-to-use-coauthor)** in the CKEditor 5 documentation show the ways to use Coauthor.
* **[Security and compliance](security-and-compliance.md)** describes how your documents stay yours, and the guardrails for your agent.
* **[API reference](reference.md)** links to the full reference, and shows how to build an agent that follows changes during Early Access.

---

Full index of the Cloud Services documentation: [llms.txt](../../../../llms.txt)
