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
-
Open Settings → Agents in AuthHub.
-
Copy the MCP endpoint shown on the page. It has this form:
https://api.authhub.co/mcp -
Add the endpoint to your MCP client.
-
Complete the AuthHub sign-in flow in the browser.
-
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. -
Review the agent name and capability set, then connect the agent.
-
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.
| Capability | Permission | Use it for |
|---|---|---|
| Workspace | workspace:read | Read a bounded agency snapshot. |
| Clients | clients:read, clients:write | Read, create, or update client profiles. |
| Access Links | templates:read, links:write | Inspect reusable definitions; resolve, create, or explicitly update links. |
| Connections | connections:read, connections:handoff | Check readiness or return a human connection handoff. |
| Requests | requests:read, requests:prepare, requests:dispatch, requests:cancel | Read or create requests, send invitations, or prepare cancellation. |
| Operations | operations:read | Read operation status and recent agent activity. |
| Agency profile | agency:write | Update 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:
- Call
authhub_save_clientwith the business and contact details. Keep the returnedclientId. - Inspect links with
authhub_list_access_linksandauthhub_get_access_link, or callauthhub_resolve_access_linkwith the intended definition. - Call
authhub_create_access_requestwithclientId,linkId, and anidempotencyKey. Creation returns the request and client URL but sends no email. - Call
authhub_send_access_requestwithrequestIdand its ownidempotencyKey. - Read the operation with
authhub_get_operationand fulfillment withauthhub_get_access_request.
Client IDs identify businesses. Do not merge businesses because they share a contact email.
When no existing link matches
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
- AuthHub returns a
pending_approvaloperation, approval URL, and expiry without sending the invitation. - The owner opens the URL and approves or declines the bound request and recipient.
- The agent calls
authhub_execute_approved_operationafter 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 status | Meaning |
|---|---|
not_sent | The request exists; no invitation has been sent. |
pending_approval | The owner must approve before sending. |
accepted | The email provider accepted the invitation. This does not prove inbox delivery or platform authorization. |
failed_retryable | Retry the same intent and key while its authorization and retry window remain valid. |
failed_terminal | Inspect the operation before starting new work. |
unknown_outcome | AuthHub 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
| Response | Meaning | Next action |
|---|---|---|
AGENT_GRANT_REQUIRED | The OAuth client is valid but its grant was revoked. | Open the returned setup URL as the owner. |
AGENT_GRANT_REQUIRED | OAuth 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_EXECUTABLE | The operation is pending, stale, declined, expired, canceled, or already claimed. | Read the operation and prepare a new preview when required. |
HTTP 429 or MCP -32001 | The grant or agency rate budget is exhausted. | Wait for Retry-After; keep the same idempotency key. |
follow_up_needed | A human must finish a provider or platform step. | Open the returned AuthHub handoff URL. |
unknown_outcome | The 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.