Skip to main content

bellwether contract

Validate MCP servers against contract definitions.

Synopsis

bellwether contract validate <server-command...>
bellwether contract generate <server-command...>
bellwether contract show [path]

Description

The contract command lets you capture an explicit contract file and validate your server against it. This is useful when you want a strict, versioned spec beyond baseline drift detection.

Config Required

contract requires a config file. Run bellwether init once in your project.

Subcommands

validate

Validate an MCP server against a contract file.

bellwether contract validate <server-command...>
OptionDescriptionDefault
-c, --config <path>Path to config filebellwether.yaml
--contract <path>Path to contract filecontract.path or default filenames
--mode <mode>Validation mode: strict, lenient, reportcontract.mode
--fail-on-violationExit with error if violations are foundcontract.failOnViolation
--format <format>Output format: text, json, markdowncontract.format
--timeout <ms>Server startup timeout in millisecondscontract.timeout

generate

Generate a contract file from the current server state.

bellwether contract generate <server-command...>
OptionDescriptionDefault
-c, --config <path>Path to config filebellwether.yaml
-o, --output <path>Output path for contract filecontract.path or default filename
--timeout <ms>Server startup timeout in millisecondscontract.timeout
-f, --forceOverwrite existing contract filefalse

show

Display contract file contents.

bellwether contract show [path]
OptionDescriptionDefault
[path]Path to contract filecontract.path or default filenames
-c, --config <path>Path to config filebellwether.yaml
--jsonOutput as JSON instead of YAMLfalse

Default Contract Filenames

If no explicit contract path is provided, Bellwether looks for:

  • contract.bellwether.yaml
  • contract.bellwether.yml
  • .bellwether-contract.yaml
  • .bellwether-contract.yml

Examples

# Generate a contract
bellwether contract generate npx @mcp/your-server

# Validate using that contract
bellwether contract validate npx @mcp/your-server

# Show contract contents
bellwether contract show

See Also

  • check - Drift detection and schema validation
  • baselines - Baseline-based comparisons