8-9 October

Chancery Pavilion Hotel, Bengaluru

Apidays India 2025

8-9 October

Chancery Pavilion Hotel, Bengaluru

Exposed: MCP Servers Are Lying About Their Schemas

By Yogesh Nikam

Share this page

Table of Contents

Practical Lessons from MCP Server Testing

Over the last few weeks the Specmatic team ran a focused series of MCP server testing experiments against several remote MCP servers — notably Postman’s, Hugging Face’s, and GitHub’s MCP servers. The goal was straightforward: use Specmatic’s MCP Auto-Test to find places where the declared schemas differ from how the servers actually behave, and surface real, actionable problems that break integrations or cause consumer-facing failures.

In this write-up I’ll walk you through what we discovered, why these mismatches matter, and how to fix them. If you care about building reliable APIs, especially in the era of LLMs and automated agents, the insights below are directly applicable to your work.

JSON report overview for Hugging Face MCP test run

Why we ran these tests (and why you should care)

MCP server testing helped us confirm something many teams suspect but rarely catch early: schema-implementation drift is real, common, and costly. When schemas omit strict constraints or accidentally mark fields optional, automated consumers — including testing tools, CI pipelines, and LLM-based agents — will make assumptions. Those assumptions often lead to bad requests, confusing errors, and unpredictable behavior.

Specmatic’s MCP Auto-Test automatically generates and runs inputs against an MCP server based on its declared schema. That allowed us to detect mismatches without manually hand-crafting hundreds of test cases. The results were eye-opening.

Key Takeaways

  • Schema-Implementation Drift is Real: Servers sometimes treat fields as required while schemas mark them optional (or vice versa).
  • Use Standard JSON Schema Constraints: Descriptions are not a substitute for explicit minimum/maximum or oneOf/anyOf operators.
  • Vague Specs Lead to Hallucinations: Leaving rules to natural language descriptions invites automated tools or LLMs to produce invalid values.
  • Automated MCP Server Testing Catches Issues Early: Run MCP Auto-Test during development to surface these problems before clients rely on the API.
Empty request being sent; missing required prompt argument

Hugging Face MCP: When “optional” isn’t optional

One of the clearer failures we found was with a tool where the server returned an error: “no value provided for the required argument prompt.” Looking at the request sent by Specmatic, we saw an empty request body — none of the arguments were provided.

At first glance, that suggests Specmatic failed to pass the prompt. But the root cause was different. The tool schema declared all properties (including prompt) as optional — there was no “required” array in the JSON schema. That implies any property could be left out, so Specmatic generated a request without any fields. The implementation, however, treated prompt as mandatory. The result: schema says optional, server expects required.

This kind of schema-implementation drift is precisely what MCP server testing is designed to reveal. If a server treats a field as required, the schema must reflect that by including it in the “required” array. Otherwise consumers will either produce invalid requests or need custom, brittle workarounds.

Tool schema showing missing 'required' field for prompt

Why this matters

Clients — human or automated — rely on the schema to know which fields to send. If the schema is wrong, integrations fail. For LLM-based agents that build requests from schema clues, incorrect optionality can produce empty or malformed requests that crash or behave unpredictably. Always keep the schema authoritative.

Non-standard constraints: numbers and the danger of relying on descriptions

Another issue we ran into with the same tool was numeric bounds. The server rejected a request with num_inference_steps of 705, saying “value 705 is greater than the maximum value 16.” But when we inspected the declared schema, the field was typed as a number with a description: “numeric value between 1 and 16.”

Here’s the problem: the schema used a human-readable description to state constraints, instead of using the standard JSON Schema keywords minimum and maximum. Specmatic’s auto-test — and any other strict JSON Schema consumer — has no way to derive numeric bounds from a free-text description, so it generated values outside the intended range.

Error showing value 705 greater than maximum 16

Fix: use standard schema keywords

Define constraints using JSON Schema fields such as minimum, maximum, exclusiveMinimum, exclusiveMaximum, pattern for strings, enum for finite sets, and oneOf/anyOf/oneOf for mutually exclusive options. Relying on descriptions is convenient for humans, but it is invisible to automated consumers and testing tools.

Field schema demonstrating description but no minimum/maximum constraints

