Add MCP tool support to existing agents in catalog toolset

What does this MR do and why?

The AI Catalog previously had no way to access tools provided by the GitLab MCP Server. When an agent was created via the AI Catalog, only the built-in DAP tools appeared in the tool selection dropdown. Some foundational agents, like Planner Agent want access to the existing MCP tools to increase capabilities of using expanded tools and also rely on embeddings to build more agent features.

This MR exposes GitLab MCP Server tools as selectable options within the AI Catalog. Now you can select the following GitLab AI MCP tools within the tool selection dropdown within the all Catalog Agents — excluding flow configurations.

Previously, there was an issue of exposing all MCP tools to all foundational agents here: 34bc0e78. The following is still true because we access the agent

Changes:

  • Adds a new mcp_tool_names GraphQL field to the AI Catalog for the GitLab MCP Server allowing the frontend to query and display MCP tools alongside existing DAP tools.
  • Ensures MCP tools are filtered out from the catalog when the GitLab MCP Server is not enabled.
  • Updates McpConfigService to respect the existing MCP server configuration scopes the MCP server's tool list to only those tools, rather than passing all available tools.

References

How to set up and validate locally

  1. Enable feature flags in Rails console:

    Feature.enable(:mcp_client)
    Feature.enable(:mcp_catalog_agent_tools)
  2. Query available MCP tools at https://gdk.test:3443/-/graphql-explorer:

    query {
      aiCatalogMcpTools {
        nodes { name title description }
      }
    }
  3. Create an agent with MCP tools:

    mutation {
      aiCatalogAgentCreate(input: {
        projectId: "gid://gitlab/Project/<YOUR_PROJECT_ID>" # Use GitLab Duo Test with MCP client enabled
        name: "MCP Test Agent"
        description: "Agent with MCP tools"
        public: true
        release: true
        systemPrompt: "You are a helpful assistant."
        mcpToolNames: ["search", "get_issue", "manage_pipeline", "create_issue"]
      }) {
        errors
        item {
          id
          latestVersion {
            ... on AiCatalogAgentVersion { mcpToolNames }
          }
        }
      }
    }

    The response should include mcpToolNames: ["search", "get_issue", "create_issue"].

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

Edited by Nathan Weinshenker

Merge request reports

Loading