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

# connect

> One-command bridge that pairs a project MCP endpoint with an auth token for an external agent.

`machina connect` is the **one-command bridge** that lets an external agent (e.g. [sportsclaw](/cli/commands/loop#related)) talk to a project's [MCP endpoint](/cli/commands/mcp) — it resolves the endpoint and pairs it with an auth token, ready to register, without a hand-pasted URL or key.

## Usage

```text theme={null}
machina connect [project_id] [--reveal] [--probe] [--name <n>] [--mint [--org <id>]] [--json]
```

| Arg / flag     | Purpose                                                                                          |
| -------------- | ------------------------------------------------------------------------------------------------ |
| `project_id`   | Project to connect (defaults to the selected project).                                           |
| `--reveal`     | Show the auth token (**masked by default**).                                                     |
| `--probe`      | Verify the SSE endpoint is reachable before handing it out.                                      |
| `--name`, `-n` | Server name for the agent (defaults to the project id; coerced to `^[A-Za-z0-9_-]+$`).           |
| `--mint`       | Reuse or **create a dedicated `sportsclaw-<project>` project API key** for a durable connection. |
| `--org`, `-o`  | Organization ID for `--mint` (defaults to the selected org).                                     |
| `--json`, `-j` | Machine-readable output (add `--reveal` to include the token).                                   |

## Examples

```bash theme={null}
# resolve + verify the connection for the selected project (token masked)
machina connect --probe

# durable connection: reuse/mint a dedicated project key and reveal it
machina connect <project-id> --mint --reveal

# JSON for scripting an agent's server registration
machina connect <project-id> --mint --reveal --json
```

## What you get

* The **MCP URL**, **transport** (`sse`), and **auth header** (`X-Api-Token`) — the same derivation as [`machina mcp url`](/cli/commands/mcp).
* A **token** paired to that endpoint. By default the ambient session/API-key credential; with `--mint`, a durable dedicated **`sportsclaw-<project>`** project API key (reused if it already exists, minted if not — so the connection survives your session expiring).

<Warning>
  The token is **masked** unless you pass `--reveal`. Treat a revealed token as a live credential — it grants access to the project's MCP surface. `--mint` keys are scoped per project and named `sportsclaw-<project>`; manage them with [`machina credentials`](/cli/commands/credentials).
</Warning>

## Related

* [`mcp url`](/cli/commands/mcp) — the raw endpoint resolver (no token pairing).
* [`credentials`](/cli/commands/credentials) — list/revoke the project API keys (`--mint` reuses these).
