> ## 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.

# CLI reference

> Global flags, exit codes, configuration and environment.

```
heymcp — Share a local MCP server with agent clients, and watch what they do
```

| Command | What it does |
| - | - |
| [`heymcp login`](https://docs.heymcp.dev/cli/login) | Sign in with GitHub. Opens your browser once. |
| [`heymcp logout`](https://docs.heymcp.dev/cli/login#heymcp-logout) | Forget this machine's CLI token. |
| [`heymcp share`](https://docs.heymcp.dev/cli/share) | Open a tunnel to a local MCP server and stay attached. |
| [`heymcp probe`](https://docs.heymcp.dev/cli/probe) | Run the handshake and checks against a local server. No public URL. |
| [`heymcp sessions`](https://docs.heymcp.dev/cli/sessions) | List your recent sessions. |
| [`heymcp export`](https://docs.heymcp.dev/cli/export) | Export a session's tool calls. |
| [`heymcp whoami`](https://docs.heymcp.dev/cli/whoami) | Show who this CLI is signed in as. |
| [`heymcp version`](https://docs.heymcp.dev/cli/whoami#heymcp-version) | Print the installed version. |

## Global flags

**--json**

Machine-readable output on every command. Use this when scripting.

**--no-color**

Never colour the output. The `NO_COLOR` environment variable does the same.

## Exit codes

Every command exits meaningfully, so the CLI is scriptable and works in CI.

| Code | Meaning |
| - | - |
| `0` | Everything worked. |
| `1` | `probe` found warnings, and nothing worse. |
| `2` | `probe` found failures, or the server was unreachable. |
| `3` | The command could not run at all — bad input, not signed in, no network. |

`1` and `2` are `probe`'s verdict on your server. Other commands exit `0` on
success and `3` on failure; they don't use `1` or `2`.

The `1` / `2` split is what makes `heymcp probe` useful as a CI gate: fail the
build on `2`, and decide separately whether warnings should block.

```bash theme={null}
heymcp probe localhost:8000 || [ $? -eq 1 ]   # fail only on real breakage
```

## Configuration

The CLI stores its token at:

```
~/.config/heymcp/config.json
```

Written with mode `0600`. Set `HEYMCP_CONFIG_DIR` to move it.

The token is masked wherever it's displayed — `hm_live_••••••••••••4k2x`.

## Environment variables

Environment always wins over the config file.

**HEYMCP\_TOKEN** `string`

Your CLI token. Set this in CI rather than running `heymcp login` there.

**HEYMCP\_BEARER** `string`

The bearer token for `heymcp share --bearer`. Keeps it out of your shell
history.

**NO\_COLOR** `any`

Disables colour, like `--no-color`.

**HEYMCP\_CONFIG\_DIR** `path` (default: \~/.config/heymcp)

Where the config file lives.

**HEYMCP\_APP** `url` (default: [https://app.heymcp.dev](https://app.heymcp.dev))

The control plane. Only relevant for self-hosted deployments.

**HEYMCP\_RELAY** `url` (default: wss\://relay.heymcp.dev/agent)

The relay endpoint. Only relevant for self-hosted deployments.

## Specifying a target

`share` and `probe` both take a target, and both accept the same shapes:

| You type | It means |
| - | - |
| `8000` | `http://127.0.0.1:8000` |
| `:8000` | `http://127.0.0.1:8000` |
| `localhost:8000` | `http://localhost:8000` |
| `myapp.test` | `http://myapp.test` |
| `myapp.test:8080` | `http://myapp.test:8080` |
| `http://127.0.0.1:3000` | Exactly that |
| `https://myapp.test/api` | Exactly that, including the path |

The default path is `/mcp` unless the target carries one or you pass `--path`.

> [!WARNING]
>
> **A bare hostname defaults to `http`, and is never silently upgraded.** Herd and
> Valet serve secured sites over **HTTPS**, so for those you must write the scheme
> yourself:
>
> ```bash theme={null}
> heymcp share https://myapp.test
> ```
>
> Guessing here was deliberately avoided, because a wrong guess produces a
> confusing timeout rather than a clear error.

Self-signed certificates on those local hosts are accepted deliberately — a
local dev certificate is not a security boundary, and refusing it would just
mean nobody could share a Herd or Valet site.


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