- connect Codex, Claude Code, Kimi, or opencode to Minerva
- authenticate a headless or CI automation that cannot open a browser
- understand what the hosted Minerva MCP server exposes and at which URLs
- choose the right scopes for an agent instead of granting everything
- enable hosted MCP for an organization and decide what agent tokens may do
- diagnose why an agent cannot connect or cannot see the data it expects
MCP access is a per-user credential, not an application key. The organization,
the token’s workspace reach, and its permissions all come from the token
itself, so an agent can only ever do what the person who authorized it may do.
Minerva never accepts an application API key on the MCP endpoints.
Before You Begin
- confirm someone with the Admin role or above has enabled the hosted MCP token policy and allowed the scopes your agents need
- confirm your own team role meets the Minimum team role set in that policy
- install a coding agent that supports remote MCP servers over HTTP
- decide the token’s reach: one workspace, or every workspace in the organization. A pinned token can only ever act in the one it names.
- for headless use, prepare a secrets manager to hold a personal access token
Key Concepts
The Minerva MCP Server
Minerva publishes two resource URLs on the same hostname:
Prefer the read-only endpoint whenever an agent only needs to look things up. It removes the possibility of an accidental write even if a token is broader than it should be, which makes it the right default for an autonomous agent.
You can register both. Most clients allow more than one MCP server, so a common setup is a
minerva entry pointing at the full endpoint for day-to-day work and a minerva-readonly entry for agents you want structurally unable to change anything.
Minerva also serves the OAuth 2.1 authorization server on https://mcp.gominerva.com, so the discovery documents, the authorize and token endpoints, and the signing keys all live on the same host as the MCP endpoint. If your network policy requires an allowlist, one hostname is enough.
Compliant clients discover all of this automatically from
https://mcp.gominerva.com/.well-known/oauth-protected-resource and
https://mcp.gominerva.com/.well-known/oauth-authorization-server. You should
never need to configure an authorization URL, a client ID, or a client secret
by hand: Minerva supports dynamic client registration, so the agent registers
itself on first login.Connect Your Coding Agent
Setup is the same two steps everywhere: register the resource URL, then run the client’s login command and approve the request in the browser.Step 1: Register The Server
Codex, Claude Code, and opencode each write their own manifest entry from the command line. Kimi has no MCP subcommand, so its entry is added to~/.kimi-code/mcp.json by hand.
codex mcp add just writes ~/.codex/config.toml. If you manage your
configuration in dotfiles, add the equivalent block directly instead:https://mcp.gominerva.com/mcp/readonly as the URL. That endpoint advertises only the read-only tool subset, which is the safer default when you are wiring Minerva into an autonomous agent.
Step 2: Sign In
app.gominerva.com, you only have to approve the request.
Step 3: Approve The Request
The consent screen names the client that asked, the workspace the token will act in, and every scope requested.mcp:read is preselected and cannot be deselected, because a token without it cannot discover the tools it may call.
Deselect anything the agent does not need. Scopes explains what each one grants. This is the last point at which you choose, and it is per connection, so a research agent and a case-management agent can hold very different permissions under the same account.
After you approve, Minerva confirms the grant and sends the authorization to your client immediately, then tells you to finish the login in your terminal. A CLI login has just opened its listener and is blocking on it, so the send lands while the client is waiting and the tab hands you back to the client’s own confirmation. The figure below is a Codex login.
The button on that screen is a fallback, not a step: if your client is still waiting, use it to send the authorization again; if your terminal has already printed success, the login is done and the page is simply left over. A client whose return address cannot be verified gets an error screen instead: Authorization not sent. The client is given no access; run the login command again.
Personal Access Tokens
Two kinds of caller need a token rather than a browser sign-in: anything with no browser to open, such as CI jobs, schedulers, and containers, and a developer whose client cannot complete the browser login, which as of July 2026 means Codex on a stable release (see Step 2). For both, create a personal access token and send it as a bearer token. It draws on the same scope catalog as a browser sign-in, with one difference that matters: a personal access token cannot carrymcp:write or offline_access, which only browser consent can grant (see Scopes).
Go to Administration > Developers and open Personal access tokens. The same section is on your account page.
Creating a token asks for:
- a name, so the token is identifiable later in the table
- an expiry in days, up to a maximum of 90
- where this token can act: one workspace, or every workspace in the organization
- the scopes it carries, offered as the intersection of the tenant policy, your team role, and your organization’s entitlements
mcp:read, which is all a default organization policy allows, connects and authenticates normally but can call just two introspection tools, whoami and list_tool_permissions: running searches needs screening:search, and reading profiles needs screening:read.
The organization in this example has already allowed the screening scopes. In one that has not, this list shows Connect and list available tools on its own.
The plaintext token is shown exactly once. Copy it into your secrets manager before closing the dialog; Minerva stores only a hash and cannot show it again.
Send it as a bearer token on the MCP endpoint. Every client sends the same header, whatever its own configuration looks like:
~/.codex/config.toml by hand:
MINERVA_MCP_TOKEN, so whichever one you copy, the export above is the part that has to be in place.
codex mcp list then reports the server as enabled with Bearer token as its auth. That describes the configuration and not the credential: it reads the same whether or not MINERVA_MCP_TOKEN is set.
If the variable is not set in the environment the agent itself runs in, Codex connects nothing and every Minerva tool is missing with no error. Check it there rather than in the shell you registered from.
Do not run codex mcp login on top of this: the token is already the credential, so no browser flow is involved and the client-version problem above does not apply.
codex mcp add writes bearer_token_env_var, which names the variable rather
than storing the token, so the token never reaches ~/.codex/config.toml.
Codex does also accept a literal Authorization value under http_headers,
which puts the token in that file, so prefer the environment variable. Set it
from your secrets manager where you can: typing the export by hand puts the
live token in your shell history. Codex refuses the bearer_token key
outright, with bearer_token is not supported for streamable_http. Whatever
client you use, keep any file that holds a token out of source control.When To Prefer A Token Over The Browser Flow
Admin Enablement
Hosted MCP access is off by default. Before anyone in an organization can connect an agent, someone with the Admin role or above has to turn it on and choose what agent tokens may do. This is the gate that matters, and it is almost always the reason a connection attempt fails. Go to Administration > Configuration > Authentication and open Hosted MCP access. Three settings matter:- Allow users to create hosted MCP personal access tokens is the master switch for the organization; the other two settings only matter once it is on.
- Minimum team role is the lowest team role permitted to hold an MCP token. Defaults to Developer.
- What tokens may do is the complete set of scopes any token in this organization may ever carry, grouped by product area, and explained in Scopes. A new policy allows only
mcp:read.
Leaving Minimum team role at Member while allowing administration
scopes does not widen access, because each scope also carries its own role
floor. The panel names any allowed scopes that sit above the policy minimum.
That is informational, not an error.
Scopes
A token carries an explicit list of scopes. Most need a team role, and some also need an organization entitlement, with one wrinkle for the workspace-scoped ones, described under the table.
Browser consent only means a client can request the scope during browser sign-in, but it can never be put on a personal access token.
mcp:write does not bypass anything: a write it covers still needs whatever entitlement the specific scope needs, so it reaches risk assessments only in an organization that has the agent risk assessment beta, and identity verification only where ID verification is enabled.
How Scopes Are Narrowed
Minerva advertises the whole catalog above, and most agents request everything a server advertises on first login. That is expected and is not an error. Minerva grants the intersection of:- what the agent requested,
- what the tenant token policy allows,
- what your team role and your organization’s entitlements permit.
risk:read and risk:write if the policy and your role allow them. There is no single workspace to check the beta against when the token is issued, so the check happens on each call instead, against the workspace that call names. The same token therefore succeeds in a workspace that has the beta and is refused in one that does not.
A token pinned to one workspace carries them only if that workspace holds the beta. So pinning does not get you more capability: it gets you less, and more predictably. The reason to pin is blast radius, not reach.
Refused risk calls are therefore about the workspace you are calling into, not about the token. See Troubleshooting.
Troubleshooting
In The Browser
Both rate limits key on your source IP, so a shared office or CI egress can trip them without anyone misbehaving. Neither one touches existing tokens, tool calls, discovery, or the authorization step itself: those keep working while new logins are throttled.
A greyed-out Create token button has two different causes, and the message on screen tells you which. This one shows Personal access tokens are disabled for this organization, meaning nobody here has hosted MCP access yet:
And this one shows Personal access tokens require the … role or higher, meaning the organization has enabled it but your own team role sits below the minimum the policy sets, which is a different fix:
And this is the same organization from the admin’s side, where the switch is turned off:
A browser that opens the consent URL without a usable authorization request gets one of two screens, and which one tells you what went wrong.
If the request id is well formed but no longer good (the link expired, or it was already used because the login ran twice), you get the invalid-request screen. Re-run the login command from the client so it starts a fresh request.
If there is no request id at all, or a malformed one (a hand-typed URL, or a link truncated in a chat message), you get an install landing page instead. It repeats the endpoints and carries copy-paste snippets for some clients, but it cannot complete a login on its own, and the commands earlier in this guide are the authoritative set.
From An Agent Call
The three refusal codes an agent can meet (validation_error, workspace_forbidden and entitlement_required) are authorization outcomes, not transport failures. Minerva returns them as ordinary MCP tool results: HTTP 200 with isError: true, and the code, the message, and a retryable flag in the JSON inside content[0].text. A 401 therefore means authentication failed, while these mean the call was understood and refused. validation_error and entitlement_required are never retryable, and neither is a genuine workspace_forbidden refusal: the one retryable case is the service-problem form of workspace_forbidden, which says so in its message and sets retryable: true.
On opencode, two commands help isolate an authorization problem:
Best Practices
- use
https://mcp.gominerva.com/mcp/readonlyfor any agent that does not need to write, instead of relying on scopes alone - grant one connection per purpose rather than one broad connection reused everywhere, so revoking an agent does not disturb the others
- bind tokens to a single workspace unless an automation genuinely spans all of them
- keep the tenant policy as the ceiling you actually intend, and widen it in response to real workflows rather than in advance
- prefer the browser login for people, and reserve personal access tokens for automations that truly cannot open a browser
- store personal access tokens in a secrets manager, never in source control or in an agent configuration file committed to a repository
- schedule rotation before the 90-day ceiling rather than discovering it when a pipeline fails
- review the token table periodically and revoke tokens whose last-used timestamp shows they are no longer needed
- remember that an agent inherits its authorizer’s permissions, so review team roles when someone changes job