audit-mcp
Audit MCP server configurations for quality, compliance, and security. Use to validate .mcp.json files and server setups.
What this skill does
# Audit MCP Command
Audit MCP server configurations for quality, compliance, and security.
## Step 0: Initialize Audit Environment
Get the current UTC date, capture the project root path, ensure the temp directory exists, and clean up any stale audit files if the user confirms. Invoke the `claude-ecosystem:mcp-integration` skill to load authoritative MCP configuration guidance.
## What Gets Audited
This command audits MCP server configurations from multiple sources:
- **Project scope**: `.mcp.json` in project root (version-controlled, team-shared)
- **User (Global) scope**: `~/.claude.json` with root-level `mcpServers` key
- **Local scope**: `.claude/settings.local.json` with `mcpServers` key if present
- **Plugin scope**: `.mcp.json` files within plugin directories
- **Enterprise scope**: `managed-mcp.json` in system directories
For each configuration, validate JSON structure, server fields, transport types, authentication, environment variable usage, and security (no exposed credentials).
## Command Arguments
- **No arguments**: Audit all discoverable MCP configurations
- **project**: Audit only `.mcp.json` in project root
- **user**: Audit user-level config (`~/.claude.json`)
- **all**: Audit all MCP configs (project + user + plugins)
- **--force**: Audit regardless of modification status
- **--skip-validation**: Skip finding validation (faster, but may include false positives)
## Step 1: CLI-First Discovery (MANDATORY)
**ALWAYS start by running `claude mcp list`** to get the authoritative list of configured MCP servers. This provides ground truth from the running system and prevents missing configurations stored in unexpected locations.
```bash
# Get authoritative list with scope information
claude mcp list
# Get details on specific server if needed
claude mcp get <server-name>
```
**Why CLI First:**
- File locations can change between Claude Code versions
- User config is in `~/.claude.json` (NOT `~/.claude/.mcp.json` - this path does not exist)
- The `mcpServers` key may be deep in the file (line 200+) and easy to miss with partial reads
- CLI output shows scope, connection status, and transport type
## Step 2: Verify Configuration Files
After CLI discovery, verify the configuration files exist and can be read. For large files like `~/.claude.json`, use grep to find the `mcpServers` key position before reading.
**Configuration locations (per official docs):**
| Scope | Location |
| --- | --- |
| Project | `.mcp.json` (project root) |
| User (Global) | `~/.claude.json` (root-level `mcpServers` key) |
| Local | `.claude/settings.local.json` (`mcpServers` key) |
| Plugin | `plugins/*/.mcp.json` |
| Enterprise | `managed-mcp.json` (system paths) |
Build a list of discovered configurations with scope, path, and server count.
## Step 3: Parse Arguments and Filter
Parse the scope selector and `--force` flag. Filter discovered configurations to match the requested scope.
## Step 4: Present Audit Plan
Display audit mode (SMART or FORCE), configurations discovered, and list each file with scope and server count.
## Step 5: Execute Audits
For each configuration, invoke the `mcp-auditor` subagent with scope, path, config type, and last audit date. Run audits in parallel when multiple configurations exist.
## Step 5.5: Validate Findings
**Unless `--skip-validation` flag is present:**
1. Spawn the `audit-finding-validator` agent with:
- `project_root`: The captured project root path
- `audit_type`: "mcp"
- `audit_files`: List of `.claude/temp/audit-*-mcp-*.json` file paths
2. Wait for validation to complete
3. Read updated JSON files with validation results
4. Filter out FALSE_POSITIVE findings completely before aggregation
5. Note: Filtered findings are logged to `.claude/temp/audit-filtered-findings.json`
**If `--skip-validation` flag is present:**
- Skip validation phase entirely (current speed preserved)
- Present all findings without filtering
- Note in summary: "Validation: Skipped"
## Step 6: Final Summary
Report total configurations audited, server count, results by scope, and a details table. List security alerts and configuration issues with remediation steps.
**Include validation statistics (if validation was performed):**
- Validation performed: Yes/No
- Findings validated: X
- False positives filtered: Y
- Verified findings: Z
- Unverified findings: W
## Important Notes
### Security Considerations
MCP configurations must NEVER contain hardcoded API keys, tokens, or passwords in version-controlled files. Use environment variable expansion (`${API_KEY}`) for sensitive values.
**Credential severity by location:**
| Location | Hardcoded Credentials | Severity |
| --- | --- | --- |
| `.mcp.json` (project, version-controlled) | CRITICAL FAILURE | Keys exposed in git |
| `~/.claude.json` (user, NOT version-controlled) | WARNING | Acceptable for personal use |
### Transport Types
Valid types: `stdio` (local processes), `http` (recommended for remote), `sse` (deprecated).
### Cross-Platform Paths
| Platform | User Config Location |
| --- | --- |
| Unix | `~/.claude.json` |
| Windows | `%USERPROFILE%\.claude.json` |
## Audit Log Location
All audit results are written to `.claude/audit/mcp.md`.
Use `/audit-log mcp` to view current audit status.
## Example Usage
### Example 1: Audit All MCP Configurations
```text
User: /audit-mcp
Claude: Running CLI discovery first...
$ claude mcp list
perplexity: cmd /c npx -y perplexity-mcp - Connected (User scope)
firecrawl: cmd /c npx -y firecrawl-mcp - Connected (User scope)
...
## Audit Plan
**Mode**: SMART
**MCP servers discovered via CLI**: 5
**Configuration file**: ~/.claude.json
### Servers to Audit:
1. [user] perplexity - stdio
2. [user] firecrawl - stdio
3. [user] context7 - stdio
4. [user] microsoft-learn - http
5. [user] ref - http
[Spawns mcp-auditor subagent]
## MCP Audit Complete
**Total servers**: 5
**Scope**: User (Global)
| Server | Transport | Security | Result |
| --- | --- | --- | --- |
| perplexity | stdio | WARNING: Hardcoded API key | 85/100 |
| firecrawl | stdio | WARNING: Hardcoded API key | 85/100 |
| context7 | stdio | PASS | 95/100 |
| microsoft-learn | http | PASS | 95/100 |
| ref | http | WARNING: API key in URL | 85/100 |
```
### Example 2: Audit Project MCP Only
```text
User: /audit-mcp project
Claude: Checking for project .mcp.json...
[Audits .mcp.json in project root if exists]
```
### Example 3: Audit with Force
```text
User: /audit-mcp --force
Claude: Running full MCP audit (force mode)...
[Audits all configs regardless of modification status]
```
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.