feat(mcp): implement mcp server management with CRUD operations

This commit is contained in:
2025-10-23 16:28:23 +08:00
parent a1ac879c6c
commit b513565f30
11 changed files with 1373 additions and 23 deletions

View File

@@ -1,7 +1,8 @@
// export enum McpServerType {
// Sse = 'sse',
// StreamableHttp = 'streamable-http',
// }
const MCP_SERVER_TYPE = {
Sse: 'sse',
StreamableHttp: 'streamable-http',
}
export type McpServerType = (typeof MCP_SERVER_TYPE)[keyof typeof MCP_SERVER_TYPE];
export interface IMcpServerVariable {
key: string;
@@ -12,7 +13,7 @@ export interface IMcpServerInfo {
id: string;
name: string;
url: string;
// server_type: McpServerType;
server_type: McpServerType;
description?: string;
variables?: IMcpServerVariable[];
headers: Map<string, string>;

View File

@@ -1,15 +1,16 @@
export interface IMcpServer {
create_date: string;
description: null;
description?: string;
id: string;
name: string;
server_type: string;
update_date: string;
url: string;
variables: Record<string, any> & { tools?: IMCPToolObject };
headers: Record<string, any>;
}
export type IMCPToolObject = Record<string, Omit<IMCPTool, 'name'>>;
export type IMCPToolObject = Record<string, Partial<IMCPTool>>;
export type IMCPToolRecord = Record<string, IMCPTool>;

View File

@@ -1,4 +1,4 @@
// import { IExportedMcpServer } from '@/interfaces/database/mcp';
import { type IExportedMcpServer } from '@/interfaces/database/mcp';
export interface ITestMcpRequestBody {
server_type: string;
@@ -6,11 +6,19 @@ export interface ITestMcpRequestBody {
headers?: Record<string, any>;
variables?: Record<string, any>;
timeout?: number;
name?: string
}
export interface IImportMcpServersRequestBody {
// mcpServers: Record<
// string,
// Pick<IExportedMcpServer, 'type' | 'url' | 'authorization_token'>
// >;
mcpServers: Record<
string,
Pick<IExportedMcpServer, 'type' | 'url' | 'authorization_token'>
>;
}
export interface ICreateMcpServerRequestBody {
name?: string;
server_type: string;
url: string;
headers?: Record<string, any>;
}