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

# heymcp login

> Sign in with GitHub. Opens your browser once.

```bash theme={null}
heymcp login
```

Prints a code, opens your browser, and waits. Approve it and the CLI is signed
in. If you don't have a HeyMCP account, this creates one.

Sign-in is **GitHub only** — there is no password to set or leak.

## How it works

It's an [RFC 8628 device flow](https://datatracker.ietf.org/doc/html/rfc8628),
the same pattern `gh auth login` and smart TVs use:

**1. The CLI asks for a code**

You get a short user code and a URL.

**2. Your browser opens to /activate**

Pre-filled with the code. On a headless box the browser won't open and the
CLI just prints the URL for you to visit elsewhere.

**3. You approve**

Sign in with GitHub if you aren't already, then approve the device.

**4. The CLI receives a token**

Stored at `~/.config/heymcp/config.json` with mode `0600`.

The token is long-lived and stored hashed server-side. It is shown once and
never again.

## In CI

Don't run `heymcp login` in CI. Set the token directly:

```bash theme={null}
export HEYMCP_TOKEN=hm_live_...
heymcp probe localhost:8000
```

Environment always wins over the config file.

> [!TIP]
>
> Use a token you can roll independently, and roll it from your profile page if a
> build log ever prints it.

## heymcp logout

```bash theme={null}
heymcp logout
```

Revokes the token server-side **and** deletes it locally.

Deleting `~/.config/heymcp/config.json` by hand only does the second half — the
token stays valid until you roll it from your profile page. Prefer `logout`.

## Troubleshooting

> [accordion] The browser didn't open
>
> Expected on a headless machine. The CLI prints the URL; visit it from
> anywhere.

> [accordion] The code expired
>
> Device codes are short-lived. Run `heymcp login` again.

> [accordion] Signed in as the wrong account
>
> `heymcp logout`, then `heymcp login`. Check with
> [`heymcp whoami`](https://docs.heymcp.dev/cli/whoami).


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