# auth.md

How an agent signs in to Fecto. Everything an agent does for an owner goes through one interface, signed in as that owner.

## Interface

| Interface | Endpoint | Sign-in |
|---|---|---|
| MCP server (streamable HTTP) | https://fecto.ai/api/mcp | OAuth 2.1, as the owner |

Fecto has no API keys and no shared test credentials. Never ask the owner for a password, and never put a token in code, a prompt, a log or a pull request.

## Without signing in

- The free scan and its public report: https://fecto.ai/report/<domain>
- Public prices and proposals: https://fecto.ai/api/pricing
- Skills (outlines): https://fecto.ai/skills/index.json
- The operating guide for AGENTS.md / CLAUDE.md: https://fecto.ai/agents.md

## OAuth for MCP clients

- Protected resource metadata: https://fecto.ai/.well-known/oauth-protected-resource/api/mcp
- Authorization server metadata: https://fecto.ai/.well-known/oauth-authorization-server/api/auth
- Discovery card: https://fecto.ai/.well-known/mcp.json

Connect to the MCP endpoint. The first request answers 401 with a WWW-Authenticate header naming the protected resource metadata; a client that supports MCP OAuth takes it from there (authorization code with PKCE, dynamic client registration). The owner signs in in their browser and approves the connection once.

## What only the owner does

The owner, in their own browser: signing in, saving a card, accepting a plan, confirming their buyer questions and business record. A tool that needs one of these answers with `human_message` (say it to the owner) and `resolve_url` (where they do it). Don't try to do it for them.

## Two keys that are not credentials

- The tag key in `<script src="https://fecto.ai/t.js" data-site="…">` is public: it says which site a page view belongs to. The same key labels AI fetches the site's server reports.
- The backend event key signs events from the site's own server. It is on the owner's dashboard and belongs in the site's secret store, never in a repository.

## When it fails

- 401: the session expired or was never made. Run the OAuth flow again.
- A site that isn't found belongs to another account or was never added: `list_sites` shows this account's sites.
- A tool error names the field that was wrong and what to pass instead.
