Resolves N/A
Adds full auth.md support for Tuist’s hosted MCP server so agents can register and obtain user-scoped credentials through the WorkOS-compatible flows defined by the auth.md spec.
Note
The motivation behind this work is to guide agents through creating or claiming a Tuist account on behalf of the user, without requiring the agent to guess our signup, OAuth, or token flows. The server now advertises the supported auth.md contract and gives agents a structured path to get a user-scoped MCP credential after the user approves the registration.
Important
OpenAI is included in the built-in trusted provider list because it publishes a verifiable OIDC issuer and JWKS endpoint. Anthropic is intentionally not included yet because I could not verify a public Anthropic ID-JAG issuer and JWKS endpoint. Adding it without those exact values would make the default trust list either unsafe or non-functional. Self-hosted deployments can still add Anthropic through TUIST_AGENT_AUTH_TRUSTED_PROVIDERS_JSON or agent_auth.trusted_providers once Anthropic publishes the metadata to trust.
This includes:
GET /auth.md and discovery metadata for agent_auth, including registration, claim, and revocation endpoints.
- User-claimed email-required registration with access token or API key issuance after OTP completion.
- User-claimed anonymous start with immediate API key issuance and in-place claim upgrade.
- Agent-verified ID-JAG registration with trusted-provider JWKS verification, replay protection, user matching/JIT provisioning, and logout-token revocation.
- Append-only audit records, rate limiting, data export documentation, and MCP docs updates.
How to test locally
MIX_ENV=test mix ecto.reset
MIX_ENV=test mix ecto.migrate
MIX_ENV=test mix test test/tuist/accounts_test.exs test/tuist_web/controllers/agent_auth_controller_test.exs test/tuist_web/controllers/well_known_controller_test.exs test/tuist_web/rate_limit/agent_auth_test.exs test/tuist_web/controllers/mcp_controller_test.exs test/tuist_web/plugs/authentication_plug_test.exs
MIX_ENV=test mix test test/tuist/environment_test.exs test/tuist/accounts_test.exs test/tuist_web/controllers/agent_auth_controller_test.exs test/tuist_web/controllers/well_known_controller_test.exs
mix excellent_migrations.check_safety 2>&1 | rg "20260522|20260527|agent_registrations|agent_auth"