mcp-schema-bridge
Make any MCP server's tools callable from Gemini, OpenAI and Anthropic, without silently losing meaning, and map the model's arguments back to what the MCP server expects.
Docs: https://vickyonit.github.io/mcp-schema-bridge/ · Try it in your browser (no install, no API key)
MCP servers describe tools with arbitrary JSON Schema. Every model API accepts a different, moving subset of it:
- Some schemas are rejected outright. Gemini, for example, returns
400 INVALID_ARGUMENT: schema at properties.point.items must be a boolean or an objectfor draft-07 tuple arrays. - Some keywords are accepted and then silently ignored. Our live probes show Gemini does not
enforce
const,pattern,minLength,exclusiveMinimum,multipleOf,uniqueItemsornot. - Strict modes change the shape. 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 and handles all three:
- It produces a schema the target accepts and enforces as much as possible. For example, Gemini
ignores
constbut enforcesenum, soconst: "x"becomesenum: ["x"]. Gemini also ignoresexclusiveMinimumbut enforcesminimum, so on integersexclusiveMinimum: 0becomesminimum: 1. - It emits a machine-readable 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. - It maps the model's arguments back:
denormalize_args()undoes the reversible rewrites, such as removing injectednulls or unwrapping a wrapped root, before you call 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 verified. The compatibility matrix below is generated from those rules.
Status: pre-release (
0.x). Python and TypeScript packages are available from this repository. They produce byte-identical output: same schemas, reports, key order and fingerprints, checked on the shared corpus and by differential fuzzing in CI.
Who is this for?
| You are… | Start here |
|---|---|
| An MCP server builder: "will my tools work in Gemini, OpenAI and Claude?" | mcp-schema-bridge check in CI |
| An MCP client / agent builder: "some servers' tools get 400s or are silently ignored" | normalize_tools + denormalize_args |
| An MCP user: "a server breaks my app and I can't change either" | mcp-schema-bridge proxy |
| Wondering "why not write my own 50-line normalizer?" | 7 traps of DIY normalizers |
Install
npm install mcp-schema-bridge # TypeScript / JavaScript (Node >= 22), see typescript/README.md
pip install mcp-schema-bridge # Python, zero runtime dependencies
pip install "mcp-schema-bridge[sdks]" # + payload adapters for google-genai / openai / anthropic
pip install "mcp-schema-bridge[cli]" # + `--stdio` support for the CLI (official MCP SDK)
Quickstart
from mcp_schema_bridge import denormalize_args, normalize_tools
tools = [ # as returned by an MCP server's tools/list
{
"name": "search",
"description": "Search the catalogue",
"inputSchema": {
"type": "object",
"properties": {
"query": {"type": "string", "minLength": 1},
"limit": {"type": "integer", "minimum": 1, "maximum": 50},
},
"required": ["query"],
},
}
]
result = normalize_tools(tools, "openai-strict")
search = result.tools[0]
print(search.schema["required"]) # ['query', 'limit'] (strict mode requires every key)
print(search.schema["properties"]["limit"]["type"]) # ['integer', 'null']
for entry in result.report.entries:
print(entry.severity, entry.rule, entry.source_path, entry.keyword)
# The model omitted `limit` by sending null; the MCP server gets the original shape back:
args = denormalize_args(search, {"query": "lamps", "limit": None}).args
assert args == {"query": "lamps"}
Use the result with your provider SDK (requires the [sdks] extra):
from mcp_schema_bridge import normalize_tools, to_sdk_payload
tools = [{"name": "ping", "inputSchema": {"type": "object"}}]
gemini_tools = to_sdk_payload(normalize_tools(tools, "gemini-json"), "genai") # list[types.Tool]
openai_tools = to_sdk_payload(normalize_tools(tools, "openai-strict"), "openai-responses")
claude_tools = to_sdk_payload(normalize_tools(tools, "anthropic-strict"), "anthropic-messages")
A complete loop (MCP list_tools → normalize → model → denormalize_args → call_tool) for each
provider is in examples/.
CLI
# What would change for each target? Exits 1 if anything is lossy (useful in CI).
mcp-schema-bridge check tools.json --fail-on lossy
# Check a live MCP server (the command after -- is run as an argv list, never through a shell)
mcp-schema-bridge check --target gemini-json --target openai-strict \
--stdio -- npx -y @modelcontextprotocol/server-filesystem /tmp
# Print normalized tools + reports as JSON
mcp-schema-bridge normalize tools.json --target anthropic-strict > normalized.json
# Put a proxy in front of any MCP server: its tools are served fixed for your model's API
mcp-schema-bridge proxy --target gemini-json -- npx -y some-mcp-server
Input can be a single schema, an array of tools, or a tools/list result (from a file or - for
stdin). Exit codes: 0 ok · 1 --fail-on threshold reached · 2 usage error · 3 input, server
or timeout error.
Targets
| Target | Use it for |
|---|---|
gemini-json |
Gemini FunctionDeclaration.parametersJsonSchema (google-genai parameters_json_schema) |
openai |
OpenAI function tools with strict: false |
openai-strict |
OpenAI function tools with strict: true (Structured Outputs) |
anthropic |
Claude tools (input_schema) |
anthropic-strict |
Claude tools with strict: true |
Strict targets also enforce per-request budgets (normalize_tools). With strict_fallback=True, a tool
that cannot be made strict is demoted to the non-strict sibling target instead of being rejected.
The report
Every change is a ReportEntry:
{
"rule": "openai-strict/optional-to-nullable", "tid": "T11a", "tool": "search",
"source_path": "/properties/limit", "target_path": "/properties/limit", "instance_path": "/limit",
"keyword": "type", "action": "rewritten", "severity": "reversible",
"original": "integer", "hinted": false, "message": "optional property 'limit' made required and nullable; ..."
}
| Severity | Meaning |
|---|---|
info |
No change in what is accepted (e.g. $schema removed, allOf merged exactly). |
reversible |
The model's contract changed, and denormalize_args restores the original exactly. |
lossy |
A constraint or distinction is no longer enforced by the target (restated as a hint where possible). |
fatal |
The tool cannot be expressed for this target; it is rejected (or demoted with strict_fallback). |
--fail-on lossy is the recommended CI threshold. The report's JSON Schema is
spec/report.schema.json, and the hint format is
spec/hint-format.md.
Guarantees (tested)
The test suite checks every property below against generated schemas, 10 captured real-world servers and 24 per-transformation cases:
- No silent loss. Every validation keyword of the input either survives unchanged on a traced output node or has a report entry.
- Round-trip. Any arguments valid for the normalized schema, after
denormalize_args, are valid for the original schema, relaxed only where the report says something was lost. - Idempotent and deterministic. Normalizing the output again changes nothing, and identical input always gives byte-identical output.
- Allow-list. The output only uses keywords and formats the target's rules allow.
Performance
Normalizing a 100-tool toolset (built from the captured corpus) takes about 20–25 ms per target on an
Apple Silicon laptop (scripts/benchmark.py, p50; p99 within 2 ms). Output is deterministic, so cache
NormalizedTools (they serialize with to_dict()/from_dict()) and re-normalize only when a server's
tools/list changes. See docs/framework-authors.md.
What we can't fix
oneOfexclusivity, on targets that only supportanyOf(reportedlossyunless the branches are provably disjoint).- Telling "omitted" from "explicitly null" for fields that were already optional and nullable under
openai-strict(reportedlossy; an opt-in sentinel is planned). - Open maps (
additionalProperties: {…},{type: object}without properties) under strict targets (fatal). - Recursion on
anthropic-strictbeyondmax_ref_depth, and recursion only through required fields (which no finite value can satisfy). $dynamicRef/$recursiveRefand remote$refs (never fetched).- Tool and property names a target forbids (rejected in v0.1; renaming is planned for v0.2).
Compatibility matrix
Generated from rules/*.json (rules_version 2026.11.26) by scripts/gen_matrix.py.
| Target | API field | Strict | Evidence | Verified on |
|---|---|---|---|---|
gemini-json |
parametersJsonSchema |
no | 1 assumed, 3 doc, 7 probe, 3 recorded | 2026-11-26 |
openai |
parameters |
no | 2 doc, 3 reported | 2026-11-26 |
openai-strict |
parameters |
yes | 2 assumed, 5 doc, 1 probe, 3 recorded, 2 reported | 2026-11-26 |
anthropic |
input_schema |
no | 2 doc, 2 reported | 2026-11-26 |
anthropic-strict |
input_schema |
yes | 9 doc, 1 reported | 2026-11-26 |
| Keyword | gemini-json |
openai |
openai-strict |
anthropic |
anthropic-strict |
|---|---|---|---|---|---|
type |
✅ | ☑️ | ✅ | ☑️ | ✅ |
enum |
✅ | ☑️ | ✅ | ☑️ | ✅ |
const |
🔁 | ☑️ | 🔁 | ☑️ | ✅ |
anyOf |
✅ | ☑️ | ✅ | ☑️ | ✅ |
oneOf |
🔁 | ☑️ | 🔁 | ☑️ | 🔁 |
allOf |
🔁 | ☑️ | 🔁 | ☑️ | 🔁 |
not |
⚠️ | ☑️ | ❌ | ☑️ | ❌ |
$ref |
✅ | ☑️ | ✅ | ☑️ | ✅ |
pattern |
⚠️ | ☑️ | ✅ | ☑️ | ✅ |
format |
☑️ | ☑️ | ✅ | ☑️ | ✅ |
minLength |
⚠️ | ☑️ | – | ☑️ | ❌ |
maxLength |
⚠️ | ☑️ | – | ☑️ | ❌ |
minimum |
✅ | ☑️ | ✅ | ☑️ | ❌ |
maximum |
✅ | ☑️ | ✅ | ☑️ | ❌ |
exclusiveMinimum |
⚠️ | ☑️ | ✅ | ☑️ | ❌ |
multipleOf |
⚠️ | ☑️ | ✅ | ☑️ | ❌ |
minItems |
✅ | ☑️ | ✅ | ☑️ | ✅ |
maxItems |
✅ | ☑️ | ✅ | ☑️ | ❌ |
uniqueItems |
⚠️ | ☑️ | – | ☑️ | ❌ |
prefixItems |
☑️ | ☑️ | – | ☑️ | – |
default |
☑️ | ☑️ | – | ☑️ | ☑️ |
✅ enforced on generated arguments · ☑️ accepted (kept; enforcement not guaranteed) · 🔁 rewritten to a supported form (oneOf→anyOf, allOf merged, const→enum) · ⚠️ accepted but silently ignored (removed and restated as a description hint) · ❌ rejected by the API (rewritten or removed with a hint) · – not supported (removed with a hint)
How each cell was established, with links, models and dates, is in rules/. Gemini rows
come from live probes (evidence/) and recorded verdicts (corpus/verdicts/).
OpenAI and Anthropic rows currently cite documentation or community reports. See
docs/live-verification.md.
Related projects
Other libraries also convert tool schemas between providers, including
tool-schema, mcpschema,
@mastra/schema-compat and the provider SDKs' own
strict-mode helpers. mcp-schema-bridge focuses on the report, the argument round-trip and
evidence-backed rules. See docs/adr/0001-why-this-exists.md.
Contributing
See CONTRIBUTING.md. The project uses strict TDD, atomic Conventional Commits and the DCO. Security reports: SECURITY.md.
License
Metadata
Release files for mcp-schema-bridge 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcp_schema_bridge-0.1.0.tar.gz | 90.0 kB | With provenance | Details for mcp_schema_bridge-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcp_schema_bridge-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for mcp_schema_bridge-0.1.0-py3-none-any.whl |
Total release size: 169.8 kB
Release files / mcp_schema_bridge-0.1.0.tar.gz
| Download URL | mcp_schema_bridge-0.1.0.tar.gz |
|---|---|
| Size | 90.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
beadc4e7e62d54ed3aa741d0ff108204d3643dc37c226b2d98b053f1a429dc5b
|
|
BLAKE2b-256 checksum How to use checksums |
c38c4392958cd0c4ffca7f915312e1943d17579226521dfba7a828e1a5474184
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / mcp_schema_bridge-0.1.0-py3-none-any.whl
| Download URL | mcp_schema_bridge-0.1.0-py3-none-any.whl |
|---|---|
| Size | 79.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ae480cddcc67abadb113cb1e008b9faa6d3b186050145fa89083d66360f1454a
|
|
BLAKE2b-256 checksum How to use checksums |
d8ffd81315860277eeaaf056533db7a578f730b77e904fa17e9a6a3ccc811c3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logSecurity for mcp-schema-bridge 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mcp_schema_bridge-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.