# whoami

URL: https://codepanel.ai/docs/mcp-server/whoami

The CodePanel MCP tool that shows your GitHub account, token scopes and subscription state, so an agent knows what it may do and whether reviews can run.

`whoami` tells you which GitHub account your CodePanel connection acts as, which scopes it holds, and whether reviews can run for that account. Call it first, before any write, to learn what the connection may do. It takes no inputs and works with a token of any scope.

## When to call it

- **At the start of a session,** to check the connection is the account you expect and the `scopes` cover the tools you will use ([Scopes](/docs/mcp-server#scopes)).
- **When a write tool says the token lacks a scope.** `scopes` shows what was granted, so you know whether to reconnect with more.
- **Before you push to a repository CodePanel reviews,** to read `subscription`. If `active` is `false`, every review is refused until someone subscribes, and waiting will not change that.
- **When `subscription.plan.allowance` is `near`, `grace` or `paused`.** `nextAction` carries the notice to pass to the account's owner.

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |


It only reads: the server marks it `readOnlyHint: true`, so clients that ask before a write can run it without asking.

The tool has no inputs. It needs no scope: any valid token or sign-in can call it, including one that holds only `read`.

## What it returns

| Field | Meaning |
| --- | --- |
| `githubUsername` | The GitHub login of the account, or `null` if none is stored |
| `token` | The name of the token or connected app |
| `scopes` | Every scope the connection holds. Operators with admin rights see `admin` here too |
| `subscription.required` | Whether this deployment needs a subscription before it reviews anything |
| `subscription.active` | `true` when reviews can run. `false` without a subscription. `null` when CodePanel could not read it. Always `true` where none is required |
| `subscription.plan` | `null` without a plan. With one: `id`, `name`, `prsPerMonth`, `prsThisMonth`, `allowance`, `concurrentRounds`, the fee-free credit fields and `grandfathered` |
| `subscription.nextAction` | What to pass on to the account's owner, or `null` when there is nothing to do |

`allowance` is `within`, `near`, `grace` or `paused`. At `paused`, new pull requests are refused with `plan_limit` until the first of the month. Subscribing and choosing a plan happen in the browser, so your agent reports `nextAction` and does not try to act on it. The fields are the same as [`GET /me`](/docs/api#get-me).

A failed subscription lookup does not fail the call. `whoami` answers with `active: null` so you can still read the account and scopes.

## Examples

These responses come from a test account on a local backend.

```json title="Call"
{}
```

```json title="Result"
{
  "githubUsername": "codepanel-dev",
  "token": "docs samples all",
  "scopes": [
    "read",
    "repos:write",
    "panel:write",
    "reviews:write",
    "budget:write"
  ],
  "subscription": {
    "required": false,
    "active": true,
    "plan": null,
    "nextAction": null
  }
}
```

This deployment does not require a subscription (`required: false`), so `active` is `true` with no plan. A deployment that bills returns the `plan` object here.

## The same step without MCP

| Surface | Form |
| --- | --- |
| CLI | `codepanel whoami` ([CLI](/docs/cli#sign-in)) |
| HTTP API | [`GET /me`](/docs/api#get-me) |

## What the server tells your agent

The description your agent reads when it lists the tools:

> The GitHub account and scopes of the configured CodePanel API token, and its subscription: when subscription.active is false, reviews are refused until the person subscribes at subscription.nextAction. subscription.plan gives the plan, its pull requests this month (prsThisMonth of prsPerMonth) and allowance (within, near, grace, paused); when paused, new pull requests are refused with plan_limit until the 1st.

## Related

- [`list_repos`](/docs/mcp-server/list_repos): the next check, which repositories are connected.
- [`connect_repo`](/docs/mcp-server/connect_repo): needs the `repos:write` scope that `whoami` shows.
- [Billing](/docs/billing#plans): what the plans allow.
- [MCP server](/docs/mcp-server#check-the-connection): the full connection check.
