Skip to content

Commit 6d568ac

Browse files
Improve MCP Auth docs (#5890)
* Improve MCP Auth docs * Update en/includes/guides/agentic-ai/mcp/index.md Co-authored-by: Pavindu Lakshan <pavindulakshan@gmail.com>
1 parent 38ae85c commit 6d568ac

File tree

1 file changed

+105
-4
lines changed
  • en/includes/guides/agentic-ai/mcp

1 file changed

+105
-4
lines changed
Lines changed: 105 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,112 @@
1-
The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) provides a standardized way for AI agents and applications to interact with model resources. {{ product_name }} offers capabilities to control these interactions, ensuring that access to MCP servers and their resources is secure and well-managed.
1+
## What is MCP Authorization?
22

3-
## [Securing MCP servers]({{base_path}}/guides/agentic-ai/mcp/mcp-server-authorization)
3+
The **Model Context Protocol [MCP](https://modelcontextprotocol.io/)** standardizes how AI agents discover and invoke tools. However, a raw MCP connection is an open pipe: once connected, a client can often invoke *any* tool.
4+
5+
[**MCP Authorization Specification**](https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization) uses OAuth 2.1 for secure client authentication and access delegation.
6+
7+
While satisfying Authorization Server requirements for MCP specification, {{ product_name }} centralizes the management of MCP authorization, making it easier to configure and enforce secure interactions between clients and servers, maintain compliance, and manage permissions efficiently across AI agent ecosystems.
8+
9+
## Architecture: MCP in the Identity Model
10+
11+
In {{ product_name }}'s IAM model, MCP components map directly to standard MCP concepts:
12+
13+
| MCP Concept | IAM Concept | Role |
14+
| :---- | :---- | :---- |
15+
| **MCP Host** | **Agent** | The agent that is using the tools obtained via MCP |
16+
| **MCP Client** | **MCP Client App** | The software component connecting to the MCP Server |
17+
| **MCP Server** | **Resource Server** | Exposes tools as protected API endpoints |
18+
| **Permission** | **OAuth Scope** | Granular permission (e.g., `filesystem:read`, `stripe:charge`) |
19+
| **Connection** | **Authorized Session** | A session backed by a valid Access Token |
20+
21+
!!! note
22+
- A user can connect to the MCP Server using an MCP Client.
23+
- An agent (MCP Host) can connect to the MCP Server using an MCP Client.
24+
- An agent (MCP Host) is capable of connecting to multiple MCP Servers, utilizing multiple MCP Clients for each connection.
25+
- A user can access and grant permission to access the MCP Server using an MCP Client.
26+
- The MCP Server can validate the access token and grant access to the user, agent, or both, based on the context.
27+
28+
## [Registering MCP servers and configuring permissions]({{base_path}}/guides/agentic-ai/mcp/mcp-server-authorization/)
429

530
MCP servers can be registered as protected resources in {{ product_name }}. This setup allows administrators to define precise access controls for each server and their tools and resources, specifying which clients or users are authorized to interact with it. By securely exposing remote MCP servers, organizations can maintain consistent authorization rules and minimize the risk of unauthorized access to MCP servers and their tools, and protect underlying business resources.
631

7-
## [Setting up MCP clients]({{base_path}}/guides/agentic-ai/mcp/register-mcp-client-app)
32+
!!! info
33+
Refer to the [MCP Server Authorization guide]({{base_path}}/guides/agentic-ai/mcp/mcp-server-authorization/) for detailed steps on registering MCP servers and configuring scopes for fine-grained access control.
34+
35+
## [Setting up MCP clients]({{base_path}}/guides/agentic-ai/mcp/register-mcp-client-app/)
836

937
An MCP client is a connection component that host applications use to interface with MCP servers through dedicated, stateful sessions. When connecting to an MCP server, you can register the client in {{ product_name }}, which also creates an OAuth 2.1 client meeting the necessary standards. Clients can be authorized with specific scopes that define their permitted access to MCP servers, ensuring they operate only within authorized boundaries and maintain a secure ecosystem for model interactions.
1038

11-
Through these features, {{ product_name }} centralizes the management of MCP authorization, making it easier to enforce secure interactions between clients and servers, maintain compliance, and manage permissions efficiently across AI agent ecosystems.
39+
!!! info
40+
Refer to the [MCP Client Registration guide]({{base_path}}/guides/agentic-ai/mcp/register-mcp-client-app/) for detailed steps on setting up MCP clients and authorizing them to access MCP servers.
41+
42+
## Authentication and Authorization Flows
43+
44+
How does an agent actually get a token to talk to the MCP Server? There are a few main patterns.
45+
46+
### Pattern A: Connecting to the MCP server with user delegation (OBO)
47+
48+
Use this when an MCP client acts on a user's behalf (e.g., a Desktop Copilot).
49+
50+
1. **Connect Request**: User clicks "Connect Finance Tools" in the client UI.
51+
2. **Redirect**: The user gets redirected to the {{ product_name }} authorization endpoint.
52+
3. **Consent**: User sees: *"Research Assistant wants to access Finance Tools"*.
53+
- **Scopes**: `finance:read_reports`
54+
4. **Grant**: User approves. {{ product_name }} issues an **Authorization Code**.
55+
5. **Token Exchange**: MCP client exchanges code for an **Access Token**.
56+
6. **Invocation**: MCP client sends MCP Initialize request with `Authorization: Bearer <token>`.
57+
58+
### Pattern B: MCP Client authenticating on its own (M2M)
59+
60+
Use this for backend MCP clients running without a user interface.
61+
62+
1. **Token Request**: MCP client invokes {{ product_name }}'s `/token` endpoint directly using **Client Credentials** (client ID and Secret).
63+
2. **Validation**: {{ product_name }} checks if this MCP client is authorized for the requested MCP Server resource.
64+
3. **Issuance**: {{ product_name }} returns an **Access Token** (`sub`= MCP client's ID).
65+
4. **Invocation**: The MCP client connects to the MCP Server with the token.
66+
67+
### Pattern C: Delegated Agent (OBO + Agent Identity)
68+
69+
Neither of the above patterns identifies the agent (MCP Host) as a principal identity. The token only contains the user or the client identity. This is a problem for auditing and fine-grained authorization, where the actual entity with the brain to do all the planning, reasoning, and taking actions is not represented.
70+
71+
This new flow outlines the steps for an Agent (MCP Host) to register its identity, obtain authorization, and interact with the MCP Server on behalf of a user.
72+
73+
#### Setup and Registration
74+
75+
1. **Agent Identity Registration:** The Agent/MCP Host is registered as an **Agent Identity** within {{ product_name }}.
76+
2. **Client Registration:** An MCP Client is registered and authorized to establish a connection with the MCP Server.
77+
78+
#### Agent-Only Authentication
79+
80+
1. **Agent Authentication:** The Agent authenticates itself using its own credentials to acquire a **Token**.
81+
2. **Agent Connection (Without User):** The Agent can utilize this Actor Token to connect to the MCP Server, provided it possesses the necessary permissions, even when a user is not present.
82+
83+
#### User-Delegated Authentication (On-Behalf-Of Flow)
84+
85+
1. **Initiating User Authentication:** When a user is available, the Agent starts an On-Behalf-Of (OBO) flow, specifying the MCP client as the OAuth client and itself as the desired actor (`requested_actor`).
86+
2. **User Delegation:** The user logs in and explicitly grants access delegation to the Agent.
87+
3. **Code Exchange:** The Agent receives the authorization code and exchanges it for a new token. This new token includes both the user's identity (`sub`) and the agent's identity (`act`) claims, along with the permissions delegated by the user.
88+
4. **Invocation:** The Agent now invokes the MCP Server using the token, which identifies both the user and the Agent as the actor. This dual-identity token enables enhanced auditing and fine-grained authorization on the MCP Server. The MCP Server can:
89+
- Make authorization decisions based on both the user's delegated permissions to the Agent for a specific action and the Agent's own identity and permissions.
90+
- Log which Agent executed the action for comprehensive auditing purposes.
91+
92+
!!! note
93+
While the MCP Authorization specification doesn't currently mandate identifying the MCP Host (agent) with its own credentials and permissions, this is a crucial {{ product_name}} implementation. It enables secure, auditable agentic systems for autonomous agents by providing clear attribution, better permission management, clear auditability, and enhanced security.
94+
95+
## Supported Specifications
96+
97+
{{ product_name }} supports a comprehensive set of OAuth 2.0, OpenID Connect, and extended specifications to ensure secure and standardized authorization for MCP, including:
98+
99+
| Specification | Use Case in MCP |
100+
| :--- | :--- |
101+
| **OAuth 2.1 (Draft)** | The foundation for the MCP Authorization specification, ensuring security best practices. |
102+
| **OpenID Connect Core 1.0** | Verifies the identity of user and/or agent interactions. |
103+
| **OpenID Connect Discovery 1.0** | Allows MCP Clients to automatically discover authorization endpoints and configurations. |
104+
| **OpenID Connect Dynamic Client Registration 1.0** | Enables dynamic onboarding of MCP Clients. |
105+
| **OAuth 2.0 Pushed Authorization Requests (PAR)** | Enhances security by preventing authorization parameters from being exposed in the URL. |
106+
107+
## What's Next?
108+
109+
Get hands-on with MCP server authorization,
110+
111+
- 📖 [**MCP Server Quick Start - TypeScript**]({{base_path}}/quick-starts/mcp-auth-server/)
112+
- 📖 [**MCP Server Quick Start - Python**]({{base_path}}/quick-starts/mcp-auth-server-py/)

0 commit comments

Comments
 (0)