UNPKG

@toolprint/hypertool-mcp

Version:

HyperTool MCP proxy server for routing requests between clients and multiple underlying MCP servers

221 lines • 7.14 kB
/** * Toolset configuration system * * This module provides a complete toolset configuration system that allows users * to specify which tools to expose from each MCP server with support for: * - JSON-based configuration with validation * - Wildcard and regex patterns for tool selection * - Conflict resolution strategies * - Default configuration generation * * TODO: Per-Application Toolset Management * - Associate toolsets with specific applications (claude-desktop, cursor, etc.) * - Allow app-specific toolset configurations and preferences * - Implement toolset sharing and synchronization between apps * - Add application context awareness for tool filtering * - Support app-specific tool customization and overrides */ export * from "./types.js"; export { validateToolsetConfig } from "./validator.js"; export { loadToolsetConfig, saveToolsetConfig } from "./loader.js"; /** * Main toolset manager class */ import { EventEmitter } from "events"; import { DiscoveredTool, IToolDiscoveryEngine } from "../../../discovery/types.js"; import { ToolsetConfig, ValidationResult, DynamicToolReference } from "./types.js"; import { BuildToolsetResponse, ListSavedToolsetsResponse, EquipToolsetResponse, GetActiveToolsetResponse, ToolsetInfo, ContextInfo } from "../schemas.js"; import { Tool } from "@modelcontextprotocol/sdk/types.js"; import { ToolsProvider } from "../../types.js"; import { IToolsetDelegate } from "../interfaces/toolset-delegate.js"; export declare class ToolsetManager extends EventEmitter implements ToolsProvider, IToolsetDelegate { private currentToolset?; private configPath?; private discoveryEngine?; constructor(); /** * Load toolset configuration from file */ loadToolsetFromConfig(filePath: string): Promise<{ success: boolean; validation: ValidationResult; error?: string; }>; /** * Save current configuration to file */ persistToolset(filePath?: string): Promise<{ success: boolean; error?: string; }>; /** * Generate and set minimal empty configuration * Note: Users should create toolsets explicitly using build-toolset */ generateDefaultConfig(_discoveredTools: DiscoveredTool[], options?: { name?: string; description?: string; }): ToolsetConfig; /** * Set configuration directly */ setCurrentToolset(toolsetConfig: ToolsetConfig): ValidationResult; /** * Get current configuration */ getCurrentToolset(): ToolsetConfig | undefined; /** * Validate current configuration */ isCurrentToolsetValid(): ValidationResult; /** * Check if configuration is loaded */ isCurrentToolsetLoaded(): boolean; /** * Get configuration file path */ getConfigPath(): string | undefined; /** * Clear current configuration */ clearCurrentToolset(): void; /** * Set discovery engine reference for tool validation */ setDiscoveryEngine(discoveryEngine: IToolDiscoveryEngine): void; /** Hydrates the tool with any notes loaded from the toolset configuration. */ _hydrateToolNotes(tool: Tool): Tool; /** Formats a discovered tool into an MCP tool. */ _getToolFromDiscoveredTool(dt: DiscoveredTool): Tool; /** * Get currently active MCP tools based on loaded toolset * Returns all discovered tools if no toolset is active */ getMcpTools(): Array<Tool>; /** * Get the original discovered tools that match the current toolset * Used internally for routing */ getActiveDiscoveredTools(): DiscoveredTool[]; /** * Flatten tool name for external exposure (git.status → git_status) */ private flattenToolName; /** * Get original namespaced name from flattened name (git_status → git.status) */ getOriginalToolName(flattenedName: string): string | null; /** * Check if toolset is currently active */ hasActiveToolset(): boolean; /** * Get active toolset information */ getActiveToolsetInfo(): { name: string; description?: string; toolCount: number; version?: string; createdAt?: string; } | null; /** * Create and save a new toolset */ buildToolset(name: string, tools: DynamicToolReference[], options?: { description?: string; autoEquip?: boolean; }): Promise<BuildToolsetResponse>; /** * Delete a saved toolset */ deleteToolset(name: string, options?: { confirm?: boolean; }): Promise<{ success: boolean; error?: string; message?: string; }>; /** * List all saved toolsets */ listSavedToolsets(): Promise<ListSavedToolsetsResponse>; /** * Format discovered tools for display with context information */ formatAvailableTools(): { summary: { totalTools: number; totalServers: number; }; meta?: { totalPossibleContext?: ContextInfo; }; toolsByServer: Array<{ serverName: string; toolCount: number; context?: ContextInfo; tools: Array<{ name: string; description?: string; namespacedName: string; serverName: string; refId: string; context?: ContextInfo; }>; }>; }; /** * Validate tool references against discovery engine */ validateToolReferences(tools: DynamicToolReference[]): { valid: boolean; validReferences: DynamicToolReference[]; invalidReferences: DynamicToolReference[]; resolvedTools: DiscoveredTool[]; }; /** * Equip a toolset by loading it from storage */ equipToolset(toolsetName: string): Promise<EquipToolsetResponse>; /** * Unequip the current toolset */ unequipToolset(): Promise<void>; /** * Get the current active toolset config (if any) */ getActiveToolsetConfig(): ToolsetConfig | null; /** * Get information about the currently active toolset * Implementation of IToolsetDelegate interface */ getActiveToolset(): Promise<GetActiveToolsetResponse>; /** * Restore the last equipped toolset from preferences */ restoreLastEquippedToolset(): Promise<boolean>; /** * Generate detailed toolset information */ generateToolsetInfo(config: ToolsetConfig): Promise<ToolsetInfo>; /** * Format tool notes for LLM consumption */ private formatNotesForLLM; /** * Find a discovered tool by its flattened name */ private findDiscoveredToolByFlattenedName; /** * Handle discovered tools changes and validate active toolset */ private handleDiscoveredToolsChanged; /** * Get the delegate type for routing context * Implementation of IToolsetDelegate interface */ getDelegateType(): "regular" | "persona"; } //# sourceMappingURL=manager.d.ts.map