MCP Audit Tools

The MCP audit tools are a designed but not yet built set of MCP tools that would power the wiki audit skill. These tools would provide structured access to content quality metrics and validation results.

Design Status

A design spec exists at docs/superpowers/specs/2026-03-20-mcp-audit-tools-design.md. The tools would be added to the existing authoring MCP server at /mcp.

Planned Tools

Status (2026-10-13): None of these five tools was built, and the design spec was removed from the repository tree in the docs archive pass (it remains in git history). The authoring server is now /wikantik-admin-mcp, and its tool list is the exact set pinned by McpProtocolIT.EXPECTED_TOOLS, which contains no scan_*, validate_frontmatter or audit_cluster. The same jobs are done with existing tools:

Planned toolUse today
scan_broken_linksget_broken_links (wiki-wide), or the broken_links check of verify_pages
scan_missing_frontmatterthe metadata_completeness check of verify_pages (opt-in seo_readiness and retrieval_readiness add more)
scan_orphaned_pagesget_orphaned_pages
validate_frontmatterPOST /api/frontmatter/validate; the schema is also enforced at save time, and GET /admin/frontmatter-issues scans the whole corpus
audit_clusterlist_pages_by_filter for the cluster's members, then verify_pages over them; the wiki-health-check MCP prompt walks a whole-wiki version

Demand-side audits use list_retrieval_queries and list_content_opportunities. The wiki-audit skill was written against compound tools (get_cluster_map, audit_cluster, audit_cross_cluster, apply_audit_fixes) that were retired in the 2026-06-20 tool reconciliation, so until it is rewritten it drives these live tools directly.

Auditing the MCP surface itself

A separate question is how the MCP endpoints (/wikantik-admin-mcp and /knowledge-mcp) are checked for drift and misuse. Agents fail quietly when the tool surface misdescribes itself: a tool that is registered but never explained, an instructions text that still names a removed tool, or a schema that marks an optional argument as required. For adding a tool without tripping these checks see Writing a New MCP Tool; for the surface itself see MCP Integration.

What is checked, and where

Audit dimensionMechanismWhat it catches
Tool registration (admin)McpProtocolIT.listToolsReturnsAllTools compares tools/list with the exact EXPECTED_TOOLS set (29 tools)A tool added, dropped or renamed without updating the test
Schema shape (admin)McpProtocolIT.listToolsContainsCorrectSchemas: every tool has a description and an inputSchema of type object; required parameters are pinned for get_backlinks, write_pages and update_page (where content must stay optional)An argument accidentally made required or left undescribed
Registry unit checks (admin)McpToolRegistryTest: tool names are unique, every tool has a definition, at least 16 tools registerDuplicate or half-built tools
Instructions vs registry, build timeInstructionsRegistryDriftTest (wikantik-admin-mcp/src/test): every registered tool is mentioned by name in wikantik-mcp-instructions.txt, and every tool-shaped token in it is registeredInstructions teaching agents to call tools that do not exist
Instructions vs registry, wireMcpInstructionsDriftIT: the same two-way diff against the instructions text and tools/list of a deployed serverAn operator-supplied mcp.instructions.file that has drifted
Instructions vs registry, bootMcpServerInitializer.logToolNameDriftIfAny logs a WARN at startupDrift in a live deployment
Knowledge MCP gatingKnowledgeMcpToolAssemblyTest (KG tools drop out when the Knowledge Graph service is absent, the rest stay) and ToolDescriptionRoutingTest (routing guidance such as the coverage and sparql_query hints stays in the descriptions)Wiring regressions and silent description drift
Knowledge MCP over the wireKnowledgeMcpToolsIT in wikantik-it-tests/wikantik-it-test-restA tool that registers but fails against a live server
System-page protectionMcpSystemPageProtectionITA write tool that stops refusing system pages
Concurrency guardupdate_page requires expectedContentHash; on drift it returns {updated:false, error:"hash mismatch", currentHash, currentVersion, latestContent}Lost updates (optimistic locking, no write-ahead log)

The IT module runs with mcp.access.allowUnrestricted = true, so these tests do not exercise bearer-key authentication; key and scope behaviour is covered at the access-filter level and by the /tools/* integration tests.

Runtime audit trail

StatusBodyCause
403{"error":"Access denied"}No key, unknown or revoked key, and the caller IP is not in mcp.access.allowedCidrs
403{"error":"Key not authorized for MCP"}A valid key whose scope does not cover the endpoint (for example a tools key, or an mcp_read key on the admin endpoint)
429{"error":"Rate limit exceeded"} plus Retry-After: 1mcp.ratelimit.global / mcp.ratelimit.perClient exceeded
503{"error":"mcp_access_unconfigured", ...} plus Retry-After: 86400No DB-backed keys, no CIDR allowlist and mcp.access.allowUnrestricted is not set

Authentication failures are 403, not 401.

Metrics and health probes

Relationships

Cluster Hub: Wikantik Platform Development Hub: Architecture, MCP Protocols, and Agent Briefings (wikantik-development)