Skip to main content
Glama

crossroute-mcp

stdio MCP server with two tools:

  • list_routes lists configured upstream routes. It does not reveal API keys.

  • complete sends a prompt to one route and, when configured, fails over to another route that serves the same model.

Routes speak either an OpenAI-compatible API (chat_completions or responses) or an Anthropic-compatible Messages API. Secrets stay in environment variables named by the config file.

Requirements

Python 3.11 or newer.

Related MCP server: freellmpool

Install

From a checkout of this repository:

pip install -e .

With uv:

uv sync

The console script is crossroute-mcp.

Configure

  1. Copy the example config and edit the placeholders:

cp config.example.json config.json
  1. Export the API keys named in the config, or copy .env.example to .env and fill it in. .env and config.json are gitignored.

export CROSSROUTE_CONFIG="$PWD/config.json"
export PROVIDER_A_API_KEY="replace-me"
export PROVIDER_B_API_KEY="replace-me"

config.example.json uses generic route names (provider-a, provider-b) and hostnames under example. Replace the base URLs and model ids with the gateways you actually use. Do not commit real keys.

Each route names its key with api_key_env. Optional api_key_env_fallbacks are extra environment variable names; empty ones are skipped. Set "enabled": false on a route object to leave it in the file without loading it. reasoning_budget_map supplies token budgets for Anthropic budget thinking. The example values are placeholders.

Environment variables:

Variable

Purpose

CROSSROUTE_CONFIG

Path to the JSON config. When unset, ./config.json is used if that file exists; otherwise ~/.config/crossroute-mcp/config.json.

CROSSROUTE_TIMEOUT_SEC

HTTP timeout in seconds. Default: 120.

PROVIDER_A_API_KEY and similar

Key values. The config names the variable; this repo never stores the value.

A minimal MCP client entry (placeholders only):

{
  "mcpServers": {
    "crossroute": {
      "command": "crossroute-mcp",
      "env": {
        "CROSSROUTE_CONFIG": "/absolute/path/to/config.json",
        "PROVIDER_A_API_KEY": "replace-me",
        "PROVIDER_B_API_KEY": "replace-me"
      }
    }
  }
}

Run

crossroute-mcp

The process speaks MCP on stdin and stdout. Startup logs go to stderr and include the config path, route count, and safety mode. Prompt and response bodies are not logged.

Tools

list_routes returns route names, protocols, default models, reasoning levels, and the cross-route failover chains. Base URLs and key values are omitted.

complete arguments:

Argument

Required

Notes

route

yes

Route name from list_routes.

prompt

yes

User text. Scanned locally before any network call.

system

no

Optional system text. Scanned the same way.

model

no

Overrides the route default. This is also the model used for cross-route matching.

reasoning_level

no

none, minimal, low, medium, high, xhigh, or max.

max_tokens

no

Falls back to the route default, then 8192.

temperature

no

Sent only when you set it. Some reasoning models reject it.

cross_route

no

Default true. Set false to stay on the named route.

If the result has suggest_local_fallback: true, the caller can finish with its own model. If safety_blocked is true, do not retry the same prompt anywhere.

Cross-route fallbacks

cross_route_fallbacks in the config is a list of failover chains. Each chain has:

  • id: a short name for the chain.

  • match_models: model ids that select this chain.

  • route_chain: ordered hops, each with a route and a model.

The intent model is the model argument when you pass one. Otherwise it is the entry route's default_model. When cross_route is true (the default) and that intent model matches a chain, a failure on the entry route is retried on the later hops in order. Hops that name an unknown or disabled route are skipped.

Same-route model_fallbacks run only on the entry route. A later hop uses the model named on that hop and does not expand that route's model_fallbacks.

Set cross_route to false to stay on the named route. The example chain example-model-failover tries provider-a first and then provider-b, both with example-model.

Safety

Before a request is sent, complete scans prompt and system for email addresses, payment card numbers, API keys and private keys, contract numbers, long pasted contracts or policy text, and unpublished financial figures.

Mode

Behavior

block

Default. Scan prompt and system, and refuse the call before any network request.

off

Skip the scan. Set "safety": {"mode": "off"} in the config.

Unknown mode values fail closed and are treated as block. A blocked call returns safety_blocked: true and suggest_local_fallback: false. The error names the category only. Error text is English and does not include the matched substring.

Tests

python -m unittest discover -s tests -v

License

MIT. See LICENSE.

The copyright line is Copyright (c) 2026 CheeInsight.

Available Tools

2 tools
completeA

Call a named upstream route to generate text. Params: route (required), prompt (required), optional system, model, reasoning_level (none|minimal|low|medium|high|xhigh|max), max_tokens, temperature (only sent if provided; some reasoning models reject it). Locally blocks prompts containing PII, secrets, contract bodies, or unpublished financial figures before any network call. Returns JSON: {ok, route, protocol, model, reasoning_level, text, usage?, error?, safety_blocked?, suggest_local_fallback?, attempted_routes?, cross_route_used?}. If ok=false and suggest_local_fallback=true (timeout, overload, empty, or upstream error), the caller can finish with its own model. safety_blocked means do NOT fall back with the same sensitive prompt. Optional cross_route (default true): when the intent model matches config cross_route_fallbacks, failed entry route retries other sites with the SAME model; set false to pin to one route.

Inputs: route (required), prompt (required), model, system, +4 more. Returns: result

list_routesA

List configured upstream routes (name, protocol, defaults). Does not expose API keys or env values. Includes safety mode summary.

Inputs: no named parameters. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 2 tools

    Disambiguation4/5

    The two tools serve clearly separate purposes: list_routes is a read-only discovery call, while complete performs the actual generation against a named route. The only friction is the bare name 'complete', which alone would be vague, but the description and the paired discovery tool make selection unambiguous.

    Naming Consistency3/5

    Both names are snake_case lowercase verbs, so the surface is readable. However, list_routes follows a verb_noun pattern while complete is a bare verb with no object, so the two names do not form a predictable pair (e.g., list_routes / call_route would be more consistent).

    Tool Count3/5

    Two tools is thin for a routing/gateway server, but the scope is deliberately narrow: discover routes, then invoke one. It sits at the borderline where the surface is defensible yet feels minimal rather than well-scoped.

    Completeness3/5

    The core lifecycle (discover routes, call a route) is covered, and the rich response envelope handles failure paths. Notable gaps remain: no per-route detail/health or availability check, no model/route status inspection, and no way to validate config despite the tool advertising fallback and safety-mode behavior.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables routing of ML tasks like chat, sentiment analysis, recommendations, and summarization to appropriate models through a dynamic YAML-based registry. Provides async FastAPI endpoints with streaming support, retry logic, and pluggable model architecture for scalable ML inference.
      4
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Pools hundreds of cataloged free-tier, keyless, and trial LLM chat routes behind a single OpenAI-compatible endpoint, so agents can send chat completions with automatic failover, provider health checks, and usage tracking. It can start answering without any API keys whenever an enabled keyless route is available.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Exposes an OpenAI-compatible gateway that pools 178 enabled free-tier and keyless chat routes across 23 providers, enabling agent clients to list models, check capacity and provider health, and route or fail over requests. It can answer without credentials when a keyless route is available.
      -