|
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js'; |
|
|
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js'; |
|
|
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'; |
|
|
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'; |
|
|
import { SmartRoutingConfig } from '../utils/smartRouting.js'; |
|
|
|
|
|
|
|
|
export interface IUser { |
|
|
username: string; |
|
|
password: string; |
|
|
isAdmin?: boolean; |
|
|
} |
|
|
|
|
|
|
|
|
export interface IGroup { |
|
|
id: string; |
|
|
name: string; |
|
|
description?: string; |
|
|
servers: string[]; |
|
|
} |
|
|
|
|
|
|
|
|
export interface MarketServerRepository { |
|
|
type: string; |
|
|
url: string; |
|
|
} |
|
|
|
|
|
export interface MarketServerAuthor { |
|
|
name: string; |
|
|
} |
|
|
|
|
|
export interface MarketServerInstallation { |
|
|
type: string; |
|
|
command: string; |
|
|
args: string[]; |
|
|
env?: Record<string, string>; |
|
|
} |
|
|
|
|
|
export interface MarketServerArgument { |
|
|
description: string; |
|
|
required: boolean; |
|
|
example: string; |
|
|
} |
|
|
|
|
|
export interface MarketServerExample { |
|
|
title: string; |
|
|
description: string; |
|
|
prompt: string; |
|
|
} |
|
|
|
|
|
export interface MarketServerTool { |
|
|
name: string; |
|
|
description: string; |
|
|
inputSchema: Record<string, any>; |
|
|
} |
|
|
|
|
|
export interface MarketServer { |
|
|
name: string; |
|
|
display_name: string; |
|
|
description: string; |
|
|
repository: MarketServerRepository; |
|
|
homepage: string; |
|
|
author: MarketServerAuthor; |
|
|
license: string; |
|
|
categories: string[]; |
|
|
tags: string[]; |
|
|
examples: MarketServerExample[]; |
|
|
installations: { |
|
|
[key: string]: MarketServerInstallation; |
|
|
}; |
|
|
arguments: Record<string, MarketServerArgument>; |
|
|
tools: MarketServerTool[]; |
|
|
is_official?: boolean; |
|
|
} |
|
|
|
|
|
|
|
|
export interface McpSettings { |
|
|
users?: IUser[]; |
|
|
mcpServers: { |
|
|
[key: string]: ServerConfig; |
|
|
}; |
|
|
groups?: IGroup[]; |
|
|
systemConfig?: { |
|
|
routing?: { |
|
|
enableGlobalRoute?: boolean; |
|
|
enableGroupNameRoute?: boolean; |
|
|
enableBearerAuth?: boolean; |
|
|
bearerAuthKey?: string; |
|
|
}; |
|
|
install?: { |
|
|
pythonIndexUrl?: string; |
|
|
npmRegistry?: string; |
|
|
}; |
|
|
smartRouting?: SmartRoutingConfig; |
|
|
|
|
|
}; |
|
|
} |
|
|
|
|
|
|
|
|
export interface ServerConfig { |
|
|
type?: 'stdio' | 'sse' | 'streamable-http'; |
|
|
url?: string; |
|
|
command?: string; |
|
|
args?: string[]; |
|
|
env?: Record<string, string>; |
|
|
headers?: Record<string, string>; |
|
|
enabled?: boolean; |
|
|
} |
|
|
|
|
|
|
|
|
export interface ServerInfo { |
|
|
name: string; |
|
|
status: 'connected' | 'connecting' | 'disconnected'; |
|
|
error: string | null; |
|
|
tools: ToolInfo[]; |
|
|
client?: Client; |
|
|
transport?: SSEClientTransport | StdioClientTransport | StreamableHTTPClientTransport; |
|
|
createTime: number; |
|
|
enabled?: boolean; |
|
|
} |
|
|
|
|
|
|
|
|
export interface ToolInfo { |
|
|
name: string; |
|
|
description: string; |
|
|
inputSchema: Record<string, unknown>; |
|
|
} |
|
|
|
|
|
|
|
|
export interface ApiResponse<T = unknown> { |
|
|
success: boolean; |
|
|
message?: string; |
|
|
data?: T; |
|
|
} |
|
|
|
|
|
|
|
|
export interface AddServerRequest { |
|
|
name: string; |
|
|
config: ServerConfig; |
|
|
} |
|
|
|