Overview
Fast Agent provides minimal OAuth v2.1 support for SSE and HTTP MCP servers with sensible defaults. OAuth is enabled by default for remote servers, with automatic PKCE (Proof Key for Code Exchange) flow and secure token storage.Basic OAuth Configuration
For SSE and HTTP transports, OAuth is enabled automatically. Minimal configuration:OAuth Settings
Enable OAuth for SSE/HTTP transports. If
null or omitted, OAuth is enabled by default.Local callback server port for OAuth redirect.
Local callback server path for OAuth redirect.
Optional scope override. If set to a list, values are space-joined. When omitted, server defaults are used.Or as array:
Token persistence mode:
keyring: Store tokens securely in OS keychain (default)memory: Store tokens in memory only (session-only)
Client ID Metadata Document (CIMD) URL for client_id_metadata_document_supported servers.When provided and the server advertises
client_id_metadata_document_supported=true, this URL will be used as the client_id instead of performing dynamic client registration.Must be a valid HTTPS URL with a non-root pathname (e.g., https://example.com/client.json).See: MCP Authorization SpecificationOAuth Flow
When connecting to an OAuth-enabled MCP server:- Discovery: Client requests server metadata to get authorization and token endpoints
- PKCE Generation: Client generates code verifier and challenge
- Authorization: Browser opens for user to authorize the application
- Callback: Local server captures authorization code at
http://localhost:3030/callback - Token Exchange: Client exchanges authorization code for access token
- Storage: Token is stored in OS keychain (or memory if unavailable)
If port 3030 is unavailable, Fast Agent provides a paste-URL fallback where you can manually paste the authorization code.
Token Storage
OS Keychain (Default)
By default, OAuth tokens are stored securely in your operating system’s credential storage:- macOS: Keychain
- Linux: Secret Service API (GNOME Keyring, KWallet)
- Windows: Windows Credential Locker
Memory-Only Storage
For headless environments or when keychain is unavailable:Managing OAuth Tokens
Use thefast-agent auth command to manage OAuth tokens:
Disabling OAuth
To disable OAuth for a specific server:Complete OAuth Example
Client Metadata Document
For servers supporting Client ID Metadata Document (CIMD):client_metadata_url must:
- Use HTTPS scheme
- Have a non-root pathname (not
/) - Point to a valid client metadata document
Environment Variables
OAuth settings support environment variable substitution:Security Considerations
Troubleshooting
Port Already in Use
If port 3030 is already in use, configure a different port:Keyring Unavailable
On headless systems without keyring support, Fast Agent automatically falls back to memory storage. To explicitly use memory storage:Authorization Failed
Check that:- The server URL is correct
- The server supports OAuth
- Required scopes are available
- Your browser can access localhost
Token Expired
Remove expired tokens and re-authenticate:Advanced: Custom Authorization Flows
For custom OAuth implementations, you can provide authorization headers directly:See Also
- MCP Servers - Configure MCP server connections
- Secrets Management - Store API keys securely
- Configuration File - Main configuration options
