Skip to content

Lint resource templates and icons (MCPP025-MCPP028) - #33

Merged
ShmueLior merged 5 commits into
mainfrom
feat/resource-lint
Dec 4, 2026
Merged

ShmueLior merged 5 commits into
mainfrom
feat/resource-lint

Conversation

@ShmueLior

Copy link
Copy Markdown
Owner

Lint resource templates and icons (MCPP025-MCPP028), add --resources

Stacked on #32; review after it merges. Based on feat/prompt-lint so this PR is only the resource-lint commits.

When the server declares the resources capability, lint checks resource templates. Resources from resources/list are checked only with --resources (config lint.resources), because file-style servers can list hundreds of them.

Id Default Checks
MCPP025 warning A resource template (or listed resource) has a description.
MCPP026 error Resource uri is an absolute URI with a scheme, template uriTemplate is non-empty with a scheme before the first {, and prompt names, URIs and uriTemplates aren't listed twice.
MCPP027 warning A resource template (or listed resource) has a name.
MCPP028 warning Icons: src is http:, https: or data:; mimeType looks like type/subtype; sizes are WxH or any; theme is light or dark. Nothing is fetched.
  • New LintListedContracts bag (prompts, resource templates, resources, protocol tools) and ToolLinter.Lint(surface, contracts, options).
  • MCPP028 checks tools, prompts and templates from a live server. --from-file does not run it, because that path lints the snapshot's tools only. After PR A lands, a follow-up could also read snapshot icons.
  • The C# SDK lists a resource with a fixed URI (like the sample weather://cities) in resources/list, not resources/templates/list. So it is only linted with --resources. Noted in the README.
  • Rooted paths like /docs/a.txt, and Windows paths like C:\a.txt, count as invalid resource URIs (Uri.TryCreate can treat them as file URIs; the parsed scheme must also be a prefix of the original text).
  • Baseline files write "kind": "resourceTemplate".

Tests: full suite 1552 passed on net8.0 and net10.0, Release, 0 warnings. Rebuilt on updated B after PR #30 (F14), including B's non-nullable Lint(surface, prompts) overload. Resource and resource-template findings use the same optional JSON kind field as B.

Conflicts while rebuilding onto B+main were resolved by keeping both sides: CHANGELOG (resource-lint bullet first, including the F14 optional finding kind sentence, then F14/F15/F16); CliApp (F14 --format/--sarif and WriteOutputAsync, plus --resources capture and contracts is null ? Lint(surface, options) : Lint(surface, contracts, options)); Host and ServerOptions (FromFilePath plus listed contracts). Listed-kinds hunks in ToolLinter were re-checked and kept (prompts, resource templates, and resources when --resources is set). The lint SARIF golden gained rules MCPP025-MCPP028; lint JSON was unchanged.

Likely remaining conflicts:

…) bound to options

A path such as C:\a.txt matches a scheme-prefix regex as C: and can parse as a file URI on Windows. The parsed scheme must now also be a prefix of the original text. Lint overloads for prompts and listed contracts are non-nullable so Lint(surface, null) still means options. Docs now say MCPP028 does not run on --from-file, which stays true after snapshots gain icons.
@ShmueLior
ShmueLior changed the base branch from feat/prompt-lint to main December 4, 2026 08:25
@ShmueLior
ShmueLior merged commit 771f5dd into main Dec 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant