976bde37cc
与 REST/OpenAPI 并存,按实例权限自动 tools/list,免手填工具。 Co-authored-by: Cursor <cursoragent@cursor.com>
28 lines
1.0 KiB
TypeScript
28 lines
1.0 KiB
TypeScript
import { Controller, Delete, Get, Post, Req, Res, UseGuards } from '@nestjs/common';
|
|
import type { Request, Response } from 'express';
|
|
import { CurrentWecomPlugin } from './wecom-plugin.decorators';
|
|
import { WecomPluginGuard } from './wecom-plugin.guard';
|
|
import { WecomPluginMcpFactory } from './wecom-plugin-mcp.factory';
|
|
import type { WecomPluginRuntime } from './wecom-plugin.types';
|
|
|
|
@Controller('wecom/plugin/mcp')
|
|
@UseGuards(WecomPluginGuard)
|
|
export class WecomPluginMcpController {
|
|
constructor(private readonly mcp: WecomPluginMcpFactory) {}
|
|
|
|
@Post()
|
|
post(@CurrentWecomPlugin() plugin: WecomPluginRuntime, @Req() req: Request, @Res() res: Response) {
|
|
return this.mcp.handle(req, res, plugin);
|
|
}
|
|
|
|
@Get()
|
|
get(@CurrentWecomPlugin() plugin: WecomPluginRuntime, @Req() req: Request, @Res() res: Response) {
|
|
return this.mcp.handle(req, res, plugin);
|
|
}
|
|
|
|
@Delete()
|
|
delete(@CurrentWecomPlugin() plugin: WecomPluginRuntime, @Req() req: Request, @Res() res: Response) {
|
|
return this.mcp.handle(req, res, plugin);
|
|
}
|
|
}
|