Reference
Plugins
Built-in plugins that extend the Routecraft runtime. Each entry opens its own reference page with the full options and behaviour.
- 01
llmPluginLanguage models.@routecraft/aiConfigure provider keys, default models, and global LLM defaults for every agent and llm() call in the context.
- 02
embeddingPluginVectors.@routecraft/aiWire an embedding provider for the embedding() destination and downstream clustering with cosine().
- 03
mcpPluginMCP server runtime.@routecraft/aiExpose mcp() capabilities over Model Context Protocol, with JWT, OAuth 2.1, and bearer-token verification built in.
- 04
agentPluginAgent registry and harness.@routecraft/aiRegister named agents, the tools they can call, and shared defaults like system prompt and principal context.
- 05
httpPluginHTTP server runtime.@routecraft/routecraftExpose routes over HTTP via the http() source. Bun.serve native on Bun, node:http shim on Node; JWT, JWKS, or API-key auth at the plugin boundary.
Core adapter defaults (cron, direct) are set via dedicated fields on CraftConfig, not via plugins. See Configuration and Merged Options.
First-class config keys
Importing @routecraft/ai augments CraftConfig with first-class keys for the AI plugins. Setting llm, mcp, embedding, or agent on the config is equivalent to pushing the corresponding plugin onto plugins: []. Lifecycle (apply, teardown, plugin events) is identical.
// Before (still supported, use this for shared plugin instances or programmatic composition)
import { defineConfig } from '@routecraft/routecraft'
import { llmPlugin, mcpPlugin } from '@routecraft/ai'
export const craftConfig = defineConfig({
plugins: [
llmPlugin({ providers: { openai: { apiKey: '...' } } }),
mcpPlugin({ clients: { /* ... */ } }),
],
})
// After (recommended for declarative configs)
import { defineConfig } from '@routecraft/routecraft'
import '@routecraft/ai' // augments CraftConfig
export const craftConfig = defineConfig({
llm: { providers: { openai: { apiKey: '...' } } },
mcp: { clients: { /* ... */ } },
})
The factories listed above remain available unchanged. Use them via plugins: [] when you need to instantiate a plugin once and reuse it (across multiple contexts) or compose plugins programmatically.
Related
Configuration
craft.config.ts and the merged options resolution order.
Adapters
The connectors that plugins configure defaults for.
AI capabilities
Build the agent or expose capabilities to one.