Share via


Extend your agent with Model Context Protocol (preview)

Another way to extend your agent with actions is via Model Context Protocol (MCP).

What is Model Context Protocol?

Model Context Protocol (MCP) allows users to connect with existing knowledge servers and data sources directly within Copilot Studio. Connecting to an MCP server gives you access to:

  • Resources: File-like data that client applications can read (like API responses or file contents)
  • Tools: Functions a language model can call
  • Prompts: Predefined prompt templates to accomplish specific tasks

Note

Copilot Studio currently only supports tools.

How does MCP work?

Each tool published by the MCP server is automatically added as an action in Copilot Studio. Name, description, inputs, and outputs are inherited from the server. As tools are updated or removed on the MCP server, Copilot Studio dynamically reflects these changes, ensuring users always have the latest versions and that obsolete tools are removed. A single MCP server can integrate and manage multiple tools, each accessible as an action within Copilot Studio.

Note

Generative Orchestration must be enabled to use MCP.

Supported transports

In MCP, transports are the foundation for client-server communication. Transports handle the mechanics of sending and receiving messages. Currently, Copilot Studio only supports the Server-Sent Events (SSE) transport.

What is the process for integrating MCP in Copilot Studio?

To integrate MCP in Copilot Studio:

  1. Create an MCP server.
  2. Create a custom MCP connector using the YAML schema provided below.
  3. Consume via Copilot Studio by adding the MCP as an action to an agent.
  4. (Optional) Publish connector for cross tenant consumption.

Create an MCP server

You can use the MCP software development kits (SDKs) to set up an MCP server in one of the supported languages.

Create a custom MCP connector

With your MCP server set up, you must configure a custom connector (via Power Apps or Power Automate) for your MCP server. To carry out this procedure, you need a schema file for your MCP server. The schema file is an OpenAPI specification YAML file that describes the API of your MCP server.

  1. Select Agents in the left navigation.

  2. Select your agent from the list of agents.

  3. Go to the Actions page for your agent.

  4. Select Add an action.

  5. Select New action.

  6. Select New custom connector. You're taken to Power Apps to create a new custom connector.

  7. Select New custom connector.

  8. Select Import OpenAPI file.

  9. Navigate to your schema file and select Import to import the file.

  10. SelectContinue to complete the setup in Power Apps. You can read more about the setup process in the Power Apps documentation at Import the OpenAPI definition.

Note

Make sure your custom connector includes the tags, Agentic, and McpSse, so that they appear in Copilot Studio after creation.

Add an existing MCP action to an agent

You can connect to existing MCP servers directly from within Copilot Studio. To add an existing MCP action to an agent, follow these steps:

  1. Select Agents in the left navigation.

  2. Select your agent from the list.

  3. Go to the Actions page for your agent.

  4. Select Add an action.

  5. Select Connector. A list of connectors, including MCP connectors, is displayed.

  6. Select the desired MCP connector from the list.

  7. Authorize the connection, entering any information that is needed.

  8. When you're done, select Next to proceed.

MCP server schema

Here's a schema file for an MCP server with fictional data, in YAML format. You need to fill in the details for your own MCP server.


swagger: '2.0'

info:
  title: Contoso
  description: MCP Test Specification, showing the MVP spec to work in Copilot Studio
  version: 1.0.0
host: contoso.com
basePath: /
schemes:
  - https
definitions:
  QueryResponse:
    type: object
    properties:
      jsonrpc:
        type: string
      id:
        type: string
      method:
        type: string
      params:
        type: object
      result:
        type: object
      error:
        type: object
paths:
  /sse:
    get:
      summary: MCP Server Actions
      parameters:
        - in: query
          name: sessionId
          type: string
          required: false
      produces:
        - application/json
      responses:
        '200':
          description: Immediate Response
          schema:
            $ref: '#/definitions/QueryResponse'
        '201':
          description: Created and will follow callback
      operationId: InvokeMCP
      tags:
        - Agentic
        - McpSse
securityDefinitions: {}
security: []

Known Issues & Planned Improvements

The following are identified issues the product team is aware of and working on:

Issues Resolution/Workaround
Required inputs to tools aren't always populated with a value. Resolution: Under development.
Currently, the endpoint returned in the Open SSE connection call must be a full URI. Not applicable
Support for Streamable HTTP Resolution: Under development.
The activity map doesn't show the details of the invoked MCP tool yet. Workaround: To view the details of the invoked tool when using the test chat, you can select the "..." menu above the test chat, select "download snapshot," and review the content in the dialog.json file contained within the downloaded ZIP file.
For Python SDK users the following header is returned: "text/event-stream; charset=utf-8" by the SDK. This is causing interoperability issues. Workaround: Please update response header to "text/event-stream" without adding a charset.
Resolution: Under development.