# SealGate Credential Walkthrough

This document teaches an AI agent (or the human operating one) how to obtain and
use credentials for the SealGate remote MCP gateway. It describes the mechanism
that is live today. Credential issuance at SealGate is human-in-the-loop: a human
admin creates the key in the dashboard. There is no automated, agent self-service
credential endpoint and no OAuth flow. Follow the steps below in order.

## Discover

SealGate exposes two authenticated surfaces. This walkthrough is about the first.

- **Remote MCP gateway** (the product surface an agent connects to): a remote,
  streamable-HTTP MCP endpoint. The base URL template is:

  ```
  https://mcp.sealgate.ai/mcp/{api_key}/?client={label}
  ```

  The credential is the `{api_key}` path segment. It is passed as part of the URL
  path, not as an `Authorization` header, not as a bearer token, and not through
  OAuth. `{label}` is an optional, free-form client or session label (for example
  `claude-code` or `cursor`). It is a routing hint for audit and session naming,
  not a credential, and it can be omitted.

  `mcp.sealgate.ai` is the managed release host. Demo tenants and self-hosted
  organizations run their own gateway host, so confirm the correct base host with
  your admin before connecting.

- **Management REST API**: `https://dashboard.sealgate.ai`. This is used by the
  npm `@sealgate/mcp` stdio bridge and by tooling that manages servers and keys.
  It is authenticated with a SealGate API key sent as an HTTP `Authorization:
  Bearer <api_key>` header, issued from the same dashboard.

You can confirm the gateway is reachable and enforcing auth before you hold a key:
a request with no key path segment returns HTTP 400, and a request with an unknown
key returns HTTP 401 (see Errors below).

Discovery pointers for capabilities and endpoints:

- Product summary for agents: https://sealgate.ai/llms.txt
- Product capability card: https://sealgate.ai/.well-known/agent-card.json
- Documentation: https://docs.sealgate.ai
- Open-source MCP server and client configs: https://github.com/Edison-Watch/sealgate-mcp

## Pick a method

SealGate exposes exactly one credential type: a long-lived API key issued by a
human admin. There is no method to negotiate and no automated agent-auth
handshake to discover, so an agent should not spend requests on the OAuth
discovery chain. Go straight to the manual steps below.

For agents that follow the WorkOS `auth.md` discovery flow, these mechanisms do
not apply to SealGate and should not be waited on:

- **No OAuth metadata.** SealGate publishes no `oauth-authorization-server`
  metadata (RFC 8414) and no `oauth-protected-resource` metadata (RFC 9728).
  There is no authorization endpoint, token endpoint, or dynamic client
  registration.
- **No `agent_auth` block.** There is no `register_uri`, `claim_uri`, or
  `revocation_uri` for an agent to call, and no `identity_assertion` or `id-jag`
  (identity assertion JWT authorization grant) token exchange. Issuing, claiming,
  and revoking a key are all human-in-the-loop in the dashboard.
- **No `WWW-Authenticate` challenge.** An unauthenticated request returns a plain
  JSON error body (see Errors), not a spec-shaped
  `WWW-Authenticate: Bearer resource_metadata="..."` header, because there is no
  protected-resource metadata to point at.

The method to use is the API key: obtain a key from an admin (Register, Claim),
put it in the gateway URL path segment (Use), and treat the key as the whole
credential.

## Register

Registration is performed by a human admin, not by the agent. To get an account
you (or your sponsoring admin) must:

1. Reach SealGate at hello@sealgate.ai or start from https://sealgate.ai to set up
   an organization on the managed service, or self-host the gateway.
2. Have an admin sign in to the SealGate dashboard at
   https://dashboard.sealgate.ai.

There is no self-registration endpoint an agent can call to create an
organization or a login. Do not attempt to POST to an account-creation URL; none
is published, and the gateway will not mint credentials on demand.

Adding a new downstream MCP server to the gateway also always requires human admin
approval in the dashboard. An agent cannot register a new upstream server for
itself. See https://docs.sealgate.ai/en/docs/admin-guide/managing-servers.

## Claim

Claiming a credential means an admin issues an API key and hands it to you. There
is no programmatic claim, poll, or token-exchange step; the transfer is manual.

1. An organization admin signs in to https://dashboard.sealgate.ai.
2. The admin creates (or copies an existing) API key for the intended user or
   agent identity.
3. The admin delivers that key to you through a secure channel (for example a
   secrets manager or an encrypted message). Treat the key as a secret.
4. You place the key into the gateway URL as the `{api_key}` path segment, or into
   the `Authorization: Bearer` header for Management REST API calls.

Because the key travels in the gateway URL path, avoid logging the full URL and
avoid pasting it into shared client config that others can read.

## Use

To use the gateway, connect your MCP client to the streamable-HTTP URL with your
key filled into the path segment and an optional client label:

```
https://mcp.sealgate.ai/mcp/YOUR_API_KEY/?client=claude-code
```

Point any MCP-capable client (Claude Code, Cursor, VS Code, Codex CLI, and others)
at that URL as a streamable-HTTP MCP server. The gateway then exposes the tools
your organization has authorized, applies policy at the tool-call level, and
records the session.

For the Management REST API, send the key as a bearer token:

```
Authorization: Bearer YOUR_API_KEY
```

Zero-knowledge secrets (optional, advanced): user and org secrets stored in
SealGate are encrypted with a key derived from a `sealgate_secret_key` request
header that is never stored server-side. That header is separate from the URL
path-segment API key: the API key authenticates the request, while
`sealgate_secret_key` decrypts your stored secrets. If your organization uses this
feature, your admin will tell you the value to send; otherwise you do not need it.

## Errors

The gateway returns clear HTTP status codes and a JSON `detail` field. These are
verified against the live gateway:

- **Missing key**: a request without the API key path segment returns HTTP `400`
  with body `{"detail":"API key segment required"}`. Fix: include your key as the
  path segment, `https://mcp.sealgate.ai/mcp/YOUR_API_KEY/`.
- **Invalid or unknown key**: a request with a key that does not exist (or has
  been revoked) returns HTTP `401` with body `{"detail":"Invalid API key"}`. Fix:
  confirm you copied the whole key and that it has not been rotated or deleted;
  ask your admin to re-issue it if needed.

A `401` on a key that worked before usually means the key was rotated or deleted
in the dashboard (see Revocation). Do not retry a rejected key in a loop; obtain a
fresh key instead.

## Revocation

Keys are revoked by a human admin in the SealGate dashboard. There is no
self-service revoke endpoint an agent calls.

1. An admin signs in to https://dashboard.sealgate.ai.
2. The admin rotates the key (issues a replacement and retires the old value) or
   deletes it outright.
3. A deleted or rotated key stops working immediately: the gateway returns HTTP
   `401` with `{"detail":"Invalid API key"}` on the next request.

If you believe a key has leaked, ask an admin to rotate or delete it right away,
then claim a replacement using the Claim steps above.
