> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aiveth.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AI agents

> Let AI agents such as Claude or ChatGPT reach your MCP servers on behalf of your people, with their consent and under your control.

AI agents, like Claude or ChatGPT, can call tools on your organization's MCP servers. Aiveth signs the person in, asks them what the agent may do, and gives the agent a short-lived token for that one server. Your MCP server checks the token, and you stay in control of which agents get in and what they may do.

Aiveth follows the MCP authorization specification: agents are OAuth clients, your MCP server is a protected resource, and Aiveth is the authorization server.

> [!NOTE]
>
> AI agents and MCP servers are available on the Business plan and above.

## How it works

**1. The agent calls your MCP server**

Without a token, your server answers `401` with a `WWW-Authenticate` header that points to its protected resource metadata (RFC 9728). That document names Aiveth as the authorization server.

**2. The agent sends the person to Aiveth**

The agent opens `/oauth/authorize` with its client ID, PKCE, the permissions it wants, and `resource` set to your MCP server's address.

**3. The person signs in and agrees**

The person signs in as usual, then sees Aiveth's consent screen and chooses **Allow** or **Deny**.

**4. The agent gets a token**

The agent exchanges the code at `/oauth/token`, again naming `resource`. It receives an access token for your server only, valid for 10 minutes, and a refresh token. See [Agent tokens](https://docs.aiveth.com/agents/agent-tokens.md).

**5. Your server checks every call**

Your MCP server verifies the token's signature, audience and permissions on every request.

## Register your MCP server

**1. Open AI agents**

In the console, go to **AI agents** and choose **Add server**. This needs the **Manage apps** power.

**2. Name it and give its address**

The **Address** is exactly where agents reach your MCP server, such as `https://mcp.example.com/mcp`. Tokens are issued for this address only, and it can't be changed later. Use `https` (plain `http` only for `localhost`). Only one organization can hold an address.

**3. Add permissions**

Under **Permissions**, add what an agent can ask for, such as `files:read`, each with a description. People see each description before they agree.

An organization can have up to 50 MCP servers, each with up to 50 permissions. A permission name is lower-case and up to 64 characters. `offline_access` is always allowed: it gives the agent a refresh token.

### Protect your server with the SDK

Serve the metadata document, return the challenge when a token is missing or short of a permission, and verify every token.

```ts Node theme={null}
import { Aiveth, protectedResourceMetadata, challenge, metadataUrl } from '@gooclaim/aiveth';

const MCP = 'https://mcp.example.com/mcp';
const AIVETH = 'https://accounts.aiveth.com';

// Serve this at metadataUrl(MCP): https://mcp.example.com/.well-known/oauth-protected-resource/mcp
const metadata = protectedResourceMetadata({ resource: MCP, baseUrl: AIVETH, scopes: ['files:read'] });

// On every request:
const aiveth = new Aiveth({ baseUrl: AIVETH });
const who = await aiveth.tokens.verifyMcpToken(bearer, { resource: MCP, scopes: ['files:read'] });
// On failure: 401 with challenge({ resource: MCP, scope: ['files:read'] }) as WWW-Authenticate,
// or 403 with challenge({ resource: MCP, scope: ['files:read'], error: 'insufficient_scope' }).
```

```python Python theme={null}
from gooclaim_aiveth_sdk import Aiveth, InsufficientScopeError, TokenVerificationError, challenge, protected_resource_metadata

MCP = "https://mcp.example.com/mcp"
aiveth = Aiveth(base_url="https://accounts.aiveth.com")

metadata = protected_resource_metadata(resource=MCP, base_url="https://accounts.aiveth.com", scopes=["files:read"])

try:
    who = aiveth.tokens.verify_mcp_token(bearer, resource=MCP, scopes=("files:read",))
except InsufficientScopeError:
    status, header = 403, challenge(resource=MCP, scope=["files:read"], error="insufficient_scope")
except TokenVerificationError:
    status, header = 401, challenge(resource=MCP, scope=["files:read"])
```

The console's **How to connect** panel on each server shows the same steps.

## How agents identify themselves

An agent's client ID takes one of two forms.

### Client ID metadata documents

This is the MCP default. The client ID is an `https` address with a path, pointing to a JSON document the agent publishes. Aiveth fetches it and checks that its `client_id` is that same address, and reads the agent's name and redirect addresses. No registration is needed.

For safety, Aiveth fetches the document only from public addresses, with a 3 second limit, at most 5 KB, and no redirects. It keeps the document for its cache lifetime, between 5 minutes and 1 day (1 hour by default).

### Dynamic client registration

Older agents can register themselves with `POST /oauth/register` (RFC 7591). The MCP specification replaced this, so it is off by default. To turn it on, go to **AI agents** → **Which agents may connect** and turn on **Let agents register themselves**. Registration is rate limited per network and per day.

### One app per agent

The first time an agent reaches one of your MCP servers, Aiveth adds it to your organization as a public app with its redirect addresses. It then has everything an app has: codes with PKCE, rotating refresh tokens, revocation, and a place in each person's **Connected apps**. It appears in the agents list under **AI agents**, where an admin can block or unblock it. A blocked agent gets no code and no new token.

## Which agents may connect

Under **AI agents** → **Which agents may connect**, choose:

* **Any agent, after the person agrees** (the default). Aiveth shows who the agent is, where it comes from and what it asks for.
* **Only agents you list.** Only the AI apps you choose can connect. Agents turned away by the list are shown so you can add them.

## The consent screen

Before an agent gets a code, the person sees:

* the agent's name **and** where it really comes from: its metadata document's host, or that it registered itself. A name alone can be copied; the address can't.
* where the code will be sent (the redirect address's host). For an address on the person's own computer (`localhost`), a warning that any program there could claim to be that agent.
* the MCP server and each permission, in your organization's words.

The person chooses **Allow** or **Deny**. Once allowed, Aiveth asks again only if the agent wants more permissions or another redirect address. People withdraw an agent from their account under **Connected apps**.

Agents can also skip the consent screen with an enterprise pass from the identity provider of the person's own organization. See [Agent tokens](https://docs.aiveth.com/agents/agent-tokens.md#enterprise-passes-id-jag).

## Next steps

> [card] [Agent tokens](https://docs.aiveth.com/agents/agent-tokens.md)
>
> What is in the token and how to check it.

> [card] [Controls and approvals](https://docs.aiveth.com/agents/controls-and-approvals.md)
>
> Owners, hours, rate limits, human approval and alerts.

> [card] [Aiveth MCP server](https://docs.aiveth.com/agents/mcp-server.md)
>
> Let an AI assistant manage your Aiveth organization.


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