Skip to main content
Connect to OAuth-protected remote MCP servers with PraisonAI’s built-in OAuth 2.1 support.
OAuth implementation is experimental. The current implementation stores placeholder tokens only and real token exchange is not yet implemented. For production use, we recommend using headers: with API key authentication instead.

Status

Quick Start

1

Configure Remote Server

Add a remote MCP server with OAuth to your config. Servers declared in ~/.praisonai/config.yaml (global) or ./.praisonai/config.yaml (project) are automatically picked up by praisonai run:
2

Authenticate

This opens your browser for OAuth authorization.
3

Use the Server

CLI Commands

Authenticate

[EXPERIMENTAL] Authenticate with an OAuth-enabled MCP server. WARNING: OAuth implementation is currently experimental and stores placeholder tokens only. Initiates OAuth 2.1 authorization flow:
  1. Opens browser for user authorization
  2. Waits for callback with authorization code
  3. Stores tokens securely in ~/.praisonai/mcp-auth.json
Options:

Logout

Removes stored OAuth credentials for a server. Options:

List Servers

Shows all configured servers with their type (local/remote) and status.

Configuration Schema

Remote Server with OAuth

Remote Server with API Key

Local Server (stdio)

Python SDK

Using Auth Storage

PKCE Utilities

OAuth Callback Handler

Token Storage

OAuth tokens are stored in ~/.praisonai/mcp-auth.json with secure file permissions (0600). Storage structure:

Security

  • File permissions: Token storage uses 0600 permissions (owner read/write only)
  • PKCE: All OAuth flows use PKCE (Proof Key for Code Exchange) for security
  • State parameter: CSRF protection via random state parameter
  • URL validation: Tokens are invalidated if server URL changes

Troubleshooting