Skip to main content

Choose an integration path

Documentation for v0.0.1. Additional guides and API reference coverage are being expanded.
These integration paths are guidance, not a hosted service. Use the smallest path that meets your task. All execution paths require trusted host policy; results can be denied or uncertain.
  1. You know the exact tool and arguments. Register a local tool and call it, or obtain a current bound descriptor from discovery/filtering and call it with its expected snapshot. No inference is necessary.
  2. You need relevant tool candidates but no side effects. Filter tools. The default lexical ranker is model-free; named ranking uses an explicitly configured .ranking adapter.
  3. You want one proposed action. Scope a bounded execute to the intended target or compatible model group. The selected routing adapter proposes arguments; validation, policy and approval still gate the one possible call.
  4. Your host already uses the AI SDK. Build a governed ToolSet. The host chooses the generateText model; each emitted tool call goes through router.call with fresh trusted context. The host controls step and repeat-call budgets.
For AI SDK consumers, choose upstream dependencies or the selected public patches explicitly. The reviewed upstream pairs retain known strict-TypeScript failures; that does not prove their runtime is broken. The selected @surf-lab/mcprouter-patch-ai and @surf-lab/mcprouter-patch-openai-sdk aliases, both at version 0.0.1, supply the qualified strict-TypeScript profile. They also include bundled Undici 7.30.1 and a Zod peer floor of ^4.6.6; they are not just declaration-only updates. Both choices use @surf-lab/mcprouter/ai-sdk, the optional subpath of the one mcprouter package. There is no /openai integration export. Core-only consumers need no AI SDK peers; importing a subpath does not install them. An alias replaces the dependency behind the app’s existing ai or @ai-sdk/openai import name, so test all app usage and do not assume both upstream and patched copies are needed. For original ai and @ai-sdk/openai with no patches or aliases, Use original vendor packages, starting with the vendor-only install command. For the optional strict-TypeScript profile, Use both patched packages together. Both paths lead to the same displayed imports and createOpenAI → model → generateText example, with mcprouter’s separate toAITools; only the installed dependencies change, not the integration pattern. The common models → servers → policies configuration is optional for model-free local calls. Bindings choose routing, not the ranker used by filtering and not the AI SDK host’s model. Neither bindings nor filtering authorize effects. This SDK does not supply an implicit provider, autonomous multi-step planner, automatic specialist picker, browser runtime or hosted gateway. Do not turn needs_input, pending_approval or unknown side effects into automatic retries.