From 0833e1ca650924470486b54a10895ce9306db58d Mon Sep 17 00:00:00 2001 From: Florian BRUNIAUX Date: Mon, 12 Jan 2026 08:37:01 +0100 Subject: [PATCH] fix(audit): correct MCP detection to check ~/.claude.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The audit script was looking for MCP config in ~/.claude/mcp.json which doesn't exist. Claude Code actually stores MCP config in ~/.claude.json under projects..mcpServers. Changes: - audit-scan.sh: Multi-source MCP detection (3 locations with priority) - audit-scan.sh: Fixed count_pattern() bug causing "0\n0" output - claude-setup-audit-prompt.md: Updated bash commands for MCP detection - Version bump: 2.8 → 2.9 Co-Authored-By: Claude Opus 4.5 --- CHANGELOG.md | 33 +++++++++++++ README.md | 2 +- claude-setup-audit-prompt.md | 47 ++++++++++++++----- examples/scripts/audit-scan.sh | 86 ++++++++++++++++++++++++++++------ 4 files changed, 141 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09feca0..e828d92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,39 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +## [2.9.0] - 2026-01-12 + +### Fixed +- **MCP detection bug in audit-scan.sh** (~60 lines modified) + - **Root cause**: Script searched for `~/.claude/mcp.json` which doesn't exist + - **Actual location**: Claude Code stores MCP config in `~/.claude.json` under `projects..mcpServers` + - **Solution**: Multi-source detection with priority: + 1. `~/.claude.json` → `projects..mcpServers` (most common) + 2. `./.claude/mcp.json` (project-level) + 3. `~/.claude/mcp.json` (legacy global) + - JSON output now includes detailed `mcp` section (configured, count, servers, source) + - Human output shows server count and source location +- **Bug `0\n0` in `claude_md_refs`** (~8 lines) + - **Root cause**: `grep -c ... || echo "0"` could produce double output + - **Solution**: Rewritten `count_pattern()` function to properly capture and return count + +### Changed +- **audit-scan.sh** enhanced (~50 lines) + - Added `MCP_SOURCE` variable to track where MCP config was found + - Added `MCP_COUNT` variable for server count + - Global `mcp.json` message changed from error to info (not required) + - JSON output restructured with separate `mcp` object +- **claude-setup-audit-prompt.md** updated (~40 lines) + - Phase 1.1: Now checks `~/.claude.json` instead of `~/.claude/mcp.json` + - Phase 1.2: Complete MCP detection rewrite covering all 3 locations + - Glossary: Updated MCP definition to explain config locations + - Version: 2.8 → 2.9 + +### Stats +- 2 files modified (audit-scan.sh, claude-setup-audit-prompt.md) +- Bug impact: Scripts now correctly detect MCP servers (was showing "No MCP" even when configured) +- Tested: Verified on Méthode Aristote project with 9 MCP servers + ## [2.8.0] - 2026-01-11 ### Added diff --git a/README.md b/README.md index 8c53ed0..fea2234 100644 --- a/README.md +++ b/README.md @@ -315,7 +315,7 @@ If this guide saved you time, helped you master Claude Code, or inspired your wo --- -*Version 2.8 | January 2026 | Crafted with Claude* +*Version 2.9 | January 2026 | Crafted with Claude*