Back to skill

Security audit

MCP Token Auditor

Security checks for vulnerabilities and agentic risk

Overview

This skill is a local MCP configuration audit tool with disclosed, purpose-aligned behavior, though its marketing overstates config-generation features it does not actually implement.

Install only if you are comfortable letting the script read the MCP config file you point it at. Review the output before sharing it, because server names, tool names, paths, and configuration structure may reveal private development setup details. Do not expect it to create ready-to-use role-specific MCP config files; it only produces suggested groupings and a report.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (11)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Most of the implementation matches the declared analysis purpose: it parses an MCP config, estimates token usage, identifies large tools, computes per-role groupings, and suggests optimizations. However, the description materially overstates one core capability: generating optimized role-specific MCP configs. The script only emits a report or JSON analysis and can write that report to a file via --output; it never constructs or writes actual derived MCP config files for each role. This is a meaningful description-behavior mismatch because config generation is presented as part of the primary functionality.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 90)May include surrounding context.

md
- `SKILL.md` — This file

MCP Config Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill accesses MCP server configuration files (mcp.json). MCP configs contain server URLs, authentication tokens, and tool definitions — reading them allows the skill to discover and potentially abuse other tool integrations.

Content

Scanner excerpt · scripts/mcp-token-audit.py (reported line 8)May include surrounding context.

python
Usage:
  python3 mcp-token-audit.py [--config PATH] [--output PATH] [--max-tokens N]

Reads Claude Code's mcp.json (or any MCP config), estimates token cost per tool
based on schema complexity, and outputs an optimization report with per-role groupings.

Flags:

MCP Config Access

High
Category
Agent Snooping
Confidence
95% confidence
Finding

Skill accesses MCP server configuration files (mcp.json). MCP configs contain server URLs, authentication tokens, and tool definitions — reading them allows the skill to discover and potentially abuse other tool integrations.

Content

Scanner excerpt · SKILL.md (reported line 31)May include surrounding context.

md
based on schema complexity, and outputs an optimization report with per-role groupings.

Flags:
  --config PATH    Path to MCP config JSON (default: ~/.claude/mcp.json)
  --output PATH    Write report to file (default: stdout)
  --max-tokens N   Target max tokens per agent role (default: 60000)
  --json           Output as JSON instead of human-readable

MCP Config Access

High
Category
Agent Snooping
Confidence
95% confidence
Finding

Skill accesses MCP server configuration files (mcp.json). MCP configs contain server URLs, authentication tokens, and tool definitions — reading them allows the skill to discover and potentially abuse other tool integrations.

Content

Scanner excerpt · SKILL.md (reported line 46)May include surrounding context.

md
based on schema complexity, and outputs an optimization report with per-role groupings.

Flags:
  --config PATH    Path to MCP config JSON (default: ~/.claude/mcp.json)
  --output PATH    Write report to file (default: stdout)
  --max-tokens N   Target max tokens per agent role (default: 60000)
  --json           Output as JSON instead of human-readable

MCP Config Access

High
Category
Agent Snooping
Confidence
95% confidence
Finding

Skill accesses MCP server configuration files (mcp.json). MCP configs contain server URLs, authentication tokens, and tool definitions — reading them allows the skill to discover and potentially abuse other tool integrations.

Content

Scanner excerpt · scripts/mcp-token-audit.py (reported line 12)May include surrounding context.

python
based on schema complexity, and outputs an optimization report with per-role groupings.

Flags:
  --config PATH    Path to MCP config JSON (default: ~/.claude/mcp.json)
  --output PATH    Write report to file (default: stdout)
  --max-tokens N   Target max tokens per agent role (default: 60000)
  --json           Output as JSON instead of human-readable

MCP Config Access

High
Category
Agent Snooping
Confidence
95% confidence
Finding

Skill accesses MCP server configuration files (mcp.json). MCP configs contain server URLs, authentication tokens, and tool definitions — reading them allows the skill to discover and potentially abuse other tool integrations.

Content

Scanner excerpt · scripts/mcp-token-audit.py (reported line 313)May include surrounding context.

python
based on schema complexity, and outputs an optimization report with per-role groupings.

Flags:
  --config PATH    Path to MCP config JSON (default: ~/.claude/mcp.json)
  --output PATH    Write report to file (default: stdout)
  --max-tokens N   Target max tokens per agent role (default: 60000)
  --json           Output as JSON instead of human-readable

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
73% confidence
Finding

The skill advertises behavior that can generate role-specific MCP configs, which implies file creation/modification capability, but it declares no explicit tool scope or permission boundaries. In a skill context, missing scope declarations increase the chance that an agent may read or write local files more broadly than users expect, especially around sensitive developer configuration like MCP settings.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest description says the skill will 'generate optimized role-specific MCP configs,' and the module docstring similarly frames the tool as producing optimization outputs. In code, the only file-writing behavior is writing the textual/JSON report to --output (L326-L329); the returned 'role_groupings' merely contain suggested config_name values (L241-L248) and no actual config generation occurs.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · scripts/mcp-token-audit.py (reported line 13)May include surrounding context.

python
Flags:
  --config PATH    Path to MCP config JSON (default: ~/.claude/mcp.json)
  --output PATH    Write report to file (default: stdout)
  --max-tokens N   Target max tokens per agent role (default: 60000)
  --json           Output as JSON instead of human-readable
"""

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The inline user-facing text at L305 instructs the user to 'use --output to save per-role configs,' which directly contradicts the implementation. The --output flag only writes the generated report string to disk (L326-L329) and never emits any role-specific MCP config files.

Content

No source excerpt is available for this finding.