Use Model Context Protocol with AI-native features

  • Tier: Free, Premium, Ultimate
  • Offering: GitLab.com
  • Status: Experiment
History

The Model Context Protocol (MCP) provides a standardized way for AI-native features to securely connect to different external data sources and tools.

The following GitLab Duo AI-native features can act as MCP clients, and connect to and run external tools from MCP servers:

This means that, in addition to GitLab information, these AI-native features can now use context and information external to GitLab to generate more powerful answers for customers.

To use a GitLab Duo AI-native feature with MCP:

  • Turn on MCP for your group.
  • Specify the MCP servers you want the feature to connect to.

Prerequisites

Before you can use an AI-native feature with MCP, you must:

Turn on MCP for your group

To turn MCP on or off for your group:

  1. On the left sidebar, select Search or go to and find your group.
  2. Select Settings > GitLab Duo.
  3. Select Change configuration.
  4. Under Model Context Protocol, select or clear the Turn on Model Context Protocol (MCP) support checkbox.
  5. Select Save changes.

Specify the MCP servers

To specify the MCP servers you want the AI-native feature to connect to:

  1. In VS Code, create an mcp.json file in ~/.gitlab/duo/.

  2. Populate this file with the MCP servers you want the feature to connect to.

    For more information and examples, see the MCP example servers documentation. You can also find other example servers at Smithery.ai and Awesome MCP Servers.

  3. Save the file.

Use AI-native features with MCP

When an AI-native feature wants to call an external tool to answer the question you have asked, you must review and approve or deny the tool before the feature can use that tool:

  1. Open VS Code.

  2. On the left sidebar, select the feature.

  3. In the text box, enter a question or specify a code task.

  4. Submit the question or code task.

  5. The Tool Approval Required dialog appears.

    Review the tool and select Approve or Deny.

    You must review a tool every time an AI-native feature tries to connect to that tool, even if you have previously reviewed that tool.

    • If you approve the tool, the feature connects to the tool and generates an answer.

    • If you deny the tool, the Provide Rejection Reason dialog appears. Optional: Enter a rejection reason into the text box and select Submit Rejection.

Feedback

Because this is an experimental feature, your feedback is valuable in helping us to improve it. Share your experiences, suggestions, or issues in issue 552164.