Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ jobs:
strict: true
report: mcpprobe-reports

- name: Check MCP tool surface with a config file
if: matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest'
uses: ./
with:
source: artifacts
from-file: samples/WeatherServer.Tests/mcp-tools.json
baseline: samples/WeatherServer.Tests/mcp-tools.json
config: samples/WeatherServer.Tests/mcpprobe.json

- name: Assert HTML reports were written
if: matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest'
shell: bash
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ All notable changes to this project are documented here. The format is based on

## [Unreleased]

### Added

- `mcpprobe.json`: a committed config file for `mcpprobe lint` (`failOn`, `strict`, `nested`, `minDescriptionLength`, `minDescriptionWords`, `rules`, and `ignore`). `lint` uses the nearest file, starting in the current directory and going up to the repository root (the first folder with a `.git`), and says `Using config <path>.` on stderr. New flags: `--config <file>` and `--no-config`. Order of precedence: defaults, then the file, then flags typed on the command line (`--nested false` and `--strict false` can turn a file setting off; `--rule` merges per rule id). Without a file nothing changes. The file is read strictly (unknown keys, wrong types and unknown rule ids exit 2), allows comments and trailing commas, and holds lint settings only, not a server to start. A repository that already has an unrelated `mcpprobe.json` will now have it read by `lint`. JSON schema: `docs/mcpprobe.schema.json`.
- `ignore` entries hide findings by rule, tool pattern and parameter pattern (`*` and `?`, case-sensitive), with an optional `reason`. Hidden findings never fail the run. The report ends with `Hidden: N ignored.` and lists entries that matched nothing (it never fails for them).
- `LintSuppression`, `LintOptions.Suppressions`, `LintReport.SuppressedFindings` and `LintReport.UnusedSuppressions`, the same thing for library users. The library does not read `mcpprobe.json`.
- GitHub Action and Azure Pipelines template input `config` (passed as `--config`). Empty by default: lint finds a committed `mcpprobe.json` on its own. It needs a CLI that has `--config`; the wrapper fails fast if the installed tool does not.

### Changed

- The Action's `fail-on` input and the template's `failOn` parameter now default to empty instead of `warning`, so `failOn` from `mcpprobe.json` is not overridden. With no config the CLI default is still `warning`, so the result is the same; the wrapper just no longer passes `--fail-on warning` when the input is empty.

## [0.4.0-preview] - 2026-11-28

### Added
Expand Down
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,36 @@ Set `LintOptions.Strict = true` (CLI: `mcpprobe lint --strict`) to also run MCPP

MCPP013-MCPP016 run by default and use `FailOn` like MCPP001-MCPP007. They are kept narrow on purpose: MCPP013 only reads explicit hints (an unset `destructiveHint` is fine) and matches whole name segments from `LintOptions.DestructiveNameTokens`; MCPP014 only fires on the phrases in `LintOptions.StructuredOutputCues`; MCPP016 walks `inputSchema` and `outputSchema` with the same paths as the `--strict` rules, and does not ask for a `type` on mixed-type enums (including ones with `null`) or on `anyOf`/`oneOf`/`allOf` branches, which usually take their type from the parent.

### Config file and ignore rules

A server with legacy debt can keep its lint settings, and the findings it has decided to accept, in a committed `mcpprobe.json`. `mcpprobe lint` reads the nearest one, starting in the current directory and going up to the repository root (the first folder with a `.git`). When it uses a file it prints `Using config <path>.` on stderr. Use `--config <file>` to pick a file (it must exist) or `--no-config` to skip the search.

```jsonc
{
"$schema": "https://raw.githubusercontent.com/ShmueLior/mcpprobe/main/docs/mcpprobe.schema.json",
"lint": {
"failOn": "warning",
"strict": false,
"nested": false,
"minDescriptionLength": 20,
"minDescriptionWords": 4,
"rules": { "MCPP007": "none", "MCPP003": "error" },
"ignore": [
{ "rule": "MCPP005", "tool": "sql_*", "reason": "Server convention: namespace_resource_verb-noun" },
{ "rule": "MCPP003", "tool": "legacy_export", "parameter": "opts" }
]
}
}
```

- `failOn`, `strict`, `nested`, `minDescriptionLength` and `rules` are the same as `--fail-on`, `--strict`, `--nested`, `--min-description-length` and `--rule`. `minDescriptionWords` has no flag. Defaults come first, then the file, then the flags you type: `--fail-on error` beats `failOn` in the file, `--nested false` turns off `"nested": true`, and `--rule MCPP007=info` changes only MCPP007.
- Each `ignore` entry hides the findings that match every field it sets: `rule` (an id), `tool` and `parameter` (patterns where `*` matches any run of characters and `?` matches one; case-sensitive), plus a free-text `reason`. Set at least a `rule` or a `tool`. `parameter` is the path the finding prints: `city`, `address.zip`, `stops[].city`, or `inputSchema.properties.city` for the `--strict` rules.
- Hidden findings never fail the run. The report says how many were hidden (`Hidden: 3 ignored.`), and lists entries that matched nothing so you can delete them (this never fails the run either). An entry for a rule that did not run, such as MCPP010 without `--strict`, is not listed as unused.
- The file is strict: JSON with comments and trailing commas, but an unknown key, a wrong type or an unknown rule id is an error (exit 2) rather than being ignored. A CLI older than the file may not know a newer key.
- It holds lint settings only. It can't name a server to start or connect to, so a checked-out repository can't make `mcpprobe` run a command. `snapshot` and `diff` don't read it.

In code, the same thing is `LintOptions.Suppressions.Add(new LintSuppression(RuleId: "MCPP005", ToolPattern: "sql_*"))`. The library does not read `mcpprobe.json`; hidden findings are in `LintReport.SuppressedFindings` and unused entries in `LintReport.UnusedSuppressions`.

## CLI in CI

Write a snapshot once and commit it, then check it in CI:
Expand Down Expand Up @@ -220,10 +250,12 @@ jobs:
baseline: mcp-tools.json
```

Inputs follow the CLI: `stdio`, `http`, or `from-file` (exactly one), plus `baseline` (default `mcp-tools.json`), `header`, `env`, `cwd`, `timeout`, `diff`, `lint`, `fail-on-non-breaking`, `fail-on`, `nested`, `rule`, `min-description-length`, `strict`, `transport`, `report`, `version`, and `source`. Both `diff` and `lint` are on by default. The Action fails the step on a breaking change or a lint finding at or above `--fail-on` (default `warning`).
Inputs follow the CLI: `stdio`, `http`, or `from-file` (exactly one), plus `baseline` (default `mcp-tools.json`), `header`, `env`, `cwd`, `timeout`, `diff`, `lint`, `fail-on-non-breaking`, `fail-on`, `nested`, `rule`, `min-description-length`, `strict`, `transport`, `report`, `config`, `version`, and `source`. Both `diff` and `lint` are on by default. The Action fails the step on a breaking change or a lint finding at or above `--fail-on` (default `warning`, or `failOn` from [`mcpprobe.json`](#config-file-and-ignore-rules) when `fail-on` is empty).

`strict`, `transport`, and `report` are off by default, so an unchanged workflow runs the same commands as before. `strict` is lint-only. `transport` is only used with `http`. `report` is a directory, not a file: the Action writes `lint.html` and/or `diff.html` there (both checks run by default, so a single file path would overwrite one report with the other). The job summary stays the plain-text report. Upload is left to your workflow.

`config` is the path of a [`mcpprobe.json`](#config-file-and-ignore-rules) for lint. Leave it empty and lint finds one on its own, starting in the step's working directory (the repository root after `actions/checkout`), so a committed `mcpprobe.json` is used without any input. `config` needs a CLI that has `--config`, the release after 0.4.0-preview; the Action fails fast with a message if the installed tool lacks it.

`strict` and `transport` also work against the 0.3.0-preview CLI. `report` needs a CLI that has `--report`, which is 0.4.0-preview or later. If you set `report` and the installed tool lacks the flag, the Action fails fast with a message instead of a generic "unrecognized option". Do not add these inputs to a workflow that pins `ShmueLior/mcpprobe@v0.3.0-preview`; that tag's wrapper does not have them.

```yaml
Expand Down Expand Up @@ -269,7 +301,7 @@ steps:
baseline: mcp-tools.json
```

The template needs bash (Git Bash on Windows). It also accepts `strict`, `transport`, and `report` (`report` is a directory, as in the Action). Do not add those parameters to a pipeline that pins `refs/tags/v0.3.0-preview`; that tag's template does not have them. Upload is a separate step; the template does not publish an artifact:
The template needs bash (Git Bash on Windows). It also accepts `strict`, `transport`, `report` (a directory, as in the Action) and `config`. Do not add those parameters to a pipeline that pins `refs/tags/v0.3.0-preview`; that tag's template does not have them. Upload is a separate step; the template does not publish an artifact:

```yaml
- task: PublishPipelineArtifact@1
Expand Down
14 changes: 12 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ inputs:
required: false
default: 'false'
fail-on:
description: Lowest lint severity that fails the job. error, warning, info, or none.
description: >-
Lowest lint severity that fails the job: error, warning, info, or none. Leave
empty to use failOn from mcpprobe.json, or warning if the file does not set it.
required: false
default: warning
default: ''
nested:
description: Also lint nested object properties and array items, not just top-level parameters.
required: false
Expand All @@ -80,6 +82,13 @@ inputs:
description: Also run schema-portability lint rules MCPP009-MCPP012 (lint only). Off by default.
required: false
default: 'false'
config:
description: >-
Path to a mcpprobe.json for lint. Leave empty to let lint find one, starting
in the working directory and going up to the repository root. Requires a CLI
that has --config.
required: false
default: ''
transport:
description: >-
Pin the HTTP transport: auto, streamable-http, or sse. Only used with http.
Expand Down Expand Up @@ -146,6 +155,7 @@ runs:
MCPPROBE_RULE: ${{ inputs.rule }}
MCPPROBE_MIN_DESCRIPTION_LENGTH: ${{ inputs.min-description-length }}
MCPPROBE_STRICT: ${{ inputs.strict }}
MCPPROBE_CONFIG: ${{ inputs.config }}
MCPPROBE_TRANSPORT: ${{ inputs.transport }}
MCPPROBE_REPORT: ${{ inputs.report }}
MCPPROBE_VERSION: ${{ inputs.version }}
Expand Down
5 changes: 5 additions & 0 deletions action/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ fi
if [[ -n "$transport" ]]; then
require_cli_flag transport --transport
fi
config_path=$(trim_ws "${MCPPROBE_CONFIG:-}")
if [[ -n "$config_path" && "$run_lint" == true ]]; then
require_cli_flag config --config
fi