Postman MCP: When mutually exclusive fields are not declared

At Postman’s MCP server we hit subtly different issues that point to the same root cause: missing or underspecified schema operators. One tool, updateSpecFile, rejected requests with the error “only one of content_type or name should be provided.” The requests sent by Specmatic included three keys — content, type, name — but the server code enforced that only one of those keys be present at a time.

The schema defined these properties and even marked some as required, but it did not express the mutual exclusivity between name, content, and type. In JSON Schema terms, the schema should use an operator like oneOf or anyOf to declare that only one of the group may appear. Without that, Specmatic assumed any combination could be present and generated requests that the server then rejected.

Request showing all three keys being sent to update spec file tool

How to model mutually exclusive fields

When designing APIs, call out exclusive options explicitly. Use oneOf to list acceptable schemas where only one of them can match, or use dependencies and conditional subschemas in JSON Schema to model more complex rules. This clarity prevents both human developers and automated tools from making invalid requests.

Input schema for update spec file tool missing oneOf operator

Postman MCP: numeric limit without bounds

We also saw a getCollections endpoint where the server rejected limit values above 100. Specmatic had generated a request with limit=408 and received the response: “Value must be a positive integer smaller than 100.” The schema only declared that limit is an integer and included a human-oriented description, but it omitted maximum: 100.

Again, the lack of explicit constraints in the schema caused an automated consumer to generate invalid inputs. The fix is consistent: codify the expectations using JSON Schema constraints, not descriptions.

Error showing limit parameter must be smaller than 100

Why this pattern keeps happening

Teams often document constraints in descriptions because it’s quick and readable. But time and again, that choice makes the schema unreliable for machines. Modern API ecosystems include automated testing, contract verification, SDK generation, and even LLM-driven clients — all of which depend on machine-readable constraints.

Get collections input schema showing type integer but no maximum constraint

Practical recommendations

  1. Treat the schema as the single source of truth: if behavior changes, update the schema first, then implementation. The converse leads to drift.
  2. Use JSON Schema keywords: minimum, maximum, pattern, enum, oneOf/anyOf/required. Avoid relying on free-text descriptions to communicate machine-level constraints.
  3. Run MCP server testing early and often: integrate Specmatic’s MCP Auto-Test into CI to detect drift before consumers depend on the API.
  4. Model mutually exclusive fields explicitly: use oneOf or dependent schemas to express exclusivity rather than assuming clients will “figure it out.”
  5. Assume automated consumers: LLMs and other automated agents will make requests strictly from the schema. Make that schema robust.

How MCP server testing helps teams

Specmatic’s MCP Auto-Test automates the generation and execution of requests based on a server’s declared MCP schema. It exposes mismatches between what the schema promises and what the implementation enforces. That means you can:

  • Catch required-field mismatches (schema says optional, implementation requires it).
  • Detect missing numeric or string constraints that cause invalid values.
  • Find logic-based rules like mutually exclusive fields that are not represented in the schema.
  • Prevent downstream hallucinations from LLM-based clients that build requests mechanically.

Automated MCP server testing reduces guesswork and surfaces discrepancies that would otherwise be discovered by frustrated integrators or production bug reports.

Conclusion

MCP server testing revealed a simple truth: your schema is the contract you make with the world. If that contract is vague or inconsistent with the implementation, every automated consumer — tests, SDK generators, and LLMs — will eventually break in surprising ways. Use standard JSON Schema constructs to make constraints machine-readable, declare required fields, and model mutually exclusive properties explicitly.

Run Specmatic’s MCP Auto-Test (or similar contract-based tests) as part of your development lifecycle to catch schema-implementation drift early. It’s a small investment with outsized returns in reliability, developer experience, and trust.

Specmatic MCP Auto-Test summary and benefits

FAQ — MCP server testing

What is MCP server testing?

MCP server testing is the practice of running automated tests against a Machine Consumable Protocol (MCP) server using its declared schema to generate request payloads and validate responses. Tools like Specmatic’s MCP Auto-Test generate inputs from the schema and check whether the server’s behavior matches the declared contract.

Why did Specmatic send invalid values during tests?

