Skip to main content

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.

CI Python License

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 object for 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, uniqueItems or not.
  • Strict modes change the shape. OpenAI strict makes every property required, so the model sends null for "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:

  1. It produces a schema the target accepts and enforces as much as possible. For example, Gemini ignores const but enforces enum, so const: "x" becomes enum: ["x"]. Gemini also ignores exclusiveMinimum but enforces minimum, so on integers exclusiveMinimum: 0 becomes minimum: 1.
  2. 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.
  3. It maps the model's arguments back: denormalize_args() undoes the reversible rewrites, such as removing injected nulls 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

  • oneOf exclusivity, on targets that only support anyOf (reported lossy unless the branches are provably disjoint).
  • Telling "omitted" from "explicitly null" for fields that were already optional and nullable under openai-strict (reported lossy; an opt-in sentinel is planned).
  • Open maps (additionalProperties: {…}, {type: object} without properties) under strict targets (fatal).
  • Recursion on anthropic-strict beyond max_ref_depth, and recursion only through required fields (which no finite value can satisfy).
  • $dynamicRef / $recursiveRef and 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.

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

Apache-2.0. See LICENSE and NOTICE.

Metadata

Release files for mcp-schema-bridge 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-schema-bridge 0.2.0
File Size Uploaded Provenance Actions
mcp_schema_bridge-0.2.0.tar.gz 90.0 kB With provenance Details for mcp_schema_bridge-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mcp-schema-bridge 0.2.0
File Interpreter ABI Platform Actions
mcp_schema_bridge-0.2.0-py3-none-any.whl Python 3 none any Details for mcp_schema_bridge-0.2.0-py3-none-any.whl

Total release size: 169.8 kB

Release files / mcp_schema_bridge-0.2.0.tar.gz

Download URL mcp_schema_bridge-0.2.0.tar.gz
Size 90.0 kB
Tags Source
SHA-256 checksum
How to use checksums
efe5b9c60617762a5f70f62f4f67d34314329470ef3abc8fccc55addfc22765b
BLAKE2b-256 checksum
How to use checksums
3d61aaae135429d84b493a802846fe4d5e3ca957548c393370478445cabf505a
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 3, 2026.

Transparency log

Release files / mcp_schema_bridge-0.2.0-py3-none-any.whl

Download URL mcp_schema_bridge-0.2.0-py3-none-any.whl
Size 79.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7acf869c403c1cbc16d00b32ef68d3940cb585ca16e15a9024e95de2a9661ca2
BLAKE2b-256 checksum
How to use checksums
668a4220f23a830f618f8b1178acadb988a7a80aa9b141c74339a10d9be0fa73
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 3, 2026.

Transparency log

Security for mcp-schema-bridge 0.2.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.

Select from 2 files

Attestation for mcp_schema_bridge-0.2.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 3, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page