# Connect an agent or a script

> Create a token in memex for a coding agent, an agent you run yourself, or a script.

Page: https://docs.memex.tools/connect-agent

Use a token for anything that can't complete a browser sign-in: a coding agent, an agent you run yourself, or a script.

### 1. Create a connection
In memex, open **Settings › Assistants**, press **Connect an assistant** and choose **Other**. Give the connection a name you will recognise later and press **Create token**.

![Settings › Assistants, with every connection and when it was last used](https://docs.memex.tools/images/assistants.jpg)

### 2. Copy the token
Copy the token and keep it private. **Copy token**, in the connection's **Actions**, copies it again later.

### 3. Add it to your agent
Add memex as an MCP server at `https://memex.tools/mcp`. The agent sends the token with every request, as the header `Authorization: Bearer <your token>`.

> **Self-hosted memex**
>
> The address is `http://localhost:8080/mcp`, or the one you gave memex, and a shell command can make the token. See [Connect assistants to self-hosted memex](https://docs.memex.tools/self-hosted-connect).

> **Note**
>
> A new connection is an agent: what it writes waits for your approval. See [Agent or curator](https://docs.memex.tools/agents-and-curators).

## Next steps

- [Check that it works](https://docs.memex.tools/check-connection): One question that shows whether an assistant reaches your memex.
- [Make a curator](https://docs.memex.tools/make-a-curator): Let one assistant save new notes and edits without waiting for your approval.

> **Tip:** Name each connection after the agent that uses it. The name is what you see beside everything it writes.

## Related

- [Connect an assistant](https://docs.memex.tools/connect): The address every assistant connects to, and which steps to follow for yours.
- [Agent or curator](https://docs.memex.tools/agents-and-curators): What an assistant may change without you, depending on its role.
- [Check that it works](https://docs.memex.tools/check-connection): One question that shows whether an assistant reaches your memex.
