# auth.md — Adal Cloud access for agents

This guide documents existing, user-authorized access. It does not advertise
autonomous account registration, identity assertions, or an `agent_auth` flow.
The documentation site does not accept API or MCP bearer tokens.

## Choose the interface

| Task | Endpoint | Credential |
| --- | --- | --- |
| Manage Inbound Servers and inspect saved webhooks | `https://mcp.adal.cloud/mcp` | MCP OAuth access token or manual MCP token |
| Submit and inspect Outbound HTTP jobs | `https://api.adal.cloud` | API token |
| Manage account, consent and token revocation | `https://dashboard.adal.cloud` | Human Dashboard session |

These credentials are not interchangeable. MCP currently exposes Inbound tools;
it does not provide Outbound, Channel, Router or Tunnel management tools.

## Connect MCP through OAuth

Add the Streamable HTTP server `https://mcp.adal.cloud/mcp` to a compatible MCP
client. Start its OAuth connection, let the user sign in and review the consent
screen. The client must not approve consent on the user's behalf.

Canonical discovery URLs:

- [MCP Server Card](https://adal.cloud/.well-known/mcp/server-card.json)
- [Protected Resource Metadata](https://mcp.adal.cloud/.well-known/oauth-protected-resource/mcp)
- [Authorization Server Metadata](https://mcp.adal.cloud/.well-known/oauth-authorization-server)

The issuer is `https://mcp.adal.cloud` and the resource is
`https://mcp.adal.cloud/mcp`. Discover registration, authorization and token
endpoints from that issuer's metadata. The current server supports dynamic
client registration and authorization code flow with PKCE S256. Register the
client's actual redirect URI; include the MCP resource in authorization and
code exchange. Do not move the issuer to `adal.cloud` or invent OIDC endpoints.

The `inbound` and `mcp` scopes authorize MCP access to the account's Inbound
tools, including Server creation, changes and deletion; they are not a separate
read-only permission. Request `offline_access` only when the user needs access
that can be refreshed without a new consent flow. Access tokens last one hour.
Without `offline_access`, reconnect after the grant expires. With approved
`offline_access`, refresh rotates both tokens: save the new refresh token
securely and discard the used one. Reusing it revokes the connection.

Send the MCP access token as `Authorization: Bearer <access token>` to the MCP
endpoint. A refresh token is not an MCP access token. Use the client's secret
storage; do not ask the user to paste credentials into a chat.

## Use a manual MCP token

If the client supports bearer authentication instead of OAuth, the user can
open [Dashboard → Tokens → MCP](https://dashboard.adal.cloud/settings/tokens?tab=mcp),
create a dedicated token with a name and expiration, and copy the secret once
into the client's secret settings. Send it as `Authorization: Bearer <MCP token>`
only to `https://mcp.adal.cloud/mcp`. Check access with `list_regions` or
`list_servers` before making changes.

## Use an Outbound API token

Create an API token under Dashboard → Tokens → API. The secret is displayed
only once; choose a separate token and suitable expiration for the integration.
Send it only to `https://api.adal.cloud`, never to an external HTTP recipient.
An initial read-only check, using a secret already in the local environment:

```bash
curl --fail-with-body --silent --show-error \
  --header "Authorization: Bearer $ADAL_API_TOKEN" \
  https://api.adal.cloud/outbound/regions
```

Do not log the header or put secrets in URLs, Git, screenshots or examples.
For submissions use the [OpenAPI contract](https://adal.cloud/openapi.yaml)
and [Outbound quickstart](https://adal.cloud/en/docs/outbound/quickstart/index.md).

## Revoke, rotate and troubleshoot

- Revoke OAuth under Tokens → MCP → Manage MCP connections. This closes access
  and refresh for that connection. Revoke a manual MCP token in the MCP token list.
- Revoke an API token in its token details. For planned rotation, configure and
  verify a new token before revoking the old one. Revocation prevents new API
  calls; it does not cancel previously accepted Outbound jobs.
- For `401`, check endpoint, credential type, expiration and revocation, then
  reconnect if necessary. Do not send credentials to a different host to fix it.
- Service-side revocation does not delete webhook data already copied into an
  agent's conversation or client storage; use that client's data controls.

[Account and API tokens](https://adal.cloud/en/docs/common/account-api-tokens/index.md)
· [MCP quickstart](https://adal.cloud/en/docs/mcp/quickstart/index.md)
· [Agent Skills](https://adal.cloud/.well-known/agent-skills/index.json)
· [Русская инструкция](https://adal.cloud/auth-ru.md)
