import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { LicenseState, Logger } from '@n8n/backend-common'; import { ExecutionsConfig, GlobalConfig, WorkflowsConfig } from '@n8n/config'; import { ExecutionRepository, FolderRepository, 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 { ExecutionService } from '../../executions/execution.service'; import { SubworkflowPolicyChecker } from '../../executions/pre-execution-checks/subworkflow-policy-checker'; 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 { 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 { 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 type { McpAppsTelemetryVariant, McpClientInfo } from './mcp.types'; export type McpAppsResolution = { enabled: boolean; variant: McpAppsTelemetryVariant; }; export type McpFeatureFlags = { mcpApps: McpAppsResolution; canvasGroupsEnabled: 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 folderRepository; private readonly sharedWorkflowRepository; private readonly executionRepository; private readonly executionService; 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 subworkflowPolicyChecker; private readonly aiGatewayService; 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, folderRepository: FolderRepository, sharedWorkflowRepository: SharedWorkflowRepository, executionRepository: ExecutionRepository, executionService: ExecutionService, dataTableProxyService: DataTableProxyService, collaborationService: CollaborationService, nodeResourceExplorerService: NodeResourceExplorerService, tagService: TagService, licenseState: LicenseState, postHogClient: PostHogClient, workflowHistoryService: WorkflowHistoryService, workflowsConfig: WorkflowsConfig, workflowPublishedDataService: WorkflowPublishedDataService, subworkflowPolicyChecker: SubworkflowPolicyChecker, aiGatewayService: AiGatewayService); resolveFeatureFlags(user: User): Promise; private resolveMcpApps; private buildMcpAppTelemetryConfig; getServer(user: User, featureFlags: McpFeatureFlags, clientInfo?: McpClientInfo, grantedScopes?: string[]): Promise; 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; }