| 40 | @ApiTags('mcp-groups') |
| 41 | @Controller('mcp-groups') |
| 42 | export class McpGroupsController { |
| 43 | constructor(private readonly mcpGroupsService: McpGroupsService) {} |
| 44 | |
| 45 | @Get() |
| 46 | @ApiOperation({ summary: 'List all MCP groups' }) |
| 47 | @ApiQuery({ name: 'enabled', required: false, type: Boolean }) |
| 48 | @ApiOkResponse({ type: [McpGroupResponse] }) |
| 49 | async listGroups(@Query('enabled') enabled?: string): Promise<McpGroupResponse[]> { |
| 50 | const enabledOnly = enabled === 'true'; |
| 51 | return this.mcpGroupsService.listGroups(enabledOnly); |
| 52 | } |
| 53 | |
| 54 | @Get('templates') |
| 55 | @ApiOperation({ summary: 'List available MCP group templates' }) |
| 56 | @ApiOkResponse({ type: [GroupTemplateDto] }) |
| 57 | async listTemplates(): Promise<GroupTemplateDto[]> { |
| 58 | return this.mcpGroupsService.listTemplates(); |
| 59 | } |
| 60 | |
| 61 | @Get('slug/:slug') |
| 62 | @ApiOperation({ summary: 'Get a group by slug' }) |
| 63 | @ApiOkResponse({ type: McpGroupResponse }) |
| 64 | async getGroupBySlug(@Param('slug') slug: string): Promise<McpGroupResponse> { |
| 65 | return this.mcpGroupsService.getGroupBySlug(slug); |
| 66 | } |
| 67 | |
| 68 | @Get(':id') |
| 69 | @ApiOperation({ summary: 'Get a specific MCP group' }) |
| 70 | @ApiOkResponse({ type: McpGroupResponse }) |
| 71 | async getGroup(@Param('id', new ParseUUIDPipe()) id: string): Promise<McpGroupResponse> { |
| 72 | return this.mcpGroupsService.getGroup(id); |
| 73 | } |
| 74 | |
| 75 | @Post() |
| 76 | @Roles('ADMIN') |
| 77 | @ApiOperation({ summary: 'Create a new MCP group (admin only)' }) |
| 78 | @ApiCreatedResponse({ type: McpGroupResponse }) |
| 79 | async createGroup( |
| 80 | @CurrentAuth() _auth: AuthContext | null, |
| 81 | @Body() body: CreateMcpGroupDto, |
| 82 | ): Promise<McpGroupResponse> { |
| 83 | return this.mcpGroupsService.createGroup(body); |
| 84 | } |
| 85 | |
| 86 | @Patch(':id') |
| 87 | @ApiOperation({ summary: 'Update an MCP group' }) |
| 88 | @ApiOkResponse({ type: McpGroupResponse }) |
| 89 | async updateGroup( |
| 90 | @CurrentAuth() _auth: AuthContext | null, |
| 91 | @Param('id', new ParseUUIDPipe()) id: string, |
| 92 | @Body() body: UpdateMcpGroupDto, |
| 93 | ): Promise<McpGroupResponse> { |
| 94 | return this.mcpGroupsService.updateGroup(id, body); |
| 95 | } |
| 96 | |
| 97 | @Delete(':id') |
| 98 | @Roles('ADMIN') |
| 99 | @HttpCode(HttpStatus.NO_CONTENT) |