feat(wecom): 企微 API 插件增加 MCP Streamable HTTP 端点

与 REST/OpenAPI 并存,按实例权限自动 tools/list,免手填工具。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-08 16:57:42 +08:00
parent cae426fbc2
commit 976bde37cc
23 changed files with 1212 additions and 63 deletions
@@ -6,9 +6,9 @@ import {
} from '@nestjs/common';
import { Observable, map } from 'rxjs';
function skipResponseWrap(url?: string): boolean {
export function skipWecomPluginResponseWrap(url?: string): boolean {
const path = (url || '').split('?')[0];
return path.endsWith('/wecom/plugin/openapi.json');
return path.endsWith('/wecom/plugin/openapi.json') || path.includes('/wecom/plugin/mcp');
}
@Injectable()
@@ -16,7 +16,7 @@ export class ResponseInterceptor implements NestInterceptor {
intercept(context: ExecutionContext, next: CallHandler): Observable<unknown> {
const req = context.switchToHttp().getRequest<{ originalUrl?: string; url?: string }>();
const res = context.switchToHttp().getResponse<{ headersSent?: boolean }>();
if (skipResponseWrap(req.originalUrl || req.url)) {
if (skipWecomPluginResponseWrap(req.originalUrl || req.url)) {
return next.handle();
}
return next.handle().pipe(