Skip to main content

Connect an Agent to AuthHub

AuthHub supports compatible personal agents through a remote MCP endpoint. An authorized agent can save clients, inspect or define reusable Access Links, create access requests, send invitations, and report progress. It does not receive provider passwords or OAuth tokens.

Starter is read-only. Growth and Agency include MCP writes. Agent access must also be enabled for your agency.

Which credential this is​

The approval in Settings → Agents creates an MCP grant. An MCP grant is a different credential from a dashboard API key and from the CLI bearer token. API keys are not the MCP grant or the CLI bearer token. Create those keys in Settings → API keys and send them only on /api/v1. See API keys.

Before you start​

  • Your agency has access to Settings → Agents.
  • Your MCP client supports Streamable HTTP and OAuth protected-resource discovery.
  • You can sign in to AuthHub as the agency owner.

Connect the agent​

  1. Open Settings → Agents in AuthHub.

  2. Copy the MCP endpoint shown on the page. It has this form:

    https://api.authhub.co/mcp
  3. Add the endpoint to your MCP client.

  4. Complete the AuthHub sign-in flow in the browser.

  5. The first call from a new client signed in as the agency owner creates the grant automatically. If the client returns AGENT_GRANT_REQUIRED, the grant was revoked or the signed-in user does not own an agency. Open the setup URL from the response as the owner.

  6. Review the agent name and capability set, then connect the agent.

  7. Retry the MCP call.

AuthHub reloads the grant on every request. A revoked grant cannot continue to use an old access token.

Choose the smallest useful capability set​

Agent access is scoped to the grant. Starter is read-only. On Growth and Agency, start with read permissions, then add a write permission only when the agent needs it.

CapabilityPermissionUse it for
Workspaceworkspace:readRead a bounded agency snapshot.
Clientsclients:read, clients:writeRead, create, or update client profiles.
Access Linkstemplates:read, links:writeInspect reusable definitions; resolve, create, or explicitly update links.
Connectionsconnections:read, connections:handoffCheck readiness or return a human connection handoff.
Requestsrequests:read, requests:prepare, requests:dispatch, requests:cancelRead or create requests, send invitations, or prepare cancellation.
Operationsoperations:readRead operation status and recent agent activity.
Agency profileagency:writeUpdate the agency name, website, or logo URL.

For onboarding, grant workspace:read, clients:write, templates:read, links:write, connections:read, requests:prepare, requests:dispatch, requests:read, and operations:read. Add connections:handoff if the agent should return provider setup handoffs. A sending permission alone does not authorize unattended sending.

Onboard a client​

Your CRM, form, or other agency system supplies the new-client information to your agent. AuthHub handles the following steps:

  1. Call authhub_save_client with the business and contact details. Keep the returned clientId.
  2. Inspect links with authhub_list_access_links and authhub_get_access_link, or call authhub_resolve_access_link with the intended definition.
  3. Call authhub_create_access_request with clientId, linkId, and an idempotencyKey. Creation returns the request and client URL but sends no email.
  4. Call authhub_send_access_request with requestId and its own idempotencyKey.
  5. Read the operation with authhub_get_operation and fulfillment with authhub_get_access_request.

Client IDs identify businesses. Do not merge businesses because they share a contact email.

A link owns its platforms, effective permission levels, intake questions, and client-visible content. Resolving an exact definition reuses an existing agency link. Changing a platform, permission, ordered question, or content creates a new reusable link and preserves the original.

The definition contains platforms, optional accessLevels, optional intakeFields, and optional content-only branding (introCopy, heroGifUrl, language). Use complete read results to inspect the actual questions and permissions before choosing a link. Request creation accepts a link ID, not per-request platform or intake overrides.

Use authhub_update_access_link only to deliberately change a specified link. Supply its current expectedUpdatedAt to prevent overwriting newer owner edits. Resolving a different definition never updates a shared link implicitly.

