scan
Discover MCP servers from configuration files and verify their functionality by testing tools, prompts, and resources to identify issues before deployment.
Instructions
Auto-discover MCP servers from config files and run checks against each one. Returns a summary of tools/prompts/resources status for every discovered server.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| config | No | Path to a specific MCP config file. If omitted, scans default locations. |
Implementation Reference
- src/server.ts:42-70 (handler)The "scan" tool handler, which utilizes `scanForTargets` and iterates through discovered targets to perform checks using `runTarget`.
server.tool( "scan", "Auto-discover MCP servers from config files and run checks against each one. Returns a summary of tools/prompts/resources status for every discovered server.", { config: z.string().optional().describe("Path to a specific MCP config file. If omitted, scans default locations.") }, async ({ config }) => { const targets = await scanForTargets(config); if (targets.length === 0) { return { content: [{ type: "text" as const, text: "No MCP server configs found." }] }; } const lines: string[] = [`Discovered ${targets.length} server(s):\n`]; for (const t of targets) { // Skip ourselves to avoid recursive loop. // A tool checking itself checking itself... we have to draw the line somewhere. if (t.config.targetId === "mcp-observatory") continue; lines.push(`--- ${t.config.targetId} (from ${t.source}) ---`); try { const artifact = await runTarget(t.config); lines.push(formatRun(artifact)); } catch (error) { const msg = error instanceof Error ? error.message : String(error); lines.push(` Error: ${msg}`); } lines.push(""); } return { content: [{ type: "text" as const, text: lines.join("\n") }] }; }, ); - src/server.ts:42-45 (registration)Registration of the "scan" tool with its description and input schema.
server.tool( "scan", "Auto-discover MCP servers from config files and run checks against each one. Returns a summary of tools/prompts/resources status for every discovered server.", { config: z.string().optional().describe("Path to a specific MCP config file. If omitted, scans default locations.") },