Skip to content

Interface: DevServerConfig

Defined in: packages/core/src/server/DevServer.ts:89

Configuration for the development server.

Properties

debounce?

ts
readonly optional debounce: number;

Defined in: packages/core/src/server/DevServer.ts:107

Debounce interval in milliseconds. Prevents rapid-fire reloads when editors save multiple files.

Default

ts
300

dir

ts
readonly dir: string;

Defined in: packages/core/src/server/DevServer.ts:94

Directory to watch for file changes. Relative paths are resolved from the current working directory.


extensions?

ts
readonly optional extensions: string[];

Defined in: packages/core/src/server/DevServer.ts:100

File extension filter for watched files.

Default

ts
['.ts', '.js', '.mjs', '.mts']

onReload()?

ts
readonly optional onReload: (changedFile) => void;

Defined in: packages/core/src/server/DevServer.ts:133

Optional callback when a reload occurs. Useful for logging or triggering downstream updates.

Parameters

ParameterType
changedFilestring

Returns

void


registry?

ts
readonly optional registry: ToolRegistryLike;

Defined in: packages/core/src/server/DevServer.ts:153

Optional real ToolRegistry reference for hot-reload.

When provided, builders collected during setup() are automatically transferred to this registry after each reload, making hot-reload effective. Without this, the user must close over their own registry in the setup callback (fragile and undocumented pattern).

If the registry implements clear(), old builders are removed before re-registration to avoid duplicates.


server?

ts
readonly optional server: McpServerLike;

Defined in: packages/core/src/server/DevServer.ts:140

Optional MCP server reference for sending tool list change notifications. When provided, the dev server sends notifications/tools/list_changed on every reload, so the LLM client picks up changes automatically.


setup()

ts
readonly setup: (registryOrCtx) => void | Promise<void>;

Defined in: packages/core/src/server/DevServer.ts:127

Setup callback invoked on every reload.

Receives either a ToolRegistryLike (legacy) or a DevServerSetupContext with the registry and cache-busted URL.

For ESM hot-reload to work, use the cacheBustUrl from the context when re-importing modules:

ts
setup: async (ctx) => {
  const { registry, cacheBustUrl: url } = ctx as DevServerSetupContext;
  const mod = await import(url ?? './src/tools.ts');
  registry.register(mod.default);
}

This is called on initial startup and on every file change.

Parameters

ParameterType
registryOrCtxToolRegistryLike | DevServerSetupContext

Returns

void | Promise<void>