Secure Authentication for AI Agents using Model Context Protocol

arcade · Tech · 2025 · source Agentic: yes · promotional bias: med · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: MCP agent authentication and authorization

Arcade identified that MCP servers can call external APIs for agents, but the protocol lacked a secure way for servers to gather third-party credentials such as OAuth bearer tokens without exposing secrets to the MCP client.

Constraints:

Architecture

Arcade proposes URL elicitation: the MCP server requests that the client open a browser URL for sensitive flows, the user authenticates or consents in the trusted browser/auth-provider context, and the trusted server manages tokens, state, scopes, and audit trails. Forms remain for non-sensitive elicitation, while URL mode bypasses the client entirely for credentials.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  A["AI agent"] --> B["MCP client"]
  B --> C["MCP server"]
  C --> D["Browser URL flow"]
  B --> D
  D --> E["Auth provider"]
  E --> F["Token and scope manager"]
  C --> F
  C --> G["External API"]
  F --> G
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
AI agent Requests tool actions such as searching Gmail or invoking external integrations. MCP client
MCP client Untrusted/public client that can open URLs but should not handle sensitive credentials. AI agent, MCP server, Browser URL flow
MCP server Trusted server that initiates authorization, validates state, stores tokens, and calls external APIs. MCP client, Browser URL flow, Token and scope manager, External API
Browser URL flow Trusted browser navigation context for OAuth, payment, WebAuthn, or SAML flows. MCP client, MCP server, Auth provider
Auth provider Handles user authentication and consent for the external service. Browser URL flow, Token and scope manager
Token and scope manager Server-side storage and enforcement of tokens, state, scopes, expiration, and audit trails. MCP server, Auth provider, External API
External API The third-party service the agent wants to call after secure authorization. MCP server, Token and scope manager

Data flow

An AI agent invokes an MCP server that needs a third-party API; the server checks whether a valid token exists; if not, it generates secure state and returns a URL elicitation request; the MCP client opens the browser URL without seeing credentials; the user authenticates with the provider; the trusted server validates state, stores tokens, enforces scopes, and then calls the external API on behalf of the agent.

3 supporting quotes
“Your MCP server needs to make authenticated requests to external APIs. But MCP has no secure credential gathering mechanism.”article, stated
“The client just opens the URL. For the client, that means no token handling, no state management, no security responsibilities.”article, stated
“Server (trusted): Manages tokens, validates state, enforces scopes”article, stated

Why this architecture

Arcade chose browser-based URL elicitation because it mirrors battle-tested OAuth security boundaries: the user interacts with a trusted browser and provider, the trusted server handles tokens and scopes, and the untrusted MCP client never sees credentials.

3 supporting quotes
“The core insight: leverage the browser as a trusted security context, just like OAuth 2.0 has done successfully for 15+ years.”article, stated
“form elicitation flows data through the client, URL elicitation bypasses the client entirely.”article, stated
“This mirrors established web security patterns. The MCP client never touches credentials”article, stated

Scale

Alternatives considered (roads not taken)

Service account tokens with excessive scopes

Rejected because: This is listed as one of the insecure workarounds developers are forced into without credential gathering.

“Service account tokens with excessive scopes”article, stated

Pass tokens through the MCP client

Rejected because: It violates least privilege and exposes credentials to untrusted clients.

“Passing tokens through the MCP client (violating the principle of least privilege)”article, stated

Use form elicitation for sensitive credentials

Rejected because: Form elicitation flows data through the client and is unsuitable for credentials.

“Elicitation via forms doesn’t work for credentials or sensitive data”article, stated

Client-side credential storage

Rejected because: The post calls out token exfiltration risk and public-client secret storage limits.

“Client-side credential storage (hello, token exfiltration risks)”article, stated
“MCP clients are often untrusted code running on user devices. They’re OAuth 2.0 “public clients” that can’t securely store secrets.”article, stated

Patterns

tool-use-orchestration (agent-integration)

