Skip to content

Conversation

@yaron2
Copy link
Member

@yaron2 yaron2 commented Dec 10, 2025

This PR adds documentation for authenticating MCP clients and servers using Dapr OAuth2 middleware components.

Signed-off-by: yaron2 <schneider.yaron@live.com>
@yaron2 yaron2 requested review from a team as code owners December 10, 2025 06:25
@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://kind-hill-063ba6c1e-4972.westus2.5.azurestaticapps.net

@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-bush-04c343a1e-4972.westus2.4.azurestaticapps.net

1 similar comment
@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-bush-04c343a1e-4972.westus2.4.azurestaticapps.net

@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://kind-hill-063ba6c1e-4972.westus2.5.azurestaticapps.net

Signed-off-by: yaron2 <schneider.yaron@live.com>
@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://kind-hill-063ba6c1e-4972.westus2.5.azurestaticapps.net

@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-bush-04c343a1e-4972.westus2.4.azurestaticapps.net

@CasperGN
Copy link
Contributor

@yaron2 same comment for this one as in #4973

Copy link
Member

@msfussell msfussell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed. PTAL

title: "MCP"
linkTitle: "MCP"
weight: 25
description: "Dapr helps developers run secure and reliable MCP servers"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: "Dapr helps developers run secure and reliable MCP servers"
description: "Dapr helps developers run secure and reliable Model Context Protocol (MCP) servers"


## Overview

The MCP specification does not mandate any form of authentication between an MCP client and server. The security model is left to the user to plan and implement, which creates a maintanance burden on developers and opens up MCP servers to various attack surfaces.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The MCP specification does not mandate any form of authentication between an MCP client and server. The security model is left to the user to plan and implement, which creates a maintanance burden on developers and opens up MCP servers to various attack surfaces.
The MCP specification. (https://modelcontextprotocol.io/specification/) does not mandate any form of authentication between an MCP client and server. The security model is left to the user to plan and implement. This creates a maintenance burden on developers and opens up MCP servers to various attack surfaces.

* Performing privileged actions on behalf of a user
* Exposing tools that must be permission-gated

Dapr enables seamless OAuth2 authentication between MCP clients and servers using [middleware]({{% ref "middleware" %}}) components.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Dapr enables seamless OAuth2 authentication between MCP clients and servers using [middleware]({{% ref "middleware" %}}) components.
Dapr enables OAuth2 authentication between MCP clients and servers using [middleware]({{% ref "middleware" %}}) components.


Dapr allows developers and operators to model remote HTTP services as resources that can be governed and invoked using the Dapr [Service Invocation API]({{% ref "service-invocation-overview" %}}).

```yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a description of what is happening in the steps that follow. Create a component for HTTPEndpoint etc.

value: "<comma-separated scopes>"
```

Next, create the configuration component.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Next, create the configuration component.
Next, create the configuration resource.


async def main():
# Address of the Dapr process
server_url = "http://localhost:3500/"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a comment that best to use an env var for this in prod code.


### Run the MCP client with Dapr

Put the YAML files above in `components` directory and run Dapr:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Put the YAML files above in `components` directory and run Dapr:
Put the YAML files above into a `components` directory and run Dapr:

dapr run --app-id mcpclient --resources-path ./components --dapr-http-port 3500 --config ./config.yaml -- python mcpclient.py
```

If properly configured, the MCP client will cause Dapr to kick off an OAuth2 pipeline before connecting to the MCP server.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If properly configured, the MCP client will cause Dapr to kick off an OAuth2 pipeline before connecting to the MCP server.
If properly configured, the MCP client causes Dapr to start an OAuth2 pipeline before connecting to the MCP server.


### Define the OAuth2 middleware and configuration components

We define a middleware component the same as above.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
We define a middleware component the same as above.
Define a middleware component the same as the client example.

dapr run --app-id mcpclient --resources-path ./components --dapr-http-port 3500 --config ./config.yaml -- python mcpserver.py
```

If properly configured, Dapr will kick off an OAuth2 pipeline when a request for the MCP server arrives.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If properly configured, Dapr will kick off an OAuth2 pipeline when a request for the MCP server arrives.
If properly configured, Dapr will starts an OAuth2 pipeline when a request for the MCP server arrives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants