/** * Application composition root. * * Builds the service graph (`buildServices`) and a fully-registered McpServer * (`buildServer`) from it. Shared by every transport entry point (stdio and * Streamable HTTP) so tools/resources/prompts are wired in exactly one place. */ import type { McpServer, Server } from '@modelcontextprotocol/server'; import BlobStore from './cache/blob-store.js'; import CacheStore from './cache/store.js'; import SyncEngine from './cache/sync-engine.js'; import ConnectionManager from './connections/manager.js'; import CalendarService from './services/calendar.service.js'; import ClipboardService from './services/clipboard.service.js'; import DialogService from './services/dialog.service.js'; import HooksService from './services/hooks.service.js'; import ImapService from './services/imap.service.js'; import LocalCalendarService from './services/local-calendar.service.js'; import MailReadService from './services/mail-read.service.js'; import RemindersService from './services/reminders.service.js'; import SchedulerService from './services/scheduler.service.js'; import SmtpService from './services/smtp.service.js'; import TemplateService from './services/template.service.js'; import VerificationCatcherService from './services/verification-catcher.service.js'; import WatcherService from './services/watcher.service.js'; import type { AppConfig } from './types/index.js'; /** The full, shared service graph for one server process. */ export interface AppServices { config: AppConfig; connections: ConnectionManager; imapService: ImapService; /** Read-model facade — every read tool goes through this, never ImapService. */ mailReadService: MailReadService; smtpService: SmtpService; templateService: TemplateService; calendarService: CalendarService; localCalendarService: LocalCalendarService; remindersService: RemindersService; schedulerService: SchedulerService; watcherService: WatcherService; hooksService: HooksService; clipboardService: ClipboardService; dialogService: DialogService; verificationCatcher: VerificationCatcherService; /** Absent when the local mirror is disabled in config. */ cacheStore?: CacheStore; syncEngine?: SyncEngine; blobStore?: BlobStore; } /** Construct the full service graph from persisted configuration. */ export declare function buildServices(): Promise; /** * Build a fresh, fully-registered McpServer from an existing service graph. * * Safe to call per connection (stdio) or per request (stateless HTTP): the * services are shared singletons, only the thin protocol wrapper is new. */ export declare function buildServer(services: AppServices): McpServer; /** Handle for tearing down the process-level background services. */ export interface BackgroundHandle { stop: () => Promise; } /** * Start the process-level background services: the new-mail watcher (feeding * AI hooks + resource-update notifications) and the periodic scheduled-email * check. These are process-scoped, not per-connection or per-request. * * @param lowLevelServer the connected low-level `Server` for notifications / * opportunistic sampling, or `null` when no persistent connection applies. */ export declare function startBackgroundServices(services: AppServices, lowLevelServer: Server | null): BackgroundHandle; //# sourceMappingURL=app.d.ts.map