MCP servers expose external API tools to agents, but production use requires server-side authorization flows around those tools.

“Your AI agent needs to search Gmail for that weekly report. You’ve built an MCP server, the tool definition, everything’s wired up perfectly.”article, stated

safety-policy-enforcement (security)

URL elicitation enforces security boundaries so credentials bypass the MCP client and remain managed by trusted server/auth-provider components.

“URL elicitation bypasses the client entirely.”article, stated
“This mirrors established web security patterns. The MCP client never touches credentials, preventing entire classes of attacks:”article, stated

human-in-the-loop-gate (authorization)

Sensitive flows route through a browser where the user authenticates, consents, pays, or completes an enterprise identity step.

“* URL mode: Direct browser navigation for sensitive flows (OAuth 2.0, payments, WebAuthn, SAML)”article, stated
“3. Auth provider (trusted): Handles user authentication, consent”article, stated

Tradeoffs

Use URL elicitation for sensitive flows.

Chose direct browser navigation to trusted auth endpoints over forms or client-side token passing.

Rationale: The browser/auth-provider/server path preserves established OAuth-style security boundaries.

“Our initial proposal introduced a new client capability for user interactions. The core insight: leverage the browser as a trusted security context, just like OAuth 2.0 has done successfully for 15+ years.”article, stated

Keep token management server-side.

Chose trusted server validates state, stores tokens, and enforces scopes over letting the MCP client handle token state.

Rationale: The MCP client is a public/untrusted client and should have no credential-handling responsibilities.

“Or, something other than OAuth entirely: a redirect to a payment portal, enterprise IDP login page, etc. The client just opens the URL. For the client, that means no token handling, no state management, no security responsibilities.”article, stated

Gotchas (what bit them)

MCP's client-server authentication did not solve third-party credentials.

Root cause: The protocol lacked a secure mechanism for servers to obtain OAuth tokens for external APIs.

Resolution: Add URL elicitation so servers can redirect users to secure endpoints while credentials stay out of the client.

“While the protocol handles client-server authentication beautifully, it completely lacks a mechanism for servers to securely obtain third-party credentials.”article, stated

Existing workarounds violated least privilege or exposed tokens.

Root cause: Developers used service accounts, hardcoded credentials, token passing, or client-side storage to bridge the protocol gap.

Resolution: Move credential gathering to browser URL flows and server-managed token storage.

“This isn’t just bad UX—it’s a fundamental security architecture flaw. MCP clients are often untrusted code running on user devices. They’re OAuth 2.0 “public clients” that can’t securely store secrets. Yet today, that’s exactly what developers are forced to do.”article, stated
“* Token exfiltration via compromised clients”article, stated

Form-based elicitation cannot safely handle credentials.

Root cause: Form elicitation sends sensitive data through the client execution context.

Resolution: Use URL mode for OAuth, payments, WebAuthn, and SAML so sensitive flows bypass the client.

“form elicitation flows data through the client, URL elicitation bypasses the client entirely.”article, stated

Evaluation

The post evaluates the design through security-review criteria: token exposure, least privilege, state validation, CSRF/state management, audit trails, and compatibility with established OAuth patterns.

Metrics: credential exposure · scope enforcement · state validation · audit trails · contributors reviewing attack vectors

“The proposal sparked extensive discussion and security review with 50+ contributors examining attack vectors, CSRF protections, and state management.”article, stated
“* Audit trails: Track what actions were taken with which authorizations”article, stated

Outcomes

The post frames the design for real agents with multiple auth providers and many production integrations.

3 supporting quotes
“With proper authorization, MCP servers are one step closer to being production-ready:”article, stated
“By adding a mechanism that respects the security boundaries of the client”article, stated
“*Want to build AI agents that actually work in production? While we wait for authorization to land in MCP, Arcade already implements secure auth for 100+ integrations. No bot tokens, no security nightmares—just real OAuth flows that work.*”article, stated