Getting Started
MCP OAuth in agent mode (popup)
Understand how the Emcy agent UI handles OAuth popups, what needs to be configured first, and how to verify that a server is connected.
Agent mode is the Emcy-managed validation path. It is the easiest place to validate a Gateway-backed OAuth flow before you test external clients or embedded apps.
What needs to be true first#
Before popup auth can work, make sure:
- the MCP server uses
OAuth 2.0 - the server is attached to the agent
- the runtime
Server URLis reachable Resourcematches the MCP server audience- the discovery inspector shows the expected auth metadata
For popup-based exchange, also make sure the auth config has the right authorize and token endpoints.
Default callback#
The default Emcy popup callback is:
https://emcy.ai/oauth/callbackIf your auth server allowlist still points at https://emcy.ai/oauth/callback, update it.
How the flow works#
flowchart LR
A["Agent Playground"] --> B["Server shows Needs Auth"]
B --> C["User clicks Sign In"]
C --> D["Popup opens with PKCE"]
D --> E["Auth server login completes"]
E --> F["Emcy callback resolves token"]
F --> G["Server status becomes Connected"]What Emcy resolves for you#
In agent mode, Emcy handles:
- protected-resource and auth-server discovery
- registration mode selection
- popup launch and callback handling
- token storage and refresh
- resource-aware token reuse
That makes agent mode the right place to validate the Todo sample app first.
Suggested validation path#
- Attach the Todo MCP server to an agent.
- Open
Playground. - Trigger a protected tool call.
- Confirm the server shows
Needs Auth. - Complete the popup flow.
- Confirm the server shows
Connected. - Retry the tool call and verify user-scoped Todo data is returned.
Expected modes#
Depending on the auth server metadata, the effective registration mode should be one of:
preregisteredfor local seeded client validationcimdfor Emcy’s Gateway-managed public client identitydcrfor public PKCE DCR fallback
If the inspector or runtime falls back to manual unexpectedly, your metadata is incomplete.
Common failure modes#
- wrong
Resourcevalue: auth succeeds but tool execution fails with audience errors - missing
registration_endpoint: DCR clients cannot register - missing
client_id_metadata_document_supported: Emcy cannot use CIMD - callback allowlist drift: login succeeds at the provider but the popup cannot finish
- wrong
Server URL: auth completes but the agent cannot call the MCP server