Skip to main content

Models, MCP servers, and policy

Documentation for v0.0.1. Additional guides and API reference coverage are being expanded.
This configuration is illustrative; no live model/server compatibility or authorization is provided by the docs. Use a predictable separation: connect model adapters, supply a trusted MCP server array, and declare routing preferences and authorization under policy. This is a configuration pattern, not a working provider/server fixture: it needs an authorized OpenAI-compatible endpoint, compatible AI SDK dependencies, credentials, and two already running Streamable HTTP MCP servers exposing the stated tools. It is not necessary for the model-free local quickstart. The fragment below illustrates the pattern; it is not a tested live walkthrough. Adapt the exact tool names and schemas to your servers. The selected public patch profile supplies the release’s strict-TypeScript dependency setup; installation alone does not authorize network access. Choose your installation: vendor default or optional patched packages shows both copyable commands directly in Integrate. Use original vendor packages explains the vendor-only path without patches or aliases. Alternatively, Use both patched packages together connects the optional aliases to the same createOpenAI, model construction and generateText example. The configuration below defines the router’s models and policy, not the direct AI SDK host model; its strict-type evidence uses the patched profile, not the vendor-only path. For the connected examples, save this block as router-config.ts in your application. It exports createAppRouter and mcpServers; sibling TypeScript modules import them from ./router-config.js using Node ESM output paths. This is an application-owned file you create, not an SDK module. env and connectModel are local helpers defined below; process.env and globalThis.fetch are Node.js runtime APIs.
Each entry’s ranking: createModelRanker({ model }) uses LLM-generated relevance scores, not embeddings. It is used by filtering only when you select that alias, for example filterTools({ prompt, tools: mcpServers, context: trustedContext, model: 'general' }). The top-level model: 'general' and server/tool bindings above choose routing, not the default filter ranker. See the ranking comparison and examples for lexical, embedding, LLM and custom alternatives; they are not automatically chained. This configuration fragment fails on missing environment variables; the host must still approve its endpoints and model IDs before construction. Keep credentials server-side; use trusted, authenticated context for each request, constrain your actual tenant/resource permissions and increment the policy revision when grants change. Do not use MCP-provided metadata or model output to create server configurations or grant access. Close the router in an operation-level finally. No constructor connects or sends a model request. createBoundedModel forwards a host-supplied fetch, but the host must restrict destinations, exposure, spending and logging. The direct AI SDK generateText model is separate and not bounded by router modelAccess. See model bindings, filtering, scoped execution, and AI SDK hosting.