Add MCP Tools SDK

What does this MR do and why?

Implement MCP tools service layer for Model Context Protocol (MCP) server. Provides base functionality for MCP tools that can interact with REST API.

Key additions:

  • Service architecture: Add BaseService and ApiService base classes for tool implementation
  • OAuth authentication: Add mcp scope support via McpAccess concern for API endpoints
  • Tool implementations: Add initial tools that demonstrate API and custom tool patterns
  • Response handling: Add Response module for consistent MCP result formatting
  • RuboCop enforcement: Add Mcp/UseApiService cop to ensure proper inheritance patterns

References

How to set up and validate locally

  1. In rails console enable the feature flags
    Feature.enable(:oauth_dynamic_client_registration)
    Feature.enable(:mcp_server)
  2. Setup mcp.json in MCP client (e.g. Cursor, Claude Desktop):
    {
      "mcpServers": {
        "GitLab-Development": {
          "command": "npx",
          "args": [
            "mcp-remote",
            "https://gdk.test:3443/api/v4/mcp"
          ],
          "env": {
            "NODE_TLS_REJECT_UNAUTHORIZED": "0"
          }
        }
      }
    }
  3. Authorize MCP client in GDK instance
  4. List tools for MCP server and confirm get_server_version, get_issue, and create_issue tools are listed
  5. Call tools for MCP server and confirm get_server_version, get_issue, and create_issue tools are called

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.

Merge request reports

Loading