MGS9001: bearer token rejected
The server received a request on a guarded route (/mcp, the console data
services) carrying a bearer token it would not accept, so it answered 401 unauthorized with WWW-Authenticate: Bearer realm="magus", error="invalid_token".
This is the most common reason an MCP client (Claude Code, an IDE, Desktop)
fails to connect.
[MGS9001] the server rejected the bearer token: it is wrong, expired, or
revoked. Mint one with: magus config mcp connector create, or magus config
console token create
see: .../MGS9001.md
Why
Every guarded route requires a bearer token. The server does NOT say why it
refused one (that would let a caller probe which tokens exist), so any of these
produces the same 401:
- Wrong token (a typo, or a token from a different server).
- Expired token (every stored token expires, at most 366 days out).
- Revoked token (revoked from the CLI or the console Settings).
- Wrong class for this listener: a share link's
mgl_token on the loopback server, or any other token on a share link's listener. - Minted by an older magus: a token from before the class prefix. Mint a new one (MGS9016, MGS9017 name the files).
A request that carried no token at all is MGS9011 instead, and a valid token whose grant is below the route's need is MGS9015.
Resolution
-
Mint a connector token and read how to wire it into your client:
magus config mcp connector create --name my-client -
Confirm the token your client sends matches one the server knows:
magus config mcp connector lsA token you expect but do not see was revoked or belongs to another server.
-
If it is present but still rejected, it may be expired: mint a fresh one (there is no renew by design).
What this is NOT
- Not a network error. The server answered; it declined the token. A refused connection or timeout is a different problem (server not running, wrong port).
- Not a missing grant. A valid token without the grant a route needs gets
403MGS9015.
See also
- Tokens and grants
magus config mcp connector: mint, list, and revoke connector tokens.