Skip to main content
FrontMCP includes a built-in dependency injection system. Define services with @Provider, inject them into tools, resources, prompts, and agents with this.get().

Defining Providers

Create a provider with a name and (optional) scope:
To inject by interface, register with a token (a class, abstract class, or symbol). The class itself is the most common token:

Provider Scopes

'session' and 'request' are kept as deprecated aliases of 'context'.

Injecting Providers

Use this.get() or this.tryGet() inside any context class:

Registering Providers

Register providers at the server or app level:
Server-level providers are shared across all apps. App-level providers are isolated to their app.

Learn More

Providers Guide

Full guide to defining, scoping, and composing providers

@Provider Reference

Complete decorator API reference