mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-25 05:46:13 +00:00
refactor: mcp server datastructure
This commit is contained in:
@@ -318,29 +318,28 @@ export interface ApiRespMCPServer {
|
||||
server: MCPServer;
|
||||
}
|
||||
|
||||
export interface MCPServer {
|
||||
extra_args: Record<string, unknown>;
|
||||
name: string;
|
||||
mode: 'stdio' | 'sse';
|
||||
enable: boolean;
|
||||
config: MCPServerConfig;
|
||||
status: 'connected' | 'disconnected' | 'error' | 'disabled';
|
||||
tools: MCPTool[];
|
||||
error?: string;
|
||||
export interface MCPServerExtraArgsSSE {
|
||||
url: string;
|
||||
headers: Record<string, string>;
|
||||
timeout: number;
|
||||
ssereadtimeout: number;
|
||||
}
|
||||
|
||||
export interface MCPServerConfig {
|
||||
export interface MCPServerRuntimeInfo {
|
||||
connected: boolean;
|
||||
error_message: string;
|
||||
tool_count: number;
|
||||
}
|
||||
|
||||
export interface MCPServer {
|
||||
uuid?: string;
|
||||
name: string;
|
||||
mode: 'stdio' | 'sse';
|
||||
enable: boolean;
|
||||
// stdio mode
|
||||
command?: string;
|
||||
args?: string[];
|
||||
env?: Record<string, string>;
|
||||
// sse mode
|
||||
url?: string;
|
||||
headers?: Record<string, string>;
|
||||
timeout?: number;
|
||||
extra_args: MCPServerExtraArgsSSE;
|
||||
runtime_info?: MCPServerRuntimeInfo;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
}
|
||||
|
||||
export interface MCPTool {
|
||||
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
ApiRespPluginSystemStatus,
|
||||
ApiRespMCPServers,
|
||||
ApiRespMCPServer,
|
||||
MCPServerConfig,
|
||||
MCPServer,
|
||||
} from '@/app/infra/entities/api';
|
||||
import { GetBotLogsRequest } from '@/app/infra/http/requestParam/bots/GetBotLogsRequest';
|
||||
import { GetBotLogsResponse } from '@/app/infra/http/requestParam/bots/GetBotLogsResponse';
|
||||
@@ -500,15 +500,13 @@ export class BackendClient extends BaseHttpClient {
|
||||
return this.get(`/api/v1/mcp/servers/${serverName}`);
|
||||
}
|
||||
|
||||
public createMCPServer(
|
||||
server: MCPServerConfig,
|
||||
): Promise<AsyncTaskCreatedResp> {
|
||||
return this.post('/api/v1/mcp/servers', { source: server });
|
||||
public createMCPServer(server: MCPServer): Promise<AsyncTaskCreatedResp> {
|
||||
return this.post('/api/v1/mcp/servers', server);
|
||||
}
|
||||
|
||||
public updateMCPServer(
|
||||
serverName: string,
|
||||
server: Partial<MCPServerConfig>,
|
||||
server: Partial<MCPServer>,
|
||||
): Promise<AsyncTaskCreatedResp> {
|
||||
return this.put(`/api/v1/mcp/servers/${serverName}`, server);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user