Add duoMcpServerNames to the Project GraphQL type

What does this MR do and why?

Adds a GraphQL field duoMcpServerNames on the Project type. Backend only, no user-facing change in this MR.

Today the Duo readiness card in Project Settings > General > GitLab Duo shows an "MCP servers" row with a count, for example "2 MCP servers are connected". The approved design replaces this with the connected server names, for example "Atlassian and Linear connected. Agents can use both." The row itself switches to the new field in the next MR in this stack.

Ai::DuoWorkflow::ProjectReadiness gains mcp_server_names, returning the distinct names of the MCP servers used by the project's configured agents, sorted case-insensitively. mcp_servers_count now returns the size of this same memoized list, so requesting both GraphQL fields reads the configured agents and their versions once.

Field details:

  • Type: [String!], nullable
  • authorize: :read_ai_catalog_mcp_server
  • Complexity: 10
  • Marked experiment
  • Milestone: 19.6

Regenerated doc/api/graphql/reference/_index.md and public/-/graphql/introspection_result.json with the rake tasks.

This is part of a three-MR stack for one issue:

  1. This MR: backend field, based on master.
  2. Frontend: switch duo_readiness_mcp_row.vue to the names and add one/two/three-or-more copy, stacked on this MR.
  3. Later cleanup: remove duoMcpServersCount and its query once the row no longer uses it.

References

Related to #629943 (closed) Epic gitlab-org#22591 (closed) Design https://claude.ai/design/p/54bcc27d-fe37-450f-90c1-4457674092f0?file=Duo+Setup+Step+Process.dc.html

Screenshots or screen recordings

Not applicable, backend only. The UI for this change is in the stack-top MR !259881 (merged), whose screenshots show the complete feature.

How to set up and validate locally

  1. In a Rails console, enable MCP for the top-level group:
    group.ai_settings.update!(duo_workflow_mcp_enabled: true)
  2. In the AI Catalog, create two MCP servers and attach them to an agent configured for a project.
  3. In GraphiQL at /-/graphql-explorer, run:
    query {
      project(fullPath: "<group>/<project>") {
        duoMcpServerNames
        duoMcpServersCount
      }
    }
  4. Expect the two server names sorted alphabetically, and duoMcpServersCount equal to 2.

Tests run locally:

bin/rspec ee/spec/lib/ai/duo_workflow/project_readiness_spec.rb ee/spec/requests/api/graphql/projects/duo_mcp_server_names_spec.rb ee/spec/requests/api/graphql/projects/duo_mcp_servers_count_spec.rb

51 examples, 0 failures. RuboCop clean on the changed files.

MR acceptance checklist

I have evaluated the MR acceptance checklist for this MR.

🤖 Generated with Claude Code

Edited by Tian Gao

Merge request reports

Loading
Loading