mcp-use
Version:
Opinionated MCP Framework for TypeScript (@modelcontextprotocol/sdk compatible) - Build MCP Agents, Clients and Servers with support for ChatGPT Apps, Code Mode, OAuth, Notifications, Sampling, Observability and more.
33 lines • 1.57 kB
TypeScript
import type { BaseConnector } from "../connectors/base.js";
import { MCPSession } from "../session.js";
/**
* Base MCPClient class with shared functionality
*
* This class contains all the common logic that works in both Node.js and browser environments.
* Platform-specific implementations should extend this class and override methods as needed.
*/
export declare abstract class BaseMCPClient {
protected config: Record<string, any>;
protected sessions: Record<string, MCPSession>;
activeSessions: string[];
constructor(config?: Record<string, any>);
static fromDict(_cfg: Record<string, any>): BaseMCPClient;
addServer(name: string, serverConfig: Record<string, any>): void;
removeServer(name: string): void;
getServerNames(): string[];
getServerConfig(name: string): Record<string, any>;
getConfig(): Record<string, any>;
/**
* Create a connector from server configuration
* This method must be implemented by platform-specific subclasses
*/
protected abstract createConnectorFromConfig(serverConfig: Record<string, any>): BaseConnector;
createSession(serverName: string, autoInitialize?: boolean): Promise<MCPSession>;
createAllSessions(autoInitialize?: boolean): Promise<Record<string, MCPSession>>;
getSession(serverName: string): MCPSession | null;
requireSession(serverName: string): MCPSession;
getAllActiveSessions(): Record<string, MCPSession>;
closeSession(serverName: string): Promise<void>;
closeAllSessions(): Promise<void>;
}
//# sourceMappingURL=base.d.ts.map