MCP servers describe their tools with arbitrary JSON Schema. Every model API accepts a different, moving subset of it, and the failures come in three kinds:
- Rejected outright. Gemini returns
400 INVALID_ARGUMENTfor draft‑07 tuple arrays, for example. - Accepted, then silently ignored. In live probes Gemini doesn’t enforce
const,pattern,minLength,exclusiveMinimum,multipleOf,uniqueItemsornot. The schema looks fine, and the model is free to break the rules. - Shape changes in strict modes. OpenAI strict makes every property required, so the model sends
nullfor “not provided”. Your MCP server may treat that differently from a missing key.
mcp-schema-bridge rewrites each tool schema for the target you pick:
- A schema the target accepts and enforces as much as possible. Gemini ignores
constbut enforcesenum, soconst: "x"becomesenum: ["x"]. - A report of every change, each with a severity (
info,reversible,lossy,fatal) and a stable rule id. Constraints that had to be dropped are restated in the field’s description, so the model still sees them. - Arguments mapped back.
denormalize_args()undoes the reversible rewrites, such as removing injectednulls, before the call reaches the MCP server.
Every provider rule is backed by a recorded API response, a live probe or a documentation citation, with the date it was checked, and the compatibility matrix is generated from those rules.
Three ways to use it
- Building an MCP server: run
mcp-schema-bridge check --fail-on lossyin CI to find out whether your tools work in Gemini, OpenAI and Claude before your users do. - Building an agent or client: call
normalize_toolsbefore sending tools to the model anddenormalize_argsbefore calling the server. - Stuck with a server you can’t change:
mcp-schema-bridge proxysits in front of it and serves its tools already fixed for your model’s API.
What the tests guarantee
- No silent loss: every validation keyword either survives or has a report entry.
- Round trip: arguments valid for the rewritten schema are valid for the original after
denormalize_args, relaxed only where the report says so. - Deterministic: normalizing again changes nothing, and the same input gives byte‑identical output.
The Python and TypeScript packages produce byte‑identical output, checked on a shared corpus of 10 captured real‑world servers and by differential fuzzing in CI. A 100‑tool toolset normalizes in about 20 to 25 ms per target.
pip install mcp-schema-bridge
npm install mcp-schema-bridge
Try it in your browser with no install and no API key, or read the docs. Pre‑release (0.x), Apache 2.0.