File size: 1,193 Bytes
aad94d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import type { Tool as MCPTool } from "@modelcontextprotocol/sdk/types.js";

export interface MCPServerConfig {
  id: string;
  name: string;
  url: string;
  enabled: boolean;
  transport: 'websocket' | 'sse' | 'streamable-http';
  auth?: {
    type: 'bearer' | 'basic' | 'oauth';
    token?: string;
    username?: string;
    password?: string;
  };
}

export interface MCPServerConnection {
  config: MCPServerConfig;
  isConnected: boolean;
  tools: MCPTool[];
  lastError?: string;
  lastConnected?: Date;
}

// Extended Tool interface to support both local and MCP tools
export interface ExtendedTool {
  id: number | string;
  name: string;
  enabled: boolean;
  isCollapsed?: boolean;
  
  // Local tool properties
  code?: string;
  renderer?: string;
  
  // MCP tool properties
  mcpServerId?: string;
  mcpTool?: MCPTool;
  isRemote?: boolean;
}

// MCP Tool execution result
export interface MCPToolResult {
  content: Array<{
    type: string;
    text?: string;
    data?: unknown;
    mimeType?: string;
  }>;
  isError?: boolean;
}

// MCP Client state
export interface MCPClientState {
  servers: Record<string, MCPServerConnection>;
  isLoading: boolean;
  error?: string;
}