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

# MCP

MCP allow you to extend your agent's capabilities by integrating external MCPs and utilize MCP tools.

## Steps

<Steps>
  <Step title="Add MCP">
    To use MCP tools, you first need to connect your agent to the MCP server. This step will allow you to authenticate and set up the connection.

    Click on + Add MCP

    <Frame>
      <img height="200" src="https://mintcdn.com/retellai/M9QYKZE4hbt00HfL/images/mcp/sp_mcp.png?fit=max&auto=format&n=M9QYKZE4hbt00HfL&q=85&s=5c3db9b44c10bb543b0a12ab2140cb61" data-path="images/mcp/sp_mcp.png" />
    </Frame>

    Add MCP Configuration

    <Frame>
      <img height="200" src="https://mintcdn.com/retellai/M9QYKZE4hbt00HfL/images/mcp/add_mcp.png?fit=max&auto=format&n=M9QYKZE4hbt00HfL&q=85&s=13912eadf9db9240e285b4fcc1ac8326" data-path="images/mcp/add_mcp.png" />
    </Frame>
  </Step>

  <Step title="Set request headers (optional)">
    You can define custom headers to include with the request Retell sends to your MCP Server.

    <Frame>
      <img height="200" src="https://mintcdn.com/retellai/32uO5g9DswfoJ9j7/images/custom-function/headers.png?fit=max&auto=format&n=32uO5g9DswfoJ9j7&q=85&s=44295c732912fcb1c3f29259e3f59609" data-path="images/custom-function/headers.png" />
    </Frame>
  </Step>

  <Step title="Set query parameters (optional)">
    You can define query parameters to include in the request URL that Retell appends to your MCP Server Endpoint.

    <Frame>
      <img height="200" src="https://mintcdn.com/retellai/YMPW7mFNipo6shGp/images/custom-function/query-params.png?fit=max&auto=format&n=YMPW7mFNipo6shGp&q=85&s=0a0ccd469644d04aa87c086a8dc68bfb" data-path="images/custom-function/query-params.png" />
    </Frame>
  </Step>

  <Step title="Select Tool">
    Select the MCP tool from the list of tools available

    <Frame>
      <img height="200" src="https://mintcdn.com/retellai/M9QYKZE4hbt00HfL/images/mcp/add_tool.png?fit=max&auto=format&n=M9QYKZE4hbt00HfL&q=85&s=846b1eede893d7dafb2bb1a151cef77b" data-path="images/mcp/add_tool.png" />
    </Frame>
  </Step>

  <Step title="Set response variables (optional)">
    Extract values from the MCP tool response and save them as <strong>dynamic variables</strong> for use later in the conversation.

    For example, you can extract a user’s name from the response and reference it later using <code>\{\{user\_name}}</code>.

    Example response body

    ```javascript theme={null}
    {
      "properties": {
        "user": {
          "name": "John Doe",
          "age": 26
        }
      }
    }
    ```

    <Frame>
      <img height="200" src="https://mintcdn.com/retellai/32uO5g9DswfoJ9j7/images/custom-function/response-variables.png?fit=max&auto=format&n=32uO5g9DswfoJ9j7&q=85&s=389a898c0ab3705d3a83acb61a3a4634" data-path="images/custom-function/response-variables.png" />
    </Frame>
  </Step>

  <Step title="Save the MCP Tool">
    Click the save button
  </Step>

  <Step title="Update prompt for function">
    It’s best to include in the prompt explicitly when is the best time to invoke the mcp tool. For example:

    ```
    When user states his name and phone number, please call tool `verify_user` function.
    ```
  </Step>
</Steps>