Specmatic generates inputs strictly from the schema. If the schema lacks explicit constraints (for example, maximum/minimum for numbers, or oneOf for mutually exclusive fields), Specmatic has no machine-readable guidance and may generate values outside the intended range. That’s why using standard JSON Schema keywords is essential.

How do I prevent schema-implementation drift?

Make sure the schema is the authoritative source of truth. Update the schema whenever API behavior changes, add machine-readable constraints (minimum, maximum, enum, oneOf), and run MCP server testing in CI to catch drift before it affects clients.

Can LLMs be trusted to follow schema descriptions?

No. Relying on natural language descriptions to convey constraints invites hallucinations. LLMs and other automated agents typically follow machine-readable schema fields. Always encode constraints using JSON Schema keywords to ensure deterministic behavior.

How often should I run MCP server testing?

Run it automatically on every schema or implementation change — for example, in pull request checks and nightly CI runs. The cost of running the tests is small compared to the cost of tracking down integration issues caused by schema drift.

What are the most common schema mistakes we found?

  • Missing required arrays for fields that implementations treat as mandatory.
  • Using descriptions to state numeric limits instead of minimum/maximum.
  • Not modeling mutually exclusive fields with oneOf/anyOf.
  • Lack of enums for finite sets that should be strictly enforced.

If you’re responsible for an MCP server or consume one, make schema quality a first-class concern. MCP server testing is a fast, scalable way to ensure your contract matches reality and to keep integrations working smoothly.

Related Posts

specmatic genie mcp

By Jaydeep Kulkarni

Curate, Validate and Publish an MCP Server from an OpenAPI Spec with Specmatic Genie

In this walk-through we'll show exactly how we took the Postman APIs, curated the set of API end points we want to expose via MCP,
Read More
specmaticmcpdemo linkedin mcp

By Hari Krishnan

Specmatic MCP as guardrails for Coding Agents: API Spec to Full Stack implementation in minutes

Table of Contents In this walkthrough we'll show how to use Specmatic MCP server for API testing (Contract and Resiliency) and Mocking as a guardrail
Read More
arazzo openapi asyncapi demo with specmatic

By Hari Krishnan

Authoring & Leveraging Arazzo Spec for OpenAPI & AsyncAPI Workflow Testing

Seamlessly test both synchronous and asynchronous APIs in realistic workflows before they ever hit production! Discover how combining OpenAPI and AsyncAPI specs can simplify complex
Read More
Arazzo API workflow demo

By Hari Krishnan

Visual Workflow Mocking and Testing with Specmatic and Arazzo API Specifications

Table of Contents API workflow testing with Arazzo and Specmatic: Visual authoring, workflow mocking, and backend verification Here we'll walk through a practical approach to
Read More
Specmatic vs Microcks comparison

By Hari Krishnan

Specmatic vs Microcks

When evaluating tools for API testing and mocking, the choice often comes down to understanding not just what each tool can do, but how their
Read More
jaydeep aws lambda

By Jaydeep Kulkarni

AWS Lambda Data Pipeline Testing using LocalStack with Specmatic

Table of Contents Mastering Testing AWS Lambda Functions with LocalStack and Specmatic With fast-evolving data ecosystems, building reliable and scalable data products is essential. One
Read More
api days revised 1920x1080

By John

New features and a BIG Announcement! Specmatic is bringing apidays to India!

In the past few months, we have launched a flurry of exciting features, presented at several global conferences and onboarded several new team members. We
Read More
Speakers presenting on API Governance at tech conference.

Update: See how Specmatic is transforming API testing & development

We've been hard at work, rolling out exciting new features and sharing the power of Specmatic and Contract Driven Development around the globe! Let's explore
Read More

By Joel Rosario

Build Apps from API specs using AI: Self-Correcting Contract-Driven Agentic Workflows with Specmatic

Harnessing the Power of API Specifications for Robust Microservices  Modern microservice architecture hinges on precise and dependable communication between services. This is where API specifications
Read More

OpenAPI Examples Simplified: Visualize and Generate Domain-Specific Test Data​

Streamlining API Development: An Interactive Guide to Example Generation and Validation using Specmatic  A robust, streamlined approach to API development is crucial for maintaining efficiency,
Read More