ToolGate Schema MCP sunucusu
Commit 10 Kas 2026Validates MCP tool-call arguments against a JSON Schema to reject malformed requests before they reach the backend.
Ayrıca bilinen adı mcpg-dev/mcpg-plugin-tool-gate-schema
- Yıldızlar
- 0
- Araçlar
- 7
- İndirmeler, 30 gün
- —
- En son sürüm
- —
- Son commit
- 10 Kas 2026
- Lisans
- Apache-2.0
ToolGate Schema MCP nedir?
ToolGate Schema bir MCP sunucusudur. Validates MCP tool-call arguments against a JSON Schema to reject malformed requests before they reach the backend. 7 araç sunar; örneğin schema, pointer, max_errors.
Özet, projenin README dosyasından oluşturuldu
ToolGate Schema MCP sunucusu hakkında
Rejecting malformed tool-call arguments before they reach your backend is the primary function of this MCP server. It acts as a pre-dispatch gate that validates incoming requests against an operator-supplied JSON Schema. By using this plugin, developers can enforce stricter contracts than the standard input schema requires, ensuring that only conforming calls proceed to the actual tool logic.
Setup involves adding the plugin to a top-level plugins list in your configuration. The schema is compiled once during the loading process, making per-call validation a pure CPU task with no network access or fresh allocations. It supports local in-document $ref resolution but does not fetch remote references. You can customize the rejection behavior by specifying a custom JSON-RPC error code, an HTTP status like 400, or a fixed deny_message to prevent leaking sensitive schema details to callers.
This tool is designed for security-conscious environments where a typo in a contract must not result in a silent failure. If the schema fails to compile or contains unknown keys, the gateway will refuse to boot entirely. It also allows for scoped validation using an RFC 6901 JSON Pointer to target specific sub-values within the arguments object.
Neler yapabilirsiniz
- 1Enforce strict argument constraintsVerify that tool arguments meet specific requirements like minimum string lengths or maximum integer values before processing.
- 2Prevent sensitive schema leakageHide internal field names or regulated identifiers from callers by replacing detailed error messages with a fixed string.
- 3Limit error response sizeRestrict the number of validation errors reported in a single response to prevent large payloads from inflating error messages.
- 4Validate specific argument sub-sectionsDirect the validator to check only a specific part of the tool arguments using a JSON Pointer.
Projenin README dosyasından alınmıştır. Her kullanım durumu, oradaki bir alıntı ile kontrol edilir.
ToolGate Schema MCP araçları 7
README dosyasından algılandıschemapointermax_errorscodehttp_statusdeny_messagemcpg-plugin-transform-json-schema
| schema | — | |
| pointer | — | |
| max_errors | — | |
| code | — | |
| http_status | — | |
| deny_message | — | |
| mcpg-plugin-transform-json-schema | — |
JSON Schema Contract Gate — dev.mcpg.tool-gate.schema
class
tool_gate·native· packagemcpg-plugin-tool-gate-schema· artifactlibmcpg_plugin_tool_gate_schema.so· Apache-2.0
A pre-dispatch tool gate that validates MCP tool-call arguments against an
operator-supplied inline JSON Schema and rejects malformed calls with a precise
4xx — JSON-RPC -32602 Invalid params over HTTP 400 by default — before the
call ever reaches a backend. The schema is compiled once when the plugin loads,
so per-call validation is pure CPU with no allocation of a fresh validator and
no network access at all. Reach for it when a tool's contract is stricter than
its advertised input_schema and you want the violation refused at the security
gate, with a status code you choose, rather than surfaced as a backend error.
What it does
- Validates the tool-call arguments against an inline JSON Schema on every pre-dispatch evaluation; a conforming call is allowed unchanged.
- Compiles the schema once at load. A schema that does not compile, or a config object with an unknown key, refuses to instantiate — the gateway fails to boot rather than running with an unenforced contract.
- Resolves in-document
$ref(#/$defs/Foo) locally and never fetches a remote$ref; the validator is built without HTTP resolution, so the gate has no outbound dependency and declares no required capabilities. - Scopes validation to a sub-value of the arguments through an optional RFC 6901 JSON Pointer; a pointer that does not resolve is itself a denial.
- Reports up to
max_errorsfailing instance paths in the deny message and appends a truncation marker beyond that, so a pathological payload cannot inflate the error response. - Suppresses all schema detail when
deny_messageis set, for contracts whose shape is itself sensitive. - Allows unconditionally post-dispatch — this is a contract gate on the way in, not a result inspector.
Configuration
Loaded from the flat top-level plugins: list. Gates evaluate in plugins:
array order, so place this entry ahead of anything that should only see
well-formed arguments.
plugins:
- id: dev.mcpg.tool-gate.schema
class: tool_gate
source:
oci: ghcr.io/mcpg-dev/plugins/tool-gate-schema
config:
schema:
type: object
required: ["query"]
properties:
query: { type: string, minLength: 1 }
limit: { type: integer, maximum: 100 }
max_errors: 8
| Field | Type | Default | Description |
|---|---|---|---|
schema |
object (JSON Schema) | (required) | The schema arguments must satisfy. In-document $ref only. |
pointer |
string (JSON Pointer) | (whole arguments object) | Validate only the arguments sub-value at this RFC 6901 pointer. |
max_errors |
integer | 32 |
Cap on validation errors listed in the deny message. |
code |
integer | -32602 |
JSON-RPC error code carried by the deny. |
http_status |
integer | 400 |
HTTP status carried by the deny. |
deny_message |
string | (detailed message) | Fixed deny text. When set, no schema error detail reaches the caller. |
Unknown fields are rejected.
Against the example above, arguments of {"limit": 250} are denied with HTTP
400 / -32602 and a message naming both the missing query and the
out-of-range /limit.
Security
The plugin is a fail-closed control on both edges. Bad operator input — invalid
config JSON, an unknown config key, or a schema the validator rejects — aborts
instantiation instead of degrading to allow-everything, so a typo in the
contract cannot silently disable it. On the request edge, anything the schema
does not accept is denied, including a pointer whose target is absent.
The default deny message echoes the failing instance paths, which is useful for
callers you trust and an information leak for callers you do not. Set
deny_message to a fixed string when the schema encodes internal field names,
regulated identifiers, or any other detail the caller should not learn.
Build
Default feature set is OFF (avoids mcpg_plugin_register linker
collisions in the workspace build); opt in to the cdylib:
cargo build -p mcpg-plugin-tool-gate-schema --features cdylib-export --release # → target/release/libmcpg_plugin_tool_gate_schema.so
Sign & load (production)
Sign the artifact, pin/verify via the entry's signature: block, and honour
revocations. See https://mcpg.dev/docs/security/plugin-security.
See also
- Plugin classes and the plugin ABI: https://mcpg.dev/docs/plugins/plugins-and-protocol
- Full gateway config schema: https://mcpg.dev/docs/reference/configuration
mcpg-plugin-transform-json-schema— the same validator as a transform: an invalid value becomes a transform error in the pipeline instead of a gate denial with a chosen status code.
ToolGate Schema MCP soruları
ToolGate Schema MCP hangi araçları sunar?
7 araç sunar; bunlar arasında schema, pointer, max_errors, code, http_status yer alır.
How does the plugin handle invalid configurations?
The gateway fails to boot rather than running with an unenforced contract if a schema does not compile or contains unknown keys.
Can the plugin fetch remote JSON Schema references?
No, it only resolves in-document $ref locally and does not fetch remote references to ensure no outbound dependencies.
How can I prevent leaking schema details in error messages?
You can set the deny_message field to a fixed string, which suppresses all schema detail in the response.
What happens if a JSON Pointer is provided but does not resolve?
If a pointer is used to scope validation and it does not resolve, the call is denied.