Allow MCP tool prefixing

What does this MR do and why?

Some of the exposed tools are very generic (like search) and have potential to conflict with other MCP servers. These conflicts can also happen when you configure multiple GitLab instances as MCP servers.

While it can be arguable if this should be handled on the server side, fact is that not every MCP client supports this. Some clients require that users configure a tool alias for every single tool that conflicts with a tool defined by another MCP server. Providing this option on the server side is a Quality-of-Life feature for all users of clients that don't handle tool namespacing on their own and either just reject duplicate tools or would require aliases for every single tool.

References

Screenshots or screen recordings

Before After
image image image image

How to set up and validate locally

  1. Ensure the MCP server is available (ApplicationSetting.current.update(instance_level_ai_beta_features_enabled: true) in the rails console)
  2. Configure your tool of choice with the GDK as MCP server
    {
      "mcpServers": {
        "gdk_prefixed": {
          "type": "http",
          "url": "http://gdk.localhost:3000/api/v4/mcp",
          "headers": {
            "X-Gitlab-Mcp-Server-Tool-Name-Prefix": "gdk_"
          }
        },
        "gdk": {
          "type": "http",
          "url": "http://gdk.localhost:3000/api/v4/mcp"
        }
      }
    }
  3. Notice that the tools from gdk keep their current name while the tools from gdk_prefixed get the gdk_ prefix

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Niklas van Schrick

Merge request reports

Loading