# Plugins and adapters

> Find a FrontMCP plugin for caching, approvals, memory, feature flags, or tool discovery. See which package to install and where to register it.

Source: https://frontmcp.dev/reference/plugins

[Checked against FrontMCP 1.15.2](https://frontmcp.dev/versions#how-pages-are-checked) on December 4, 2026

Choose a plugin for a behavior that several tools need, such as caching results or asking for approval. Register it in the app’s `plugins` list. If you have an OpenAPI description and want to generate tools from its operations, register the OpenAPI adapter in `adapters`.

The directory below covers the FrontMCP packages, their settings, and where to register them. To package your own behavior, see [`@Plugin`](https://frontmcp.dev/reference/sdk/plugin).

```ts
@App({ id, name, tools, plugins: [CachePlugin.init({ ... })], adapters: [OpenapiAdapter.init({ name, ... })] })
@FrontMcp({ info, apps, plugins: [RememberPlugin.init({ ... })] })
```



---

<a id="reference"></a>

## Reference

<a id="the-official-plugins-and-adapters"></a>

### The official plugins and adapters

| Package | Export | What it does | Page |
| --- | --- | --- | --- |
| `@frontmcp/plugin-cache` | `CachePlugin` | Answers repeated tool calls from a store instead of running the tool again. | [Cache](https://frontmcp.dev/reference/plugins/cache) |
| `@frontmcp/plugin-result-handles` | `ResultHandlesPlugin` | Folds large answers behind a handle and adds `result_query`. | [Result handles](https://frontmcp.dev/reference/plugins/result-handles) |
| `@frontmcp/plugin-remember` | `RememberPlugin` | `this.remember`, an encrypted key-value memory for tools, and, when you turn them on, four tools that let the model remember things. | [Remember](https://frontmcp.dev/reference/plugins/remember) |
| `@frontmcp/plugin-approval` | `ApprovalPlugin` | Stops tools marked with `approval` until the call is approved. | [Approval](https://frontmcp.dev/reference/plugins/approval) |
| `@frontmcp/plugin-feature-flags` | `FeatureFlagPlugin` | Gates tools, resources, prompts and skills behind flags from a static list, Split, LaunchDarkly, Unleash or your own source. | [Feature flags](https://frontmcp.dev/reference/plugins/feature-flags) |
| `@frontmcp/plugin-codecall` | `CodeCallPlugin` | Nine `codecall:*` tools with which the model searches your tools and runs short scripts that call them, including `codecall:resume`, `codecall:status` and `codecall:cancel` for a script that paused before a call. Those three are listed while the default `runs` options are on. | [CodeCall](https://frontmcp.dev/reference/plugins/codecall) |
| `@frontmcp/plugin-skilled-openapi` | `SkilledOpenApiPlugin` | Serves a REST API as skill bundles, with its operations behind a few meta-tools instead of one tool each. | [Skilled OpenAPI](https://frontmcp.dev/reference/plugins/skilled-openapi) |
| `@frontmcp/plugin-dashboard` | `DashboardPlugin`, `DashboardApp` | A web page and an MCP endpoint that show what the server has. | [The dashboard](https://frontmcp.dev/reference/plugins#the-dashboard) |
| `@frontmcp/plugin-webmcp` | `WebMcpPlugin` | Offers the tools of a server that runs in a web page to the agents in the user's browser, through WebMCP. | [WebMCP](https://frontmcp.dev/reference/plugins/webmcp) |
| `@frontmcp/adapters` | `OpenapiAdapter` | Tools for supported operations in an OpenAPI 3 spec, which call the API. | [OpenAPI adapter](https://frontmcp.dev/reference/adapters/openapi) |

<a id="recording-client-calls"></a>

### Recording client calls

[`CallRecorderPlugin`](https://frontmcp.dev/reference/testing#recording-and-replaying-client-calls) is built into `@frontmcp/sdk`. It records tool calls, resource reads and prompt gets as redacted JSONL for replay against another server version. It needs a Node file, so the Playground cannot record a session.

<a id="packages"></a>

### Packages

Install the packages you use alongside `@frontmcp/sdk`, and keep every `@frontmcp/*` package on one version:

```bash
npm install @frontmcp/sdk @frontmcp/plugin-cache @frontmcp/plugin-remember @frontmcp/adapters
```

Approval, CodeCall, dashboard, feature flags, Remember, Skilled OpenAPI, WebMCP and the `@frontmcp/plugins` package take the SDK as an exact peer, so they use the app's SDK copy. Cache and the OpenAPI adapter keep it as a dependency; `@frontmcp/react` keeps both its dependency and peer. Apps without an SDK dependency must add one on Yarn, pnpm with `auto-install-peers=false`, or npm with `legacy-peer-deps`; npm 7+ and pnpm's defaults install peers for you.

`@frontmcp/plugins` installs four of them and re-exports what they export: the cache, CodeCall, dashboard and Remember plugins. It doesn't include the approval, feature flags, result handles, Skilled OpenAPI or WebMCP plugins, or the adapters. Importing `CachePlugin` from `@frontmcp/plugins` gives the same class as importing it from `@frontmcp/plugin-cache`, so pick one and use it everywhere. `@frontmcp/plugin-codecall` also needs `@frontmcp/plugin-cache`, a peer dependency you install next to it.

<a id="registering-a-plugin"></a>

### Registering a plugin

Put `SomePlugin.init(options)` in the `plugins` array of an `@App`, for that app, or of `@FrontMcp`, for the whole server:

| | In `@App({ plugins })` | In `@FrontMcp({ plugins })` |
| --- | --- | --- |
| Hooks on calls, like the cache's lookup or an approval check | That app's tools. The approval and feature-flag gates also cover apps that have no such plugin of their own. | Every app's tools |
| Tools the plugin adds, like CodeCall's | Added to that app | Added once, for the server |
| Providers the plugin builds from its options, like the one behind `this.remember` | That app's tools | Every app's tools |

A plugin's providers stay in the app that registered it. A tool in another app gets `RememberPlugin is not installed`, `this.get()` throws `ProviderNotAvailableError` and `this.tryGet()` returns `undefined`. Register the plugin on `@FrontMcp`, or on each app that uses it.

The full rules, for any plugin, are in [where you register a plugin](https://frontmcp.dev/reference/sdk/plugin#where-you-register-a-plugin). An [`@Agent`](https://frontmcp.dev/reference/sdk/agent) has `plugins` too, for the tools declared inside it: the agent runs those itself, and only its own plugins apply to them. See [putting a plugin on an agent](https://frontmcp.dev/reference/sdk/plugin#putting-a-plugin-on-an-agent), and [flagging an agent](https://frontmcp.dev/reference/plugins/feature-flags#flagging-an-agent) for an official one.

- **`init()` needs no argument when every option has a default.** `CachePlugin.init()`, `RememberPlugin.init()`, `ApprovalPlugin.init()` and `CodeCallPlugin.init()` don't throw: each is the same as `init({})`. A required option is still required: feature flags need an `adapter` (`FeatureFlagPlugin.init()` throws a `FeatureFlagConfigurationError`), and Skilled OpenAPI needs a `source` (`init()` throws a `ZodError`). The bare class, `plugins: [RememberPlugin]`, is the same as `init()` with no argument: it works for the cache, Remember, approval and CodeCall plugins, and a plugin with a required option stops the server from starting with the error its `init()` throws.
- **`init()` runs when your module is imported**, not when the server starts. See [`DynamicPlugin`](https://frontmcp.dev/reference/sdk/plugin#dynamicpluginoptions-input).
- **An option named like a list field of `@Plugin` is that field only when it's an array.** `init()` copies its options onto the plugin's registration, where `tools`, `resources`, `prompts`, `skills`, `adapters`, `plugins`, `exports` and `providers` describe the plugin itself. An array registers what it lists. Any other value stays the plugin's option, which is how Remember takes `tools: { enabled: true }`, and a plugin can add tools from it with a static `dynamicTools(options)`, as `dynamicProviders(options)` adds providers. The Playground below runs each case.
- **Options named `name`, `id`, `description` or `scope` are only options.** They reach the plugin, and don't rename it or change where it applies.

<a id="registering-an-adapter"></a>

### Registering an adapter

Put `SomeAdapter.init(options)` in the `adapters` array of an `@App`, of a `@Plugin`, or of `@FrontMcp`, which serves the adapter's tools from every app. When two adapters make a tool of the same name, both are listed with their adapter's name in front, like `pets:getPet` and `pets-v2:getPet`.

Every adapter needs a `name` unique among records of its class in the same `adapters` list. See the [OpenAPI adapter](https://frontmcp.dev/reference/adapters/openapi).

<a id="what-a-plugin-can-add"></a>

### What a plugin can add

| A plugin can add | The official plugins' examples |
| --- | --- |
| Hooks that run on every call | The cache answers from its store before `execute()`; the approval plugin stops unapproved calls. |
| Fields on `@Tool` and other decorators | `cache` (cache), `approval` (approval), `codecall` (CodeCall), and `featureFlag` on tools, resources, resource templates, prompts, skills and agents (feature flags). TypeScript knows about a field once your code imports the package. A server where an entry has `approval` or `featureFlag` and no plugin enforces it doesn't start: see [Fields that need their plugin](https://frontmcp.dev/reference/plugins#fields-that-need-their-plugin). |
| Members on `this` | `this.remember` (Remember), `this.approval` (approval), `this.featureFlags` (feature flags). |
| Tools | CodeCall adds its `codecall:*` tools, and Remember its four memory tools when `tools.enabled` is set. |
| Providers | Services and stores you can get with `this.get()`, like Remember's `RememberAccessorToken` or CodeCall's `AuditLoggerService`. |
| A whole app | The dashboard's `DashboardApp`, with its own MCP endpoint. |

A field like `cache` goes at the top level of `@Tool`, next to `name`, not inside another object.

<a id="fields-that-need-their-plugin"></a>

#### Fields that need their plugin

`approval` and `featureFlag` ask for protection, so a server whose entries use them without a plugin to enforce them refuses to start, with `UnenforcedMetadataError` and one line per entry: `Unenforced metadata: Tool "bulk_export" declares 'featureFlag' (enforced by FeatureFlagPlugin from @frontmcp/plugin-feature-flags). …`. Install the plugin on the server or on an app, or remove the field; a tool declared inside an `@Agent` needs the plugin on that agent. `cache` and `codecall` aren't checked: without their plugin they do nothing. A plugin you write can have fields checked the same way, with `@Plugin({ enforcesMetadata })`: see [enforcing an option of your own](https://frontmcp.dev/reference/sdk/plugin#enforcing-an-option-of-your-own).

<a id="es-module-projects"></a>

### ES module projects

The packages for Node servers load and run in an ES module project (`"type": "module"` in `package.json`) as in the CommonJS project `frontmcp create` makes. This was checked with Node 24, outside the Playground: each package above but WebMCP, which is for servers in a web page, loaded, and a server ran with the cache, CodeCall, dashboard and Remember plugins. The Split, LaunchDarkly and Unleash adapters and Remember's `"vercel-kv"` store load their SDKs as in a CommonJS project, and say so when one isn't installed.

<a id="the-dashboard"></a>

### The dashboard

`@frontmcp/plugin-dashboard` shows a server's apps, tools, resources and prompts in a browser. Its page is an [`@HttpRoute`](https://frontmcp.dev/reference/sdk/http-route) served by the Node HTTP host and [`createFetchHandler()`](https://frontmcp.dev/reference/sdk/create-fetch-handler). The route also checks `throttle.ipFilter`. The page loads libraries from a CDN, so the Playground does not render it. Register the plugin for its options, and add `DashboardApp` to `apps`, which is what serves it:

```ts main.ts
import { FrontMcp } from "@frontmcp/sdk";
import { DashboardApp, DashboardPlugin } from "@frontmcp/plugin-dashboard";
import { HelpDeskApp } from "./help-desk.app";

@FrontMcp({
  info: { name: "help-desk", version: "1.0.0" },
  apps: [HelpDeskApp, DashboardApp],
  plugins: [DashboardPlugin.init({ auth: { enabled: true, token: process.env.DASHBOARD_TOKEN } })],
})
export default class Server {}
```

- **`GET /dashboard`** answers with an HTML page that loads React, React Flow and dagre from `esm.sh`, so the browser needs internet access. The page reads the inventory from the dashboard's MCP endpoint.
- **`/dashboard`** is also an MCP endpoint of its own, with three tools, `dashboard:graph`, `dashboard:list-tools` and `dashboard:list-resources`, which describe the whole server. They aren't listed at the main endpoint, and [`createDirect()`](https://frontmcp.dev/reference/sdk/create#frontmcpinstancecreatedirectconfig), `createFetchHandler()` and the other entry points serve the server's own apps even when `DashboardApp` comes first in `apps`. The endpoint applies the server's own [auth](https://frontmcp.dev/reference/auth/modes) first, then the dashboard's `auth`. `dashboard:list-tools` takes a `filter`, the tools whose name contains that text, ignoring case, and `dashboard:list-resources` the same for a resource's name or URI. A `.` or `*` in `filter` is just that character.

| Option | Default | Description |
| --- | --- | --- |
| `enabled` | On, unless `NODE_ENV` is `production` | Serve the dashboard. When it's off, the page and the MCP endpoint both answer `404`, the endpoint with `The FrontMCP dashboard is disabled.` To use the dashboard in production, set `enabled: true` with `auth`. |
| `basePath` | `"/dashboard"` | Where the page is served. The MCP endpoint stays at `/dashboard`, and the page connects to it there. |
| `auth.enabled`, `auth.token` | Off | Require the token for the page and the MCP endpoint, and answer `401` without it. `enabled` without `token` makes `init()` throw `dashboard auth.enabled requires auth.token to be set`. |
| `cdn` | `esm.sh` URLs | Where the page loads its libraries from: `entrypoint`, `react`, `reactDom`, `reactDomClient`, `reactJsxRuntime`, `reactRouter`, `xyflow`, `dagre`, `xyflowCss`. |

With `auth` on, the token goes:

- **To the page** as `Authorization: Bearer <token>` or `?token=<token>`. The page then sets a cookie, `frontmcp_dashboard` (`HttpOnly`, `SameSite=Strict`, and `Secure` over https), which its own MCP client sends.
- **To the MCP endpoint** as `Authorization: Bearer <token>`, as `x-frontmcp-dashboard-token: <token>`, or with that cookie. `?token=` isn't accepted there. On a server with its own auth, `Authorization` carries the server's credential, so send the dashboard token in `x-frontmcp-dashboard-token`. Without a valid token, the endpoint answers `401` with `WWW-Authenticate: Bearer realm="frontmcp-dashboard"`.

`DashboardPlugin.init()` alone serves nothing: `DashboardApp` serves the dashboard, with the default options when there's no plugin. Dashboard options apply to the whole process: a second `DashboardPlugin.init()` with a different `auth` throws, and one with other differences replaces the first for every server, with a warning.

<a id="writing-your-own"></a>

### Writing your own

A plugin is a class with `@Plugin` that extends `DynamicPlugin`. [`@Plugin`](https://frontmcp.dev/reference/sdk/plugin) covers every option, hooks, providers, context members like `this.remember`, fields the server checks with `enforcesMetadata`, and where to register it, and [Extending with Plugins](https://frontmcp.dev/learn/extending-with-plugins) builds one step by step. [Hooks](https://frontmcp.dev/reference/sdk/hooks) lists what a plugin can hook.

An adapter, which turns another description of an API into tools as the OpenAPI adapter does, is a class with `@Adapter` that extends `DynamicAdapter`: see [`@Adapter`](https://frontmcp.dev/reference/sdk/adapter).

---

<a id="usage"></a>

## Usage

<a id="using-official-plugins-and-an-adapter-together"></a>

### Using official plugins and an adapter together

A shop server: the catalog app caches its product lookups, every app can use `this.remember` because the Remember plugin is on the server, and the pets app's tools come from an OpenAPI spec:

Initial call configuration:

```js
{ tool: "get_product", arguments: { sku: "KB-101" } }
```

```ts main.ts active
import { FrontMcp } from "@frontmcp/sdk";
import { RememberPlugin } from "@frontmcp/plugin-remember";
import { CatalogApp, PetsApp } from "./apps";

@FrontMcp({
  info: { name: "shop", version: "1.0.0" },
  apps: [CatalogApp, PetsApp],
  plugins: [RememberPlugin.init({ type: "memory" })], // this.remember, for every app
})
export default class Server {}
```

```ts apps.ts
import { App, Tool, ToolContext, z } from "@frontmcp/sdk";
import { CachePlugin } from "@frontmcp/plugin-cache";
import { OpenapiAdapter } from "@frontmcp/adapters";
import { petsSpec } from "./pets.openapi";

let lookups = 0;

@Tool({
  name: "get_product",
  description: "A product by SKU",
  inputSchema: { sku: z.string() },
  cache: { ttl: 600 }, // a field the cache plugin adds to @Tool
})
export class GetProduct extends ToolContext {
  async execute({ sku }: { sku: string }) {
    return { sku, name: "Mechanical keyboard", lookup: ++lookups };
  }
}

@Tool({ name: "feature_product", description: "Feature a product on the home page", inputSchema: { sku: z.string() } })
export class FeatureProduct extends ToolContext {
  async execute({ sku }: { sku: string }) {
    await this.remember.set("featured", sku, { scope: "global" }); // a member the Remember plugin adds
    return { featured: sku };
  }
}

@Tool({ name: "featured_product", description: "The product on the home page", inputSchema: {} })
export class FeaturedProduct extends ToolContext {
  async execute() {
    return { featured: await this.remember.get("featured", { scope: "global", defaultValue: null }) };
  }
}

@App({
  id: "catalog",
  name: "Catalog",
  tools: [GetProduct, FeatureProduct, FeaturedProduct],
  plugins: [CachePlugin.init({ type: "memory", keyByIdentity: false })], // the same answer for everyone
})
export class CatalogApp {}

@App({
  id: "pets",
  name: "Pets",
  adapters: [OpenapiAdapter.init({ name: "pets", baseUrl: "https://pets.example.com", spec: petsSpec })],
})
export class PetsApp {}
```

```ts pets.openapi.ts
export const petsSpec = {
  openapi: "3.0.3",
  info: { title: "Pets", version: "1.0.0" },
  paths: {
    "/pets/{id}": {
      get: {
        operationId: "getPet",
        summary: "Get a pet by id",
        parameters: [{ name: "id", in: "path", required: true, schema: { type: "string" } }],
        responses: { "200": { description: "The pet" } },
      },
    },
  },
};
```

```ts plugins.test.ts
import { test, expect } from "@frontmcp/testing";
import { App, DynamicPlugin, FrontMcpInstance, Plugin, Tool, ToolContext } from "@frontmcp/sdk";
import { CachePlugin } from "@frontmcp/plugin-cache";
import { RememberPlugin } from "@frontmcp/plugin-remember";
import { ApprovalPlugin } from "@frontmcp/plugin-approval";
import { CodeCallPlugin } from "@frontmcp/plugin-codecall";
import { FeatureFlagConfigurationError, FeatureFlagPlugin } from "@frontmcp/plugin-feature-flags";
import { SkilledOpenApiPlugin } from "@frontmcp/plugin-skilled-openapi";
import { OpenapiAdapter } from "@frontmcp/adapters";
import * as umbrella from "@frontmcp/plugins";
import { CatalogApp, FeaturedProduct, FeatureProduct, PetsApp } from "./apps";
import { petsSpec } from "./pets.openapi";

test("the adapter turns each operation into a tool", async ({ mcp }) => {
  expect(await mcp.tools.list()).toContainTool("getPet");
});

test("`cache` on @Tool comes from the cache plugin", async ({ mcp }) => {
  const first = await mcp.tools.call("get_product", { sku: "MS-7" });
  const second = await mcp.tools.call("get_product", { sku: "MS-7" });
  expect(second.json().lookup).toBe(first.json().lookup);
  expect(second.raw._meta.cache).toBe("hit");
});

test("`this.remember` comes from the Remember plugin on the server", async ({ mcp }) => {
  await mcp.tools.call("feature_product", { sku: "KB-101" });
  expect((await mcp.tools.call("featured_product", {})).json()).toEqual({ featured: "KB-101" });
});

test("@frontmcp/plugins exports the same classes", () => {
  expect(umbrella.CachePlugin).toBe(CachePlugin);
  expect(umbrella.RememberPlugin).toBe(RememberPlugin);
});

test("`init()` with no argument is the same as `init({})`", () => {
  for (const plugin of [CachePlugin, RememberPlugin, ApprovalPlugin, CodeCallPlugin]) {
    expect(() => plugin.init()).not.toThrow();
  }
});

test("a plugin with a required option still needs it", () => {
  expect(() => SkilledOpenApiPlugin.init()).toThrow(/source/);
  expect(() => FeatureFlagPlugin.init()).toThrow(FeatureFlagConfigurationError);
});

test("the bare class is the same as `init()` with no argument", async () => {
  const info = { name: "shop", version: "1.0.0" };

  @App({ id: "catalog", name: "Catalog", tools: [FeatureProduct, FeaturedProduct], plugins: [RememberPlugin] })
  class BareRemember {}

  const server = await FrontMcpInstance.createDirect({ info, apps: [BareRemember] });
  await server.callTool("feature_product", { sku: "KB-101" });
  expect((await server.callTool("featured_product", {})).structuredContent).toEqual({ featured: "KB-101" });
  await server.dispose();

  @App({ id: "flags", name: "Flags", tools: [FeatureProduct], plugins: [FeatureFlagPlugin] })
  class BareFeatureFlags {}

  await expect(FrontMcpInstance.createDirect({ info, apps: [BareFeatureFlags] })).rejects.toThrow(FeatureFlagConfigurationError);
});

test("a plugin on one app doesn't give `this.remember` to the tools of another", async () => {
  @Tool({ name: "read_featured", description: "The product on the home page", inputSchema: {} })
  class ReadFeatured extends ToolContext {
    async execute() {
      return { featured: await this.remember.get("featured", { scope: "global", defaultValue: null }) };
    }
  }

  @App({ id: "writer", name: "Writer", tools: [FeatureProduct], plugins: [RememberPlugin.init({ type: "memory" })] })
  class WriterApp {}

  @App({ id: "reader", name: "Reader", tools: [ReadFeatured] })
  class ReaderApp {}

  const server = await FrontMcpInstance.createDirect({ info: { name: "shop", version: "1.0.0" }, apps: [WriterApp, ReaderApp] });
  await server.callTool("feature_product", { sku: "KB-101" });
  await expect(server.callTool("read_featured", {})).rejects.toThrow("RememberPlugin is not installed. Add RememberPlugin.init() to your plugins array.");
  await server.dispose();
});

test("an option named like a list stays an option, and dynamicTools turns it into tools", async () => {
  @Tool({ name: "audit_trail", description: "The audit trail", inputSchema: {} })
  class AuditTrail extends ToolContext {
    async execute() {
      return { entries: [] };
    }
  }

  @Plugin({ name: "audit" })
  class AuditPlugin extends DynamicPlugin<{ tools?: { enabled?: boolean } }> {
    static dynamicTools = (options: { tools?: { enabled?: boolean } }) => (options.tools?.enabled ? [AuditTrail] : []);
  }

  const listed = async (options: object) => {
    @App({ id: "audit", name: "Audit", plugins: [AuditPlugin.init(options)] })
    class Audited {}
    const server = await FrontMcpInstance.createDirect({ info: { name: "shop", version: "1.0.0" }, apps: [Audited] });
    const { tools } = await server.listTools();
    await server.dispose();
    return tools.map((t: { name: string }) => t.name);
  };

  expect(await listed({ tools: { enabled: true } })).toEqual(["audit_trail"]);
  expect(await listed({ tools: { enabled: false } })).toEqual([]);
  expect(await listed({ tools: [AuditTrail] })).toEqual(["audit_trail"]); // an array registers what it lists
});

test("so does an option named providers that isn't an array", async () => {
  type AuditOptions = { providers?: { retention: string } };

  @Plugin({ name: "audit" })
  class AuditPlugin extends DynamicPlugin<AuditOptions> {
    static dynamicTools = (options: AuditOptions) => {
      @Tool({ name: "audit_retention", description: "How long the audit trail is kept", inputSchema: {} })
      class AuditRetention extends ToolContext {
        async execute() {
          return { retention: options.providers?.retention };
        }
      }
      return [AuditRetention];
    };
  }

  @App({ id: "audit", name: "Audit", plugins: [AuditPlugin.init({ providers: { retention: "30d" } })] })
  class Audited {}
  const server = await FrontMcpInstance.createDirect({ info: { name: "shop", version: "1.0.0" }, apps: [Audited] });
  expect((await server.callTool("audit_retention", {})).structuredContent).toEqual({ retention: "30d" });
  await server.dispose();
});

test("`featureFlag` without its plugin stops the server", async () => {
  @Tool({ name: "bulk_export", description: "Export every product as CSV", inputSchema: {}, featureFlag: "bulk-export" })
  class BulkExport extends ToolContext {
    async execute() {
      return { csv: "sku,name" };
    }
  }
  const withPlugins = (...plugins: object[]) => {
    @App({ id: "catalog", name: "Catalog", tools: [BulkExport], plugins: plugins as never })
    class Catalog {}
    return FrontMcpInstance.createDirect({ info: { name: "shop", version: "1.0.0" }, apps: [Catalog] });
  };

  await expect(withPlugins()).rejects.toThrow(
    "Tool \"bulk_export\" declares 'featureFlag' (enforced by FeatureFlagPlugin from @frontmcp/plugin-feature-flags)",
  );
  const server = await withPlugins(FeatureFlagPlugin.init({ adapter: "static", flags: { "bulk-export": true } }));
  await server.dispose();
});

test("`cache` and `codecall` without their plugin do nothing", async () => {
  let runs = 0;
  @Tool({ name: "get_price", description: "A product's price", inputSchema: {}, cache: true, codecall: { enabledInCodeCall: true } })
  class GetPrice extends ToolContext {
    async execute() {
      return { run: ++runs };
    }
  }
  @App({ id: "prices", name: "Prices", tools: [GetPrice] })
  class Prices {}

  const server = await FrontMcpInstance.createDirect({ info: { name: "shop", version: "1.0.0" }, apps: [Prices] });
  await server.callTool("get_price", {});
  expect((await server.callTool("get_price", {})).structuredContent).toEqual({ run: 2 }); // not cached
  await server.dispose();
});

test("an adapter in @FrontMcp serves its tools from every app", async () => {
  const server = await FrontMcpInstance.createDirect({
    info: { name: "shop", version: "1.0.0" },
    apps: [CatalogApp],
    adapters: [OpenapiAdapter.init({ name: "pets-on-server", baseUrl: "https://pets.example.com", spec: petsSpec })],
  });
  const { tools } = await server.listTools();
  expect(tools.map((t: { name: string }) => t.name)).toContain("getPet");
  await server.dispose();
});

test("two adapters that make the same tool name each put their name in front", async () => {
  const server = await FrontMcpInstance.createDirect({
    info: { name: "shop", version: "1.0.0" },
    apps: [CatalogApp, PetsApp],
    adapters: [OpenapiAdapter.init({ name: "pets-v2", baseUrl: "https://pets.example.com", spec: petsSpec })],
  });
  const { tools } = await server.listTools();
  expect(tools.map((t: { name: string }) => t.name).filter((name: string) => name.endsWith("getPet")).sort()).toEqual(["pets-v2:getPet", "pets:getPet"]);
  await server.dispose();
});
```

Each plugin's own page has examples for its options. The adapter's tools call the API over HTTP; the [OpenAPI adapter](https://frontmcp.dev/reference/adapters/openapi) page shows calls, with the API stood in for.

---

<a id="troubleshooting"></a>

## Troubleshooting

<a id="err_package_path_not_exported-package-subpath-redos-is-not-defined-by-exports"></a>

### `ERR_PACKAGE_PATH_NOT_EXPORTED`: Package subpath './redos' is not defined by "exports"

Upgrade the affected packages together with the SDK and reinstall dependencies.

<a id="unenforced-metadata-tool--declares-approval-or-featureflag"></a>

### `Unenforced metadata: Tool "…" declares 'approval'` (or `'featureFlag'`)

An entry has `approval` or `featureFlag`, and the plugin that enforces it isn't installed where it reaches the entry, so the server doesn't start. See [Fields that need their plugin](https://frontmcp.dev/reference/plugins#fields-that-need-their-plugin).

<a id="the-dashboard-answers-404-or-401"></a>

### The dashboard answers `404` or `401`

`404` with `The FrontMCP dashboard is disabled.`: `enabled` is `false`, or `NODE_ENV` is `production` and `enabled` isn't set. `401`: `auth` is on and the request has no valid token; at the MCP endpoint, `?token=` doesn't count. See [The dashboard](https://frontmcp.dev/reference/plugins#the-dashboard).

<a id="rememberplugin-is-not-installed-or-provider--is-not-available-in-another-apps-tool"></a>

### `RememberPlugin is not installed`, or `Provider "…" is not available`, in another app's tool

The plugin is registered on one app, and the tool is in another. A plugin's providers, like `this.remember` or `this.approval`, reach only the app that registered it. Register the plugin on `@FrontMcp`, or on that app too. See [Registering a plugin](https://frontmcp.dev/reference/plugins#registering-a-plugin).

<a id="duplicate-adapter-name-x-for-openapiadapter"></a>

### `Duplicate adapter name 'x' for OpenapiAdapter`

Two distinct `OpenapiAdapter.init()` records in one adapter list used the same `name`. Give each adapter its own name. See the [OpenAPI adapter](https://frontmcp.dev/reference/adapters/openapi).

<a id="plugin--requires-global-redis-configuration-add-redis-to-your-frontmcp-decorator-options"></a>

### `Plugin "…" requires global "redis" configuration. Add "redis" to your @FrontMcp decorator options.`

A plugin was given `type: "global-store"`, which uses the server's store, and `@FrontMcp` has no `redis`. See [the cache plugin's stores](https://frontmcp.dev/reference/plugins/cache#stores).

<a id="plugins-items-must-be-annotated-with-plugin"></a>

### `plugins items must be annotated with @Plugin()`

Something in `plugins` isn't a plugin: an adapter, which goes in `adapters`, or a tool or provider. See [`@Plugin`](https://frontmcp.dev/reference/sdk/plugin#app-invalid-metadata-for-plugins-plugins-items-must-be-annotated-with-plugin).