if [[ -n "$report_dir" ]]; then
mkdir -p "$report_dir" || die "Could not create the report directory '$report_dir'."
Expand Down Expand Up @@ -339,6 +343,7 @@ if [[ "$run_lint" == true ]]; then
lint_args+=(--rule "$line")
done < <(each_nonempty_line "${MCPPROBE_RULE:-}")
is_true "${MCPPROBE_STRICT:-}" && lint_args+=(--strict)
[[ -n "$config_path" ]] && lint_args+=(--config "$config_path")
[[ -n "$report_dir" ]] && lint_args+=(--report "$report_dir/lint.html")
lint_exit=0
run_mcpprobe "McpProbe lint" "${lint_args[@]}" || lint_exit=$?
Expand Down
121 changes: 121 additions & 0 deletions docs/mcpprobe.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/ShmueLior/mcpprobe/main/docs/mcpprobe.schema.json",
"title": "mcpprobe.json",
"description": "Settings for 'mcpprobe lint'. Flags on the command line override this file.",
"type": "object",
"additionalProperties": false,
"properties": {
"$schema": {
"type": "string"
},
"lint": {
"description": "Settings for 'mcpprobe lint'.",
"type": "object",
"additionalProperties": false,
"properties": {
"failOn": {
"description": "Lowest severity that makes lint exit 1. Same as --fail-on. Default: warning.",
"$ref": "#/$defs/severity"
},
"strict": {
"description": "Also run the schema-portability rules MCPP009-MCPP012. Same as --strict.",
"type": "boolean"
},
"nested": {
"description": "Also check nested object properties and array items. Same as --nested.",
"type": "boolean"
},
"minDescriptionLength": {
"description": "Minimum tool description length for MCPP002. Same as --min-description-length. Default: 20.",
"type": "integer",
"minimum": 0
},
"minDescriptionWords": {
"description": "Words that exempt a short tool description from MCPP002. Default: 4. Set 0 to check length only.",
"type": "integer",
"minimum": 0
},
"rules": {
"description": "Severity per rule id, same as --rule. A flag overrides only the rule it names.",
"type": "object",
"propertyNames": {
"$ref": "#/$defs/ruleId"
},
"additionalProperties": {
"$ref": "#/$defs/severity"
}
},
"ignore": {
"description": "Findings to hide. Each entry hides the findings that match every field it sets. Hidden findings never fail the run.",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"anyOf": [
{
"required": [
"rule"
]
},
{
"required": [
"tool"
]
}
],
"properties": {
"rule": {
"description": "A rule id, for example MCPP005.",
"$ref": "#/$defs/ruleId"
},
"tool": {
"description": "Tool name pattern. * matches any run of characters, ? matches one. Case-sensitive.",
"type": "string",
"minLength": 1
},
"parameter": {
"description": "Parameter pattern, for example city, address.zip, stops[].city or inputSchema.properties.city. Same wildcards as tool.",
"type": "string",
"minLength": 1
},
"reason": {
"description": "Why the finding is accepted. Not evaluated.",
"type": "string"
}
}
}
}
}
}
},
"$defs": {
"severity": {
"enum": [
"none",
"info",
"warning",
"error"
]
},
"ruleId": {
"enum": [
"MCPP001",
"MCPP002",
"MCPP003",
"MCPP004",
"MCPP005",
"MCPP006",
"MCPP007",
"MCPP009",
"MCPP010",
"MCPP011",
"MCPP012",
"MCPP013",
"MCPP014",
"MCPP015",
"MCPP016"
]
}
}
}
8 changes: 8 additions & 0 deletions samples/WeatherServer.Tests/mcpprobe.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://raw.githubusercontent.com/ShmueLior/mcpprobe/main/docs/mcpprobe.schema.json",
"lint": {
// Lint settings for this sample. The CI workflow passes this file to the Action's "config" input.
"strict": true,
"rules": { "MCPP007": "info" }
}
}
Loading
Loading