Unsupported products, permission levels, or malformed questions fail validation. AuthHub never substitutes stronger permissions. Missing required agency connections return setup actions; complete setup before retrying request creation.

Configure unattended sending​

New and reconnected agents require approval by default. In Settings → Agents, the agency owner can enable unattended sending for explicit product and access-level pairs. Agents cannot change their own sending policy.

For example, a policy allowing google_ads with manage permits matching invitations. It does not permit ga4, or a permission level absent from that policy. Every pair on the request must match, and the grant must still include requests:dispatch.

AuthHub checks current authority again when executing or retrying a send. Disabling or narrowing a policy, removing permissions, or revoking a grant can block work prepared earlier. Policy changes do not recall an invitation already claimed for sending.

Requests outside the policy​

  1. AuthHub returns a pending_approval operation, approval URL, and expiry without sending the invitation.
  2. The owner opens the URL and approves or declines the bound request and recipient.
  3. The agent calls authhub_execute_approved_operation after approval.

Cancellation still requires approval. Provider OAuth consent, passwords, CAPTCHAs, terms acceptance, and client authorization remain human actions.

Read results and retry safely​

Structured results include the relevant clientId, linkId, requestId, clientUrl, operation status, authorizationMode, and sendStatus. Setup and approval actions are returned when needed. Request polling reports fulfillment and scoped intake answers separately from invitation sending.

Send statusMeaning
not_sentThe request exists; no invitation has been sent.
pending_approvalThe owner must approve before sending.
acceptedThe email provider accepted the invitation. This does not prove inbox delivery or platform authorization.
failed_retryableRetry the same intent and key while its authorization and retry window remain valid.
failed_terminalInspect the operation before starting new work.
unknown_outcomeAuthHub cannot safely determine whether submission succeeded. Reconcile the email outcome before any further sending.

Use the same idempotency key when retrying the same intent. Reusing a key with different intent returns IDEMPOTENCY_CONFLICT. Link and request retries reuse their created resources. Sending retries share a stable logical invitation identity, including across operation keys; changing the key does not authorize another invitation.

Uncertain email submissions can retry with the same frozen payload and provider key for up to 23 hours from the first attempt. After that window, AuthHub reports unknown_outcome and does not automatically resubmit. Do not create another request to bypass that result.

Treat client URLs as sensitive access links. Return them only to authorized workflows and keep them out of logs and public transcripts.

Manage or revoke access​

In Settings → Agents, you can:

  • rename an active agent;
  • change its capability set;
  • configure or disable unattended sending as the owner;
  • revoke access immediately.

Revocation blocks new calls and cancels prepared, pending, or approved operations that have not started. AuthHub keeps security records for attribution and removes old sanitized operation snapshots through retention.

Troubleshoot common responses​

ResponseMeaningNext action
AGENT_GRANT_REQUIREDThe OAuth client is valid but its grant was revoked.Open the returned setup URL as the owner.
AGENT_GRANT_REQUIREDOAuth identity is valid but the grant was revoked or the user owns no agency.Open the setup URL in the error as the agency owner and connect the agent.
OPERATION_NOT_EXECUTABLEThe operation is pending, stale, declined, expired, canceled, or already claimed.Read the operation and prepare a new preview when required.
HTTP 429 or MCP -32001The grant or agency rate budget is exhausted.Wait for Retry-After; keep the same idempotency key.
follow_up_neededA human must finish a provider or platform step.Open the returned AuthHub handoff URL.
unknown_outcomeThe safe email retry window expired before AuthHub could confirm acceptance.Reconcile the submission with the agency owner; do not automatically resend.

Current protocol limits​

The current integration uses ordinary Streamable HTTP, OAuth discovery, tools, structured results, browser URLs, and polling. It does not require or support MCP Tasks, elicitation, A2A, or provider-token passthrough.

For shell-based agents and scripts, see Use the AuthHub CLI.