Skip to main content
Glama

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
NameRequiredDescriptionDefault
configNoPath to a specific MCP config file. If omitted, scans default locations.

Implementation Reference

  • 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.") },
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/KryptosAI/mcp-observatory'

If you have feedback or need assistance with the MCP directory API, please join our Discord server