import type { McpServer } from '@modelcontextprotocol/server'; import { LicenseState, Logger, ModuleRegistry } from '@n8n/backend-common'; import { ExecutionsConfig, GlobalConfig, WorkflowsConfig } from '@n8n/config'; import { ExecutionRepository, ProjectRepository, SharedWorkflowRepository, User } from '@n8n/db'; import { type IDeferredPromise } from '@n8n/utils/promise/deferred-promise'; import { InstanceSettings } from 'n8n-core'; import { type IRun } from 'n8n-workflow'; import { ActiveExecutions } from '../../active-executions'; import { CollaborationService } from '../../collaboration/collaboration.service'; import { CredentialsService } from '../../credentials/credentials.service'; import { EventService } from '../../events/event.service'; import { ExecutionListService } from '../../executions/execution-list.service'; import { ExecutionRedactionServiceProxy } from '../../executions/execution-redaction-proxy.service'; import { ExecutionService } from '../../executions/execution.service'; import { DataTableProxyService } from '../../modules/data-table/data-table-proxy.service'; import { NodeCatalogService } from '../../node-catalog'; import { NodeTypes } from '../../node-types'; import { PostHogClient } from '../../posthog'; import { AiGatewayService } from '../../services/ai-gateway.service'; import { AiPreferenceService } from '../../services/ai-preference.service'; import { FolderFinderService } from '../../services/folder-finder.service'; import { FolderService } from '../../services/folder.service'; import { NodeResourceExplorerService } from '../../services/node-resource-explorer.service'; import { ProjectService } from '../../services/project.service.ee'; import { RoleService } from '../../services/role.service'; import { TagService } from '../../services/tag.service'; import { UrlService } from '../../services/url.service'; import { Telemetry } from '../../telemetry'; import { WorkflowRunner } from '../../workflow-runner'; import { ErrorWorkflowValidationService } from '../../workflows/error-workflow-validation.service'; import { WorkflowCreationService } from '../../workflows/workflow-creation.service'; import { WorkflowFinderService } from '../../workflows/workflow-finder.service'; import { WorkflowHistoryService } from '../../workflows/workflow-history/workflow-history.service'; import { WorkflowPublishedDataService } from '../../workflows/workflow-published-data.service'; import { WorkflowService } from '../../workflows/workflow.service'; import { McpPostSaveMetricsService } from './mcp-post-save-metrics.service'; import { McpConfig } from './mcp.config'; import type { McpAppsTelemetryVariant, McpAuthContext, McpClientInfo, RegisterResourceFn, ToolDefinition } from './mcp.types'; export type McpAppsResolution = { enabled: boolean; variant: McpAppsTelemetryVariant; }; export type McpFeatureFlags = { mcpApps: McpAppsResolution; instanceContextEnabled: boolean; aiPreferencesEnabled: boolean; }; export declare class McpService { private readonly logger; private readonly executionsConfig; private readonly instanceSettings; private readonly workflowFinderService; private readonly workflowService; private readonly urlService; private readonly credentialsService; private readonly activeExecutions; private readonly globalConfig; private readonly telemetry; private readonly workflowRunner; private readonly roleService; private readonly projectService; private readonly nodeCatalogService; private readonly workflowCreationService; private readonly nodeTypes; private readonly projectRepository; private readonly folderFinderService; private readonly sharedWorkflowRepository; private readonly executionRepository; private readonly executionService; private readonly executionListService; private readonly dataTableProxyService; private readonly collaborationService; private readonly nodeResourceExplorerService; private readonly tagService; private readonly licenseState; private readonly postHogClient; private readonly workflowHistoryService; private readonly workflowsConfig; private readonly workflowPublishedDataService; private readonly errorWorkflowValidationService; private readonly aiGatewayService; private readonly postSaveMetrics; private readonly moduleRegistry; private readonly eventService; private readonly folderService; private readonly aiPreferenceService; private readonly mcpConfig; private readonly executionRedactionServiceProxy; private readonly pendingResponses; constructor(logger: Logger, executionsConfig: ExecutionsConfig, instanceSettings: InstanceSettings, workflowFinderService: WorkflowFinderService, workflowService: WorkflowService, urlService: UrlService, credentialsService: CredentialsService, activeExecutions: ActiveExecutions, globalConfig: GlobalConfig, telemetry: Telemetry, workflowRunner: WorkflowRunner, roleService: RoleService, projectService: ProjectService, nodeCatalogService: NodeCatalogService, workflowCreationService: WorkflowCreationService, nodeTypes: NodeTypes, projectRepository: ProjectRepository, folderFinderService: FolderFinderService, sharedWorkflowRepository: SharedWorkflowRepository, executionRepository: ExecutionRepository, executionService: ExecutionService, executionListService: ExecutionListService, dataTableProxyService: DataTableProxyService, collaborationService: CollaborationService, nodeResourceExplorerService: NodeResourceExplorerService, tagService: TagService, licenseState: LicenseState, postHogClient: PostHogClient, workflowHistoryService: WorkflowHistoryService, workflowsConfig: WorkflowsConfig, workflowPublishedDataService: WorkflowPublishedDataService, errorWorkflowValidationService: ErrorWorkflowValidationService, aiGatewayService: AiGatewayService, postSaveMetrics: McpPostSaveMetricsService, moduleRegistry: ModuleRegistry, eventService: EventService, folderService: FolderService, aiPreferenceService: AiPreferenceService, mcpConfig: McpConfig, executionRedactionServiceProxy: ExecutionRedactionServiceProxy); resolveFeatureFlags(user: User): Promise; private resolveMcpApps; private buildMcpAppTelemetryConfig; createToolRegistrar(server: McpServer, user: User, clientInfo?: McpClientInfo, auth?: McpAuthContext): (tool: ToolDefinition) => import("@modelcontextprotocol/server").RegisteredTool; createResourceRegistrar(server: McpServer): RegisterResourceFn; getServer(user: User, featureFlags: McpFeatureFlags, clientInfo?: McpClientInfo, auth?: McpAuthContext): Promise; private isInstallToolAvailable; private registerInstallCommunityNodeTool; private registerBuilderTools; get isQueueMode(): boolean; createPendingResponse(executionId: string): IDeferredPromise; handleWorkerResponse(executionId: string, runData: IRun | undefined): void; removePendingResponse(executionId: string): void; cancelPendingExecution(executionId: string, reason?: string): void; cancelAllPendingExecutions(reason?: string): void; get pendingExecutionCount(): number; }