StaticAnalyzer is the main class exported by mcp-watchtower. It runs five deterministic checks against a set of MCP tool definitions — duplicate names, naming convention inconsistencies, parameter conflicts, shadow patterns, and tool count — and returns a structured report. All checks run offline with no LLM calls.
Constructor
Config options
When
true, elevates DUPLICATE_TOOL_NAME findings from warning to critical severity. Use this when your application loads multiple MCP servers into the same context simultaneously, where name collisions cause genuine routing failures.The maximum number of tools a server may declare before a
TOOL_COUNT_WARNING finding is emitted. Research shows LLM routing accuracy degrades above roughly 20 tools per server. Set this lower for more conservative thresholds.analyze()
StaticReport. The method is synchronous — there are no network calls or async operations.
Parameters
A human-readable label for the server being analyzed. This value is included verbatim in the returned
StaticReport as the server field and in finding messages. Use a stable identifier such as a package name or deployment name.An array of tool definitions from the MCP server manifest. Each entry must include at least a
name and description. See the ToolSchema type reference for the full shape.Return value
analyze() returns a StaticReport object.
The
serverName value you passed to analyze().The number of tools in the array you passed to
analyze().All findings produced by the five checks. An empty array means no issues were detected. See the
Finding type reference for the full shape and all possible code values.ISO 8601 timestamp of when the analysis completed, e.g.
"2024-11-15T09:32:00.123Z".Code examples
Platform mode
When you build an orchestrator or MCP registry that loads more than one server into a shared context, duplicate tool names across servers are a real routing hazard — not just a style concern. Passplatform: true to treat DUPLICATE_TOOL_NAME as critical.
platform: true only affects the severity of DUPLICATE_TOOL_NAME findings. All other finding codes keep their default severities regardless of this setting.