Type-safe dependency injection with @Provider and scoped containers
FrontMCP includes a built-in dependency injection system. Define services with @Provider, inject them into tools, resources, prompts, and agents with this.get().
// Server-level — available to all apps@FrontMcp({ info: { name: 'Server', version: '1.0.0' }, apps: [MyApp], providers: [ConfigProvider, DatabaseProvider],})class Server {}// App-level — available only within this app@App({ id: 'crm', name: 'CRM', tools: [CreateLeadTool], providers: [CrmServiceProvider],})class CrmApp {}
Server-level providers are shared across all apps. App-level providers are isolated to their app.