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
- Issue: #554828 (closed)
- Model Context Protocol Specification: https://modelcontextprotocol.io/specification/2025-06-18/server/tools
- Inspiration: https://github.com/modelcontextprotocol/ruby-sdk
How to set up and validate locally
- In rails console enable the feature flags
Feature.enable(:oauth_dynamic_client_registration) Feature.enable(:mcp_server) - Setup
mcp.jsonin 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" } } } } - Authorize MCP client in GDK instance
- List tools for MCP server and confirm
get_server_version,get_issue, andcreate_issuetools are listed - Call tools for MCP server and confirm
get_server_version,get_issue, andcreate_issuetools 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.