okta-auth
Provides tools for authenticating with Okta, managing sessions, and retrieving cookies for AI agents.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@okta-authcheck my Okta session status"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
okta-auth
Alpha: this project is under active development. APIs, tool signatures, and session formats may change between releases.
okta-auth is an Okta login toolkit with two entry points:
okta: interactive CLI for humansokta-auth: MCP server for AI agents that reuse saved sessions
Sessions are stored under ~/.okta-auth/sessions/. Existing sessions under
~/.okta-auth-mcp/sessions/ are migrated automatically.
Install
uv tool
uv tool install okta-auth-clipipx
pipx install okta-auth-clipip
pip install okta-auth-cliBrowser setup
The project uses Playwright for browser automation. It automatically prefers a local Chrome or Edge install when available.
If no supported system browser is found, install Playwright Chromium:
playwright install chromiumRelated MCP server: Agent Identity MCP Server
Upgrade
uv tool:uv tool upgrade okta-auth-clipipx:pipx upgrade okta-auth-clipip:pip install -U okta-auth-cli
Quick Start
1. Configure credentials
Run the built-in wizard:
okta configIf the wizard asks for a TOTP secret and you are not sure where to find it, see TOTP Secret.
The wizard supports two providers:
keyring: store credentials in the OS credential managerop: generate~/.okta-auth/op.envwithop://...references forop run
Only non-secret settings such as the default URL and provider metadata are stored
in ~/.okta-auth/config.json.
2. Log in
oktaOr pass a target URL directly:
okta https://portal.company.comThe login flow is headless by default. Use --headed to show the browser.
3. Reuse the session from MCP
Once configured, AI agents can authenticate with the saved session or with the credential provider you configured.
TOTP Secret
The TOTP secret is the Base32 key behind your authenticator app. You typically must capture it during initial MFA enrollment.
During Okta MFA setup
Go to Settings -> Security Methods in Okta.
Choose Google Authenticator or another TOTP-compatible factor.
On the QR screen, click Can't scan?
Copy the displayed Base32 secret.
Complete enrollment by entering the generated code.
This project does not currently support portals that rely only on the Okta Verify push app for MFA.
If you already enrolled and lost the secret
You usually need to remove and re-enroll the authenticator factor to get a new secret.
Credential Setup
Credential resolution order is:
Explicit CLI or MCP arguments
Environment variables
Stored keyring credentials when the selected provider is
keyring
Recommended: OS keyring
This is the default and recommended local setup:
okta config --provider keyringWhat gets stored:
username,password,totp_secret: OS keyring onlydefault_url:~/.okta-auth/config.json
Typical keyring backends:
macOS: Keychain Access
Windows: Credential Manager / Credential Locker
Linux: Secret Service or KWallet
If no secure backend is available, the wizard refuses to fall back to plaintext.
1Password CLI
If you already manage secrets in 1Password:
okta config --provider opWhat gets stored:
vault,item, field names,default_url:~/.okta-auth/config.jsonOKTA_USERNAME,OKTA_PASSWORD, optionalOKTA_TOTP_SECRETreferences:~/.okta-auth/op.env
The generated env file contains op://... references, not plaintext values.
Launch the CLI or MCP server through op run:
op run --env-file=$HOME/.okta-auth/op.env -- okta
op run --env-file=$HOME/.okta-auth/op.env -- uvx --from okta-auth-cli okta-auth1Password vault, item, and field names must be compatible with secret reference
paths. If a name contains unsupported separators such as /, use the object's
unique ID instead.
Environment variables
Environment variables are still supported for CI, ephemeral shells, or external
secret managers. They override okta config values.
export OKTA_USERNAME="you@company.com"
export OKTA_PASSWORD="your-okta-password"
export OKTA_TOTP_SECRET="JBSWY3DPEHPK3PXP"Manual 1Password setup
If you do not want to use the wizard, you can set up op run manually.
Create a login item:
op item create --category login --title "Okta MCP" \
username="you@company.com" \
password="your-okta-password" \
totp_secret="JBSWY3DPEHPK3PXP"Create
~/.okta-auth/op.env:
OKTA_USERNAME=op://Personal/Okta MCP/username
OKTA_PASSWORD=op://Personal/Okta MCP/password
OKTA_TOTP_SECRET=op://Personal/Okta MCP/totp_secretLaunch through
op run:
op run --env-file=$HOME/.okta-auth/op.env -- uvx --from okta-auth-cli okta-authCLI
Common commands
okta [url]: log in and save a sessionokta config: open the credential wizardokta config --provider keyring: force keyring configurationokta config --provider op: force 1Password configurationokta config --show: show current config statusokta config --reset: remove saved config and credentialsokta check <url>: verify a stored sessionokta list: list stored sessionsokta delete <url>: delete a stored sessionokta cookies <url>: inspect stored cookies
Example
okta https://portal.company.com --username you@company.com --headedMCP Server
MCP tools
Tool | Description |
| Authenticate to a target URL and store session state |
| Verify whether a stored session is still valid |
| List saved sessions and metadata |
| Remove a stored session |
| Retrieve cookies from a stored session |
Claude Code
claude mcp add okta-auth -- uvx --from okta-auth-cli okta-authIf you use 1Password:
claude mcp add okta-auth -- op run --env-file=$HOME/.okta-auth/op.env -- uvx --from okta-auth-cli okta-authClaude Desktop / Cursor / Windsurf
Default:
{
"mcpServers": {
"okta-auth": {
"command": "uvx",
"args": ["--from", "okta-auth-cli", "okta-auth"]
}
}
}With 1Password:
{
"mcpServers": {
"okta-auth": {
"command": "op",
"args": ["run", "--env-file=/Users/yourname/.okta-auth/op.env", "--", "uvx", "--from", "okta-auth-cli", "okta-auth"]
}
}
}Use okta for the interactive CLI. Use okta-auth only when wiring the package
into an MCP client.
Security
This project is intended for local trusted execution.
Session files and cookies are sensitive credentials.
Prefer
okta configover passing credentials directly on the command line.Prefer
keyringorop runover plaintext shell files.Never post cookie values, passwords, or TOTP secrets in issues or logs.
Development
uv venv && source .venv/bin/activate
uv pip install -e '.[dev]'
playwright install chromiumRun checks locally:
ruff format --check .
ruff check .
pytestAvailable Tools
5 toolsokta_check_sessionARead-onlyIdempotent
Verify if a stored session for a URL is still valid.
Launches a headless browser with the stored session cookies, navigates to the URL, and checks whether the session is still authenticated (not redirected to Okta login).
Args: url: URL to verify session against. Must match the URL used during login. timeout_ms: Maximum time in ms to wait for page load (5000-120000, default 30000).
Returns: JSON: {"valid": bool, "domain_key": str|null, "message": str, "url": str}
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | ||
| timeout_ms | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Provides specific behavioral details beyond annotations: launches headless browser, uses cookies, checks for redirect. Annotations already indicate safe read operation; description enriches with mechanism.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Concise yet comprehensive: states purpose, explains mechanism, lists arguments with details, specifies return format. No superfluous content.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Covers purpose, mechanism, parameters, and return format. Annotations provide safety profile. Could mention prerequisites (must have stored session from login) but implied. Good completeness for its complexity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Both parameters described with constraints and usage context. URL: must match login URL; timeout: range and default. Schema had no descriptions, so description fully compensates.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States clear action: verify session validity for a URL. Distinguishes from sibling tools like login, list, delete, get cookies by focusing on validation. Includes specific method (headless browser, checking for redirect).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Implies usage after login to verify session, but does not explicitly state when to use this tool over alternatives like okta_list_sessions. No exclusions or when-not guidance provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
okta_delete_sessionADestructiveIdempotent
Delete a stored session for a given URL.
Removes the session file and metadata from ~/.okta-auth/sessions/. The agent will need to re-authenticate to access the service again.
Args: url: URL whose stored session should be deleted.
Returns: JSON: {"deleted": bool, "message": str, "url": str}
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already indicate destructiveHint=true. The description adds valuable context beyond annotations: it specifies that the tool removes 'the session file and metadata from ~/.okta-auth/sessions/' and that re-authentication is required. No contradictions with annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise: a single-sentence summary followed by a brief explanation and structured Args/Returns. It is front-loaded with the main action and every sentence adds value without waste.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (one required parameter, no enums, output schema exists) and the richness of annotations, the description covers all necessary information: what it does, what happens (file removal, re-auth needed), and the return format. No gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 0% description coverage for the single parameter 'url'. The description adds meaning: 'URL whose stored session should be deleted,' clarifying the parameter's purpose beyond its name.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Delete a stored session for a given URL,' specifying the verb (delete) and resource (stored session). This distinguishes it from sibling tools like okta_check_session, okta_login, okta_list_sessions, and okta_get_cookies.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explains the consequence of use: 'The agent will need to re-authenticate to access the service again,' providing clear context for when this tool is appropriate. It does not explicitly mention when not to use or list alternatives, but the context is sufficient.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
okta_get_cookiesARead-onlyIdempotent
Retrieve cookies from a stored session.
Returns the raw cookie data from a stored Playwright session. Useful for making authenticated HTTP requests without launching a browser.
Args: url: URL whose stored session cookies to retrieve. domain_filter: Optional domain substring to filter cookies (e.g., 'okta.com').
Returns: JSON: {"count": int, "cookies": [{name, value, domain, path, ...}], "url": str} Error: {"error": str, "url": str}
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | ||
| domain_filter | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already indicate read-only, idempotent, non-destructive behavior. The description adds context about returning raw cookie data from a Playwright session, and specifies the return format including error handling.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise and well-structured: a one-line summary, usage context, and clearly separated Args and Returns sections. No wasted sentences.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers purpose, usage, parameter details, return format, and error responses. Given the tool's simplicity (2 params, output schema present), it provides complete guidance for an agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Despite 0% schema description coverage, the description's Args section fully explains both parameters: url (the URL whose cookies to retrieve) and domain_filter (optional substring filter), providing clear semantics.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Retrieve cookies from a stored session.' It uses a specific verb and resource, and the tool's purpose is distinct from siblings like okta_check_session or okta_login.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides a use case ('making authenticated HTTP requests without launching a browser') and explains the tool's utility, but does not explicitly contrast with siblings or state when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
okta_list_sessionsARead-onlyIdempotent
List all stored authentication sessions.
Returns metadata for every saved session including the domain, when it was saved, and cookie/origin counts. Does NOT verify if sessions are still valid — use okta_check_session for that.
Returns: JSON: {"count": int, "sessions": [{url, domain_key, saved_at_iso, cookie_count, origin_count}]}
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true and destructiveHint=false. The description adds valuable behavioral context beyond annotations, notably that the tool does NOT verify session validity. This helps the agent understand a key limitation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is highly concise: two short paragraphs and a return format example. It front-loads the purpose, explains the limitation in one sentence, and provides the output format. Every sentence provides necessary information without repetition.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no parameters and an output schema described inline, the description covers the tool's behavior, return format, and limitation about session validity. It does not mention error handling or rate limits, but for a simple read-only list tool with good annotations, it is sufficiently complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has no parameters, so the input schema fully covers them (100% coverage). The description is not required to add parameter details, achieving the baseline of 4 for zero-parameter tools.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'List all stored authentication sessions' with a specific verb and resource. It distinguishes from sibling tools by explicitly stating it does NOT verify session validity and directs users to okta_check_session for that purpose.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides a clear context for when to use the tool (listing all sessions) and an explicit alternative for verification (okta_check_session). It does not cover when to use versus other siblings like okta_login or okta_delete_session, but the purpose is distinct enough.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
okta_loginAIdempotent
Authenticate to a website via Okta SSO and persist the session.
Launches a headless browser, navigates to the target URL, performs Okta login (including TOTP MFA if configured), and saves the browser session for later use. Sessions are stored per-domain in ~/.okta-auth/sessions/.
Credentials are resolved in order: explicit parameter → environment variable
→ OS keyring when the local provider is set to keyring. When the provider
is set to op, launch the server through op run so the environment is
populated at process start.
Args: url: Target URL to authenticate against (e.g., 'https://portal.company.com'). username: Okta username or email. Falls back to OKTA_USERNAME or stored keyring data. password: Okta password. Falls back to OKTA_PASSWORD or stored keyring data. totp_secret: Base32 TOTP secret for automated MFA. Falls back to OKTA_TOTP_SECRET or stored keyring data. headed: Show the browser window during login. Set to true for debugging. timeout_ms: Maximum time in ms to wait for page loads (5000-300000, default 60000).
Returns: JSON: {"success": bool, "domain_key": str|null, "message": str, "url": str}
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | ||
| headed | No | ||
| password | No | ||
| username | No | ||
| timeout_ms | No | ||
| totp_secret | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Beyond the annotations (idempotent, non-destructive), the description reveals that the tool launches a headless browser, performs TOTP MFA if configured, persists sessions to ~/.okta-auth/sessions/, and details credential fallback logic. This provides substantial behavioral context that aids agent decision-making.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise and well-structured: opening purpose sentence, brief behavioral overview, standalone credential resolution paragraph, clearly labeled Args section, and Returns specification. Every sentence contributes value without redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (6 parameters, 1 required, credential fallback, MFA handling, session persistence), the description covers the overall flow, parameter details, return format, and credential resolution. The output schema is described in the Returns section, making it self-contained. Minor details like error handling could be inferred from the 'message' field in the return.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage, the description fully compensates by documenting all 6 parameters in an Args section. It explains fallback order for credentials (explicit → env var → keyring), the purpose of 'headed' for debugging, and timeout range/default. This adds critical meaning beyond the schema's bare names and types.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The first sentence clearly states the tool's function: 'Authenticate to a website via Okta SSO and persist the session.' This specific verb+resource combination immediately distinguishes it from sibling tools (check, list, delete, get_cookies) which deal with session inspection and cleanup.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context for when to use the tool (to perform Okta login including MFA) and gives detailed information about credential resolution order and headed mode for debugging. However, it does not explicitly exclude alternatives or mention when not to use this tool, though the context of sibling tools makes this largely inferable.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
5 tool updates
v0.2.2- First observed
okta_check_session - First observed
okta_delete_session - First observed
okta_get_cookies - First observed
okta_list_sessions - First observed
okta_login
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose: login, check, list, delete, and get cookies. No overlap or ambiguity.
All tools follow a consistent pattern: okta_ + verb_noun (e.g., check_session, list_sessions). Even login is an action verb, fitting the pattern.
5 tools cover the core operations for Okta session management: create, verify, list, delete, and export cookies. Not too few or too many for the scope.
Covers the main lifecycle: login, check, list, delete, and get cookies. Minor gaps like session refresh or logout are handled implicitly (delete functions as logout), but still a solid set.
Maintenance
Related MCP Connectors
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
MCP server for building and testing AI agents with multi-model experimentation and insights.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Related MCP Servers
- Apache 2.0
- AlicenseNot gradedqualityDmaintenanceMCP Server for AI agent identity and authorization. Create, verify, and manage agent identities with trust scores and scoped authorization tokens.MIT
- FlicenseNot gradedqualityDmaintenanceAn MCP server for managing Okta users (CRUD operations) with full OAuth 2.1 compliance, enabling secure integration with Claude Desktop and other MCP clients.-
- AlicenseNot gradedqualityAmaintenanceMCP server for managing Ory Kratos identities, sessions, and authentication flows, enabling AI assistants to perform identity management tasks via natural language.341 npm1MIT