Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Query Routing Director Using MCP

Use this topic to use Model Context Protocol (MCP) to query Routing Director.

Note: MCP support is a beta feature in this release.

MCP Overview and Implementation

Juniper Routing Director leverages the Model Context Protocol (MCP) to enable AI agents—such as Microsoft Copilot, ChatGPT, and Claude—to establish a secure connection. Through this integration:

  • Network operators can use AI agents to query Routing Director.

  • AI agents can access Routing Director as a data source and provide network operators with accurate, context‑aware responses to queries.

The MCP package is stored in the GitHub repository as an open source code under https://github.com/Juniper/routing-director-mcp-server and distributed through the MCP registry.

Benefits

The MCP server helps network operators to query network data, create dashboards, and access KPIs conversationally instead of writing code or learning complex API syntax.

Deploy an MCP Server

The following are the pre-requisites to deploy an MCP server on a host (for example, your laptop):

  • Python versions 3.10 or 3.11.

  • Access to Routing Director with valid UI authentication credentials (username and password or API token)

  • Reachability to Routing Director API

  • Create a Python virtual environment to install packages required for running the MCP server.

The following are the steps to deploy an MCP Server:

  1. Download the MCP package from the GitHub MCP repository and the official MCP registry.

    The source code is maintained in GitHub repository under https://github.com/Juniper/routing-director-mcp-server.

  2. In a Python virtual environment, install all requirements defined in the requirement.txt file from the MCP package by using pip3 install -r requirements.txt.

  3. Create the MCP server configuration file (config.json).

    The configuration file specifies how to reach Routing Director, how to authenticate, and which component APIs to expose as tools for querying Routing Director. The following is a sample of the configuration file:

    The following is a sample MCP server configuration file:

    Where,

    • http_url is the base URL of Routing Director.

    • org_id is the unique Identifier of the organization in Routing Director that you want to query.

    • auth defines the authentication. Define the following under auth:

      • type—authentication method to connect to Routing Director. It can take the values—basic or token

        If you enter basic, enter values for:

        • username—Username to access Routing Director.

        • password—Password for the username.

        If you enter token, enter an API token generated by Routing Director. For example:

        For generating API tokens in Routing Director, see Manage API Tokens.

    • components is the list of Routing Director components that can be queried. Components can take one of the following values:

      • ems—Use the ems component to search, acknowledge or unacknowledge alarms reported on Routing Director.

      • juniper-resiliency-interface—Use the juniper-resiliency-interface component to fetch forwarding, routing, and OS exception events generated by Juniper Resiliency Interface (JRI) and collected by Routing Director.

      • device-kpi—Use the device-kpi component to retrieve device system log messages that are collected by Routing Director.

      components is an optional parameter. If components is not defined, all the components are considered.

  4. (Optional) Enable authentication between MCP server and MCP client.

    You can use file-based token authentication for communication between an MCP client and MCP server. To generate a token, execute the following command in your local system:

    Where, client-id is an ID that you use for generating the authentication token.

    The following is a sample of the generated output:Save the generated token in a .tokens file. By default, the token is saved in the root directory of the GitHub MCP repository.
  5. Start the MCP server.

  6. Configure an AI agent to communicate with the MCP Server. See Configure an AI Agent to Communicate with MCP Server.

    An AI agent can use both stdio and streamable-http as a transport mode to communicate with the MCP server.

You can now query data from Routing Director by using an AI agent such as Microsoft Copilot or ChatGPT.

Configure an AI Agent to Communicate with MCP Server

After the MCP server is configured, you must configure an AI agent to communicate with the MCP server. You can configure the MCP server connection in the AI agent's setting. This section provides the steps to configure connection to MCP server through Claude and Copilot.

Configure Claude

To configure Claude:

  1. Open the Claude configuration file in a text editor.

    • On a macOS machine, run the following command in the Terminal:

    • On a Windows machine, open command prompt and enter:

  2. Add your MCP server configuration as shown below:

  3. Save the file.

  4. Restart Claude.

  5. Verify the connection of Claude with MCP server.

    Claude is connected to the MCP server if the MCP server tools (API Calls) are listed under + > Connectors.

    Alternatively, you can view MCP server tools (API calls) listed in VS code Extensions.

    To ensure that the MCP server has started correctly, view the MCP server logs. The logs are generated based on the type of communication with the AI agent:

    • Starting MCP server 'Juniper Routing Directory' with transport 'stdio' if stdio is used.

    • INFO Starting MCP server 'Juniper Routing Directory' with transport 'http' on http://127.0.0.1:30030/mcp if streamable-http is used.

Configure Copilot

To configure Copilot:

  1. Open Virtual Studio (VS) code.

    Alternatively, you can use any other Integrated Development Environment (IDE) that supports Copilot and MCP server,

  2. Open the MCP settings file using one of the following methods:

    • On a macOS, run the following command in the Terminal:

      Where, user is your username on the macOS machine.

    • On a Windows machine, open command prompt and enter:

      Where, user is your username on the Windows machine.

  3. Add the MCP server configuration to the settings file as shown below:

    Where,

  4. Save the file.

  5. Close and reopen VS code for the MCP configuration changes to take effect.

  6. Verify that Copilot is connected with the MCP server.

    Copilot is connected to the MCP server if you find messages indicating successful connection to the MCP server in the Output panel of VS code.

    Alternatively, you can view MCP server tools (API calls) listed in VS code Extensions.

    To ensure that the MCP server has started correctly, view the MCP server logs. The logs are generated based on the type of communication with the AI agent:

    • Starting MCP server 'Juniper Routing Directory' with transport 'stdio' if stdio is used.

    • INFO Starting MCP server 'Juniper Routing Directory' with transport 'http' on http://127.0.0.1:30030/mcp if streamable-http is used.