Use Model Context Protocol with AI-native features
- Tier: Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
- Status: Experiment
- Available on GitLab Duo with self-hosted models: Not supported
Version history
-
Introduced in GitLab 18.1 with a flag named
duo_workflow_mcp_support
. Disabled by default. -
Enabled on GitLab.com, GitLab Self-Managed, and GitLab Dedicated in GitLab 18.2. Feature flag
duo_workflow_mcp_support
removed.
The Model Context Protocol (MCP) provides a standardized way for GitLab Duo features to securely connect to different external data sources and tools.
The following features can act as MCP clients, and connect to and run external tools from MCP servers:
This connectivity means these features can now use context and information external to GitLab to generate more powerful answers for customers.
To use a feature with MCP:
- Turn on MCP for your group.
- Configure the MCP servers you want the feature to connect to.
For a click-through demo, see Duo Agent Platform - MCP integration.
Prerequisites
Before using a GitLab Duo feature with MCP, you must:
-
Install Visual Studio Code (VS Code).
-
Set up the GitLab Workflow extension for VS Code.
- MCP support requires version 6.28.2 and later.
- Workspace and user configuration features require version 6.35.6 and later.
-
Meet the prerequisites required for:
Turn on MCP for your group
To turn MCP on or off for your group:
- On the left sidebar, select Search or go to and find your group.
- Select Settings > GitLab Duo.
- Select Change configuration.
- Under Model Context Protocol, select or clear the Turn on Model Context Protocol (MCP) support checkbox.
- Select Save changes.
Configure MCP servers
To integrate MCP with the Language Server, set up workspace configuration, user configuration, or both. The GitLab Language Server loads and merges the configuration files.
Version compatibility
GitLab Workflow extension version | MCP features available |
---|---|
6.28.2 - 6.35.5 | Basic MCP support, with no workspace or user configuration |
6.35.6 and later | Full MCP support, including workspace and user configuration |
Create workspace configuration
Workspace configuration applies to this project only, and overrides any user configuration for the same server.
To set up workspace configuration:
- In your project workspace, create the file
<workspace>/.gitlab/duo/mcp.json
. - Using the configuration format, add information about the MCP servers your feature connects to.
- Save the file.
Create user configuration
User configuration settings are good for personal tools and commonly-used servers. They apply to all workspaces, but any workspace settings for the same server override the user configuration.
To set up user configuration:
- In VS Code, open the Command Palette by pressing Control+Shift+P or Command+Shift+P.
- Run the command
GitLab MCP: Open User Settings (JSON)
to create and open the user configuration file. - Using the configuration format, add information about the MCP servers your feature connects to.
- Save the file.
Alternatively, manually create the file in this location:
- Windows:
C:\Users\<username>\AppData\Roaming\GitLab\duo\mcp.json
- All other operating systems:
~/.gitlab/duo/mcp.json
Configuration format
Both configuration files use the same JSON format:
{
"mcpServers": {
"server-name": {
"command": "path/to/server",
"args": ["--arg1", "value1"],
"env": {
"ENV_VAR": "value"
}
},
"http-server": {
"url": "http://localhost:3000/mcp"
}
}
}
Example MCP server configurations
Use the following code examples to help you create your MCP server configuration file.
For more information and examples, see the MCP example servers documentation. Other example servers are Smithery.ai and Awesome MCP Servers.
Local server
{
"mcpServers": {
"enterprise-data-v2": {
"command": "node",
"args": ["src/server.js"],
"cwd": "</path/to/your-mcp-server>"
}
}
}
Remote server
{
"mcpServers": {
"aws-knowledge": {
"command": "npx",
"args": [
"mcp-remote",
"https://knowledge-mcp.global.api.aws"
]
}
}
}
HTTP server
{
"mcpServers": {
"local-http-server": {
"url": "http://localhost:3000/mcp"
}
}
}
Use GitLab Duo features with MCP
When a GitLab Duo feature wants to call an external tool to answer the question you have asked, you must review the tool before the feature can use that tool:
-
Open VS Code.
-
On the left sidebar, select GitLab Duo Agent Platform (Beta) ({duo-agentic-chat}).
-
Select the Chat or Flows tab.
-
In the text box, enter a question or specify a code task.
-
Submit the question or code task.
-
The Tool Approval Required dialog appears.
You must review a tool every time a GitLab Duo feature tries to connect to that tool, even if you have previously reviewed that tool.
-
Approve or deny the tool:
-
If you approve the tool, the feature connects to the tool and generates an answer.
-
Optional: For Agentic Chat, if you deny the tool, the Provide Rejection Reason dialog appears. Enter a rejection reason into the text box, and select Submit Rejection.
-
Feedback
This feature is experimental. Your feedback is valuable in helping us to improve it. Share your experiences, suggestions, or issues in issue 552164.
Related topics
Troubleshooting
Error starting server filesystem: Error: spawn ... ENOENT
This error occurs when you specify a command using a relative path (like node
instead of /usr/bin/node
), and that command cannot be found in the PATH
environment variable that was passed to the GitLab Language Server.
Improvements to resolving PATH
are being planned in issue 1345.
Troubleshooting MCP in VS Code
For troubleshooting information, see troubleshooting the GitLab Workflow extension for VS Code.