authMethods. Each authentication method type defines
the flow a Client uses. Agents that support ending an authenticated state
advertise the logout capability.
Advertising Authentication
Agents advertise authentication options in theauthMethods field of the
initialize response. Every method has an id, but the Client sends that ID to
authenticate only for a method whose type defines that protocol-driven flow.
Agents that support logout also advertise agentCapabilities.auth.logout:
agentCapabilities.auth.logout is omitted or null, the Agent does not
support logout and Clients MUST NOT call it. Supplying {} means the Agent
supports the method.
Authentication method types
The default authentication method type isagent, where the Agent handles
authentication itself. When no type is present, the method is treated as
agent:
terminal type tells the Client to run the configured Agent program
interactively:
clientCapabilities.auth.terminal:
terminal method only when this capability is true.
See the schema for the full
AuthMethod definitions and the Terminal Authentication
RFD for the design.
Protocol-driven authentication
When an Agent requires authentication and the selected method uses the protocol-driven flow, the Client callsauthenticate with the advertised
authentication method ID:
string
required
The ID of an advertised authentication method whose type defines the
authenticate flow. Clients MUST NOT pass a terminal method.auth_required error for authentication-gated requests.
Terminal authentication
For aterminal method, the Client:
- Launches a separate interactive process using the same configured Agent program and base launch configuration as the ACP connection.
- Appends the method’s
argsand applies itsenv, overriding any same-named variables in the base launch configuration. - Presents the terminal to the user and waits for the process to exit. Exit status zero signals success; a non-zero status, termination without an exit status, or cancellation signals failure.
- Reconnects and reinitializes the ACP Agent.
authenticate
request for a terminal method.
Logging Out
Thelogout method allows Clients to end the current authenticated state.
Clients should only call it after verifying the Agent advertised
agentCapabilities.auth.logout during initialization.
logout, new sessions that require authentication will
require the user to complete one of the advertised authentication flows again.
Active Sessions
The protocol does not guarantee what happens to already-running sessions afterlogout. Agents may terminate them, keep them running, or return
auth_required errors for future session activity.
Clients SHOULD be prepared for active session operations to fail with
authentication-related errors after logout and should prompt the user to
authenticate again when appropriate.