Skip to content
Status

Identity / Authorizing agents

Authorizing agents

Create an agent identity, choose the servers it can reach, give it a credential, connect its runtime, and verify the first call. Covers rotation, revocation, MCP session consent, and effective permissions.

An agent identity lets an automated agent, such as a release bot or a CI job, connect to MCP servers under its own name instead of a person’s credentials. A person chooses which servers the agent can reach and gives it a credential. Every call the agent makes is then attributed to the agent, and its access can be cut off without touching anyone else’s.

For the agent lifecycle after creation, see Agent identity.

Any organization member can create an agent and becomes its owner. Authorizing an agent owned by someone else requires the agent:authorize scope from Roles and Permissions.

Open Identity > Agents in the project sidebar and select New agent identity. To set up Claude Tag instead, select Set up Claude Tag, which opens the same wizard with the platform already chosen. See Set up Claude Tag with workload identity.

The Agents page with the New agent identity and Set up Claude Tag buttons

The wizard has five steps. A summary panel beside it tracks the choices made so far, and each step has its own address, so a step can be linked or reloaded.

Every call the agent makes is recorded under this name, so pick one that says whose work it is doing. An audit log entry or a live session should be recognisable without looking the agent up.

The Name step of the agent wizard

The agent belongs to the project it’s created in. That isn’t a question the wizard asks: the servers you select on the next step decide what it can reach, and the project binding follows from where you made it. The name can be changed later with Edit on the agent.

Select the MCP servers the agent can connect to. Each selected server grants mcp:connect on it. The agent reaches nothing else, and never more than you can reach yourself.

The Server selection step with two servers selected

All servers is the alternative to a list. It grants a single wildcard rule covering every server in the agent’s project, including ones added after this is saved, rather than naming today’s inventory. Turning it off replaces that rule with whatever is ticked.

Servers that authorize each person separately can’t be selected here, because an agent has no person behind it. They’re listed under Unavailable servers, with a link to that server’s identity setting. To let an agent use one, connect an account for it from the agent’s Credentials section.

On the Agent sign-in step, choose how the agent proves who it is:

  • API key works in any runtime. The key is long-lived and can be replaced or revoked. API keys expire after 90 days by default and after one year at most. The agent’s first key, issued here, can also send hook events when the agent was created with that permission. Keys issued later from the agent’s page reach MCP servers only.
  • A platform card, such as Claude Tag, GitHub Actions, or GKE, trusts the token that platform already signs for each run, so no Speakeasy secret is created. Tokens are short-lived and there’s no refresh token.
  • Custom OIDC issuer, under Advanced: trust another platform’s tokens, does the same for any other OIDC issuer.

Platform cards and custom issuers need permission to manage workload identities, and each adds its platform’s setup steps to the wizard. See Workload identity. For GitHub Actions jobs that run Claude Code or Codex, see Connect GitHub Actions jobs with workload identity.

With API key chosen, select Create agent. The agent is created and the action is recorded in the organization audit log.

The Install step connects the agent’s runtime to its gateway URL, which puts every selected server behind one endpoint. It offers three ways in. A workload is signed in by its own platform instead, so there’s no key to install: see Exchange a platform token.

The Install step showing the one-line setup command

One-line setup suits runtimes with a shell, such as CI runners and machines that run Claude Code, Codex, or OpenClaw. Run the command the step shows once on the machine the agent lives on. It fetches a short script from https://ai.speakeasy.com/agent-mcp/install/SETUP_CODE and runs it.

The script exchanges the setup code for the agent’s API key, configures each of those clients it finds on PATH with the agent’s gateway, reports what it configured, and exits non-zero if it found no client. The code can be used again until it expires after 15 minutes. Select Regenerate for a new one. For Cursor and other clients, use the Manual tab.

Read the script before running it

Running a fetched script runs whatever the deployment returns. To read it first, save it to a file and run that file instead. Delete the saved file once it has run, because it carries the key.

Manual shows the API key once, with a ready-made configuration block per client. The blocks name the key rather than carry it, reading it from SPEAKEASY_AGENT_KEY in the environment, so they’re safe to paste into a repository.

Programmatic suits agents built on an SDK. The endpoint speaks MCP over HTTP, so any SDK that takes an MCP server takes this one. Read the key from a secret store and never commit it:

import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
const transport = new StreamableHTTPClientTransport(
new URL("https://ai.speakeasy.com/agent-mcp/AGENT_ID"),
{ requestInit: { headers: { Authorization: `Bearer ${process.env.SPEAKEASY_AGENT_KEY}` } } },
);
const client = new Client({ name: "deploy-bot", version: "1.0.0" });
await client.connect(transport);

The Verify step waits for the agent’s first calls. Keep it open while the agent runs its setup. It confirms that the credential was presented to the agent gateway and admitted, and that the runtime resolved the gateway URL and completed a request.

The Verify step waiting for the agent's first call

Select Skip for now to leave the wizard and come back to the agent later.

If nothing arrives:

  • A 401 means the credential was rejected. Run the setup command again, or select Regenerate for an expired code.
  • A 403 means the tool isn’t granted. Check the server selection and the agent’s permissions.
  • No requests at all means the runtime isn’t pointed at the gateway URL.

Select Edit on the agent, from its row on the Agents page or from its overview. The wizard reopens on the choices already made, and saving writes the difference: servers added since it was opened are granted, and servers cleared are withdrawn. The name, the scope, and the server selection can all change. How the agent signs in, and its platform, are fixed once the agent exists.

The agent’s page lists its API keys and Sessions. Keys don’t renew, so replace one before it expires: select Issue a key under Credentials, move the runtime to the new key, then select Revoke on the old one. A replacement can’t send hook events, so an OpenClaw install moved to one stops recording sessions.

Revoking a key or a session takes effect immediately and can’t be undone. To cut off every credential at once, suspend or revoke the agent, which applies to API keys and federated access alike. Agent sessions also appear on MCP Sessions with every other connection.

A person can also connect an MCP client as an agent. On the consent screen, choose Agent under Authorize as, pick the agent, and select Authorize agent. The session grants only mcp:connect on that one server. The person who approved is recorded as the authorizer, and the agent as the actor.

An agent appears in the list only when it is active and both it and its owner are allowed mcp:connect on that server. When the server needs a connected account, the person can share one of their own with Use this account and later detach it with Remove agent access.

An agent request succeeds only when three things allow it: the credential, which is fixed when issued and never widened; the agent’s own permissions and roles; and the owner’s current permissions. An agent can never do more than its owner. The agent and owner permissions are checked on every request, so removing a permission from either takes effect immediately.

A teammate using someone else’s agent is also limited by their own permissions, so sharing an agent never extends anyone’s access. See Sharing an agent and How authorization is evaluated.

Creating agents, changing permissions, and issuing or revoking credentials are all recorded in Audit Logs.