No
client_id is required. When a server exposes standard authorization-server metadata (RFC 8414) and dynamic client registration (RFC 7591), PraisonAI discovers the endpoints, registers a client, runs the PKCE flow, and refreshes tokens on its own.Status
Quick Start
1
client_id or scopes to configure.2
3
Or pre-seed from the CLI
~/.praisonai/mcp-auth.json to a CI runner for headless environments.How Zero-config OAuth Works
A401 with a WWW-Authenticate challenge triggers discovery, registration, and the PKCE flow — all automatic.
Interactive vs Headless
Interactive sessions open a browser; headless environments raise a single actionable exception.- Interactive (default)
- Headless / CI
Configuration Schema
Theoauth: block is now optional. For servers that advertise standard metadata, just supply type: remote and url.
Remote Server with API Key
Python SDK
All OAuth helpers are lazy-loaded frompraisonaiagents.mcp.
MCPOAuthProvider
Orchestrates discovery, registration, the PKCE flow, and refresh for one server.Discovery and Registration Helpers
InteractiveAuthRequired
Raised byensure_authenticated() when interactive auth is required but open_browser=False.
Auth Storage
PKCE Utilities
OAuth Callback Handler
CLI Commands
Authenticate
- Opens your browser and waits for the loopback callback.
- Exchanges the code at the discovered
token_endpoint. - Persists tokens (with
expires_at) to~/.praisonai/mcp-auth.json(0600 permissions). - Clears any legacy placeholder entry (
oauth_<...>...) from a previous CLI run before starting, so a prior failed login recovers automatically — no manual cleanup. - Reads
server.oauth.client_id/client_secretfrom~/.praisonai/config.tomlfor servers without dynamic client registration, seeding them into storage before the flow runs. - Honors
--timeout(default300s).
access_token, optional refresh_token, and expires_at. The Python client picks them up automatically on the next Agent.start(...). On failure, the command exits 1.
Logout
--yes to skip the confirmation prompt.
List Servers
Token Storage
OAuth tokens are stored in~/.praisonai/mcp-auth.json with secure file permissions (0600).
Security
- HTTPS-only — every metadata, authorize, token, and registration URL must be HTTPS (loopback
http://127.0.0.1allowed for testing). - Redirect re-validation — each redirect hop is re-checked, so an HTTPS metadata document cannot smuggle a plaintext token endpoint.
- Refresh re-check — refresh-token grants re-validate the stored
token_endpointover HTTPS (defence in depth). - Public client — dynamic registration uses
token_endpoint_auth_method: "none"and requestsgrant_types: ["authorization_code", "refresh_token"]. - PKCE — all flows use PKCE (
S256) plus a randomstatefor CSRF protection. - File permissions — token storage uses 0600 (owner read/write only).
Troubleshooting
Related
Remote MCP
Connect to remote MCP servers via HTTP, SSE, or WebSocket.
MCP Authentication
Server-side OAuth 2.1, OIDC, and API-key auth for
praisonai-mcp.MCP Tools
Using MCP tools with agents.
MCP Server
Deploy PraisonAI as an MCP server.

