> ## Documentation Index
> Fetch the complete documentation index at: https://www.truefoundry.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Govern Copilot Studio agents with DCR

> Govern Copilot Studio agents with Dynamic Client Registration (DCR)

Use this checklist to connect Copilot Studio to the MCP server with Dynamic Client Registration (DCR). Each user signs in, and the gateway attributes each call to that user. When you finish, your Copilot Studio agent appears in the TrueFoundry Agent Registry, and its egress and ingress calls go through the gateway with governance applied, including user identity and RBAC.

Complete these steps for each imported agent.

## Steps at a glance

1. [Add the MCP server to the gateway](#add-mcp-to-gateway)
2. [Grant user access to the MCP server](#grant-user-access-to-mcp)
3. [Point the connector at the gateway](#update-mcp-to-gateway-url)
4. [Update connector authentication to use DCR](#update-auth-to-use-dcr-auth-config)

## Add the MCP server to the gateway

Register the MCP HTTPS endpoint in the gateway. The connector calls the gateway URL for this server.

> [!NOTE]
>
> If the MCP server is already added to the gateway, skip this section. You still need its gateway URL for the connector step.

1. If the MCP server isn't registered yet, register it. Getting started: [MCP Server Getting Started](https://www.truefoundry.com/docs/ai-gateway/mcp/mcp-server-getting-started.md).
2. If the MCP server authentication isn't set yet, open **Auth Data** and select the method the upstream server expects: **API Key**, **OAuth2**, **AWS SigV4**, or **Token Passthrough**. See [Outbound Authentication](https://www.truefoundry.com/docs/ai-gateway/mcp/mcp-gateway-auth-security.md#outbound-authentication) to choose.
3. Save the MCP server.
4. Copy the gateway URL for the server from **How To Use** section. You need it in the connector step below.

## Grant user access to the MCP server

Callers are users or teams, not agents or virtual accounts. Grant **MCP Server User** to each user or team that will connect.

1. Open the MCP server in the gateway.
2. Go to **⋯ → Access Control**.
3. Select **Grant Access**, select the role **MCP Server User**, choose the user or team, and save.

> [!WARNING]
>
> Without this grant, the gateway returns **403** for the user.

## Point the connector at the gateway

Create a **new** custom connector for each agent. Don't reuse or change another agent's connector since that may affect the other agent.

When you build the connector:

* Use the gateway URL for this server.
* Split `https://<gateway-host>/<gateway-path>` into swagger `host` = `<gateway-host>` and path = `/<gateway-path>`, with **`basePath: /`**.
* Build the connector in **Power Apps**, not in the Copilot Studio MCP wizard.

> [!NOTE]
>
> Keep `basePath: /` and put the full path under `paths:`. If you put the path only in `basePath`, the import succeeds but the server isn't registered as an MCP operation, so the tool list stays empty.

### Create the new gateway connector

> [tab] Portal
>
> 1. Go to **Power Apps → Custom connectors → New → Import an OpenAPI file**.
> 2. Use this definition:
>
> ```yaml theme={"dark"}
> swagger: '2.0'
> info:
>   title: My MCP via Gateway
>   version: '1.0.0'
> host: <gateway-host>
> basePath: /
> schemes: [https]
> paths:
>   /<gateway-path-for-this-server>:
>     post:
>       summary: MCP server
>       operationId: InvokeMCP
>       x-ms-agentic-protocol: mcp-streamable-1.0
>       responses:
>         '200':
>           description: Success
> ```
>
> 3. Set the **Security** tab as described in [Update connector authentication to use DCR](#update-auth-to-use-dcr-auth-config).
> 4. Select **Create**.
> 5. In Copilot Studio, open the agent and go to **Tools → Add a tool → MCP**. Search for the new connector, select it and create a connection.
> 6. Test the new connector. If the agent already had an older connector for this server, remove it from the agent. Then select **Publish** to apply the changes.
> 7. Delete the old connector in **Power Apps → Custom connectors** only if no other agent uses it.

> [tab] Azure CLI / Power Apps API
>
> Use the `paconn` CLI to create the connector from two files.
>
> 1. Save the gateway swagger as `apiDefinition.swagger.json`. This is the Portal tab definition written as JSON, because `paconn` can't read YAML. Replace `<gateway-host>` and `<gateway-path-for-this-server>` with the values for this server.
>
> ```json apiDefinition.swagger.json theme={"dark"}
> {
>   "swagger": "2.0",
>   "info": {
>     "title": "My MCP via Gateway",
>     "version": "1.0.0"
>   },
>   "host": "<gateway-host>",
>   "basePath": "/",
>   "schemes": ["https"],
>   "paths": {
>     "/<gateway-path-for-this-server>": {
>       "post": {
>         "summary": "MCP server",
>         "operationId": "InvokeMCP",
>         "x-ms-agentic-protocol": "mcp-streamable-1.0",
>         "responses": {
>           "200": {
>             "description": "Success"
>           }
>         }
>       }
>     }
>   }
> }
> ```
>
> 2. Save `apiProperties.json` with no connection parameters. This sets **No authentication**, so you don't need an Entra app for this connector.
>
> ```json apiProperties.json theme={"dark"}
> {
>   "properties": {
>     "connectionParameters": {}
>   }
> }
> ```
>
> 3. Create the connector in the agent's Power Platform environment:
>
> ```bash theme={"dark"}
> export ENV_ID="<power-platform-environment-id>"
>
> paconn create -e "$ENV_ID" \
>   --api-def apiDefinition.swagger.json \
>   --api-prop apiProperties.json
> ```
>
> 4. In Copilot Studio, add the new connector to the agent and test it, as in the Portal tab. Then remove the old connector from the agent, if there was one, and delete it only if no other agent uses it.

> [!WARNING]
>
> Without this step, the agent's MCP calls don't go through the gateway, so they can't be governed.

## Update connector authentication to use DCR

Update the existing connector's authentication so users connect through DCR.

1. In **Power Apps**, go to **Custom connectors**, open the connector, and select **Security**.
2. Set **Authentication type** to **No authentication**. Copilot Studio uses DCR to connect to the gateway.
3. Select **Update connector**.
4. In Copilot Studio, reconnect (or recreate the connection) so each user signs in through DCR.

> [!WARNING]
>
> Without this step, user identity is not propagated, and the gateway cannot identify the user making the call.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.