mcp-use TypeScript API
    Preparing search index...

    Interface IServerManager

    State and operations required by MCP server management tools.

    interface IServerManager {
        activeServer: string | null;
        adapter: LangChainAdapter;
        client: MCPClient;
        initializedServers: Record<string, boolean>;
        serverTools: Record<string, StructuredToolInterface[]>;
        get tools(): StructuredToolInterface<ToolInputSchemaBase, any, any>[];
        prefetchServerTools(): Promise<void>;
        setManagementTools(
            tools: StructuredToolInterface<ToolInputSchemaBase, any, any>[],
        ): void;
    }

    Implemented by

    Index
    activeServer: string | null

    Server whose tools are currently exposed to the model.

    Adapter used to convert MCP capabilities into LangChain tools.

    client: MCPClient

    MCP client that owns the configured servers and sessions.

    initializedServers: Record<string, boolean>

    Whether tools have been loaded for each configured server.

    serverTools: Record<string, StructuredToolInterface[]>

    Cached LangChain tools for each configured server.

    • get tools(): StructuredToolInterface<ToolInputSchemaBase, any, any>[]

      Management tools plus tools from the active server.

      Returns StructuredToolInterface<ToolInputSchemaBase, any, any>[]

    • Loads and caches tools for configured servers.

      Returns Promise<void>

    • Replaces the default management tools.

      Parameters

      • tools: StructuredToolInterface<ToolInputSchemaBase, any, any>[]

      Returns void