SkillSpector icon indicating copy to clipboard operation
SkillSpector copied to clipboard

AS2 flags a plugin's own bundled .mcp.json, and prose describing it, as MCP Config Access (HIGH)

Open forrestsatterfield opened this issue 5 days ago • 1 comments

Summary

AS2 (MCP Config Access, HIGH, confidence 0.8 to 0.9) fires when a Claude Code plugin documents or validates its own bundled .mcp.json. The project-scoped .mcp.json is how a plugin declares its MCP server, so docs and CI checks that mention it are routine. In a published plugin I scanned, AS2 produced 6 of the 10 HIGH findings, and none of them read the host's or user's MCP configuration.

Environment

  • SkillSpector v2.13.7 (same version as main at 636e4293)
  • skillspector scan <dir> --no-llm --format json (static only)
  • Windows 11

Reproduction

as2/.mcp.json:

{
  "mcpServers": { "example": { "type": "http", "url": "https://example.com/mcp" } }
}

as2/SKILL.md:

---
name: as2
description: Minimal reproducer.
---

# Layout

| File | Role |
| --- | --- |
| `.mcp.json` | The single declaration of the MCP endpoint |

The check fails with `.mcp.json: endpoint is <url>; the pinned endpoint is https://example.com/mcp`.

Some hosts list MCP tools by name only until the model loads their definitions.

as2/scripts/check.mjs (a CI check that the endpoint is still pinned):

import { readFileSync } from "node:fs";
const mcp = JSON.parse(readFileSync(".mcp.json", "utf8"));
if (mcp.mcpServers?.example?.url !== "https://example.com/mcp") {
  console.error(".mcp.json: endpoint is not pinned");
  process.exit(1);
}
score 38 MEDIUM CAUTION
  AS2 HIGH 0.9 SKILL.md:10         | 'mcp.json` | The single declaration of the MCP endpoint'
  AS2 HIGH 0.9 SKILL.md:12         | 'mcp.json: endpoint'
  AS2 HIGH 0.9 scripts/check.mjs:4 | 'mcp.json: endpoint'
  AS2 HIGH 0.8 SKILL.md:14         | 'list MCP tools'

The readFileSync(".mcp.json") on line 2 of check.mjs is not flagged. The finding is on the error-message string on line 4.

Cause

In static_patterns_agent_snooping.py:

  1. (r"mcp(?:_config)?\.json.*?(?:api_?key|token|secret|url|endpoint)", 0.9) is a proximity match. It fires whenever the words "endpoint" or "url" appear after mcp.json on the same line, in prose, table cells and string literals alike. In the plugin I scanned it also caught Object.values(JSON.parse(read(".mcp.json")).mcpServers)[0].url, a script reading the plugin's own file by relative path.
  2. (?:list|enumerate|discover)\s+(?:all\s+)?(?:available\s+)?mcp\s+(?:servers?|tools?|services?) matches a sentence that describes host behaviour ("Some hosts list MCP tools by name only…") rather than one telling the agent to do it.

Expected

  • A relative .mcp.json that resolves to a component inside the scan root is the skill's own declaration, not snooping, and should not emit AS2 (or should drop to LOW/informational). Host-scope paths such as ~/.claude.json, ~/.claude/mcp.json and claude_desktop_config.json should still fire.
  • The proximity pattern needs an access verb or call (open, read, cat, readFileSync, …), not just "endpoint" or "url" somewhere later on the line.

Not the same as #1147 (LP/TP analyzers not evaluating .mcp.json).

forrestsatterfield avatar Nov 29 '26 08:11 forrestsatterfield

I can take this one. The AS2 proximity match and the list-MCP-tools pattern both fire on a plugin documenting or validating its own bundled .mcp.json, which is routine. I will reproduce on current main, scope the fix so scan-local .mcp.json references and descriptive prose no longer emit AS2 while host-scope config paths still fire, add regression tests, and open a PR.

Varshith-Kali avatar Nov 29 '26 21:11 Varshith-Kali