Skip to main content
Glama
davinoishi

Broken Link Checker MCP Server

by davinoishi

check_site

Recursively crawl websites to identify broken links by scanning internal and external URLs across multiple pages, with options to respect robots.txt and limit concurrent requests.

Instructions

Recursively crawl and check all links across an entire website. This will scan multiple pages and check all internal and external links found. Use with caution on large sites as it may take significant time.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe starting URL of the site to check
excludeExternalLinksNoIf true, only check internal links (default: false)
honorRobotExclusionsNoIf true, respect robots.txt and meta robots tags (default: true)
maxSocketsPerHostNoMaximum concurrent requests per host (default: 1)

Implementation Reference

  • Core handler function for the 'check_site' tool. Uses SiteChecker from 'broken-link-checker' to recursively scan the site starting from the given URL, collects link check results, pages discovered, and any errors encountered.
    function checkSite(url, options = {}) {
      return new Promise((resolve, reject) => {
        const results = [];
        const errors = [];
        const pages = [];
    
        const siteChecker = new SiteChecker(options, {
          link: (result) => {
            results.push({
              url: result.url.resolved,
              base: result.base.resolved,
              html: {
                tagName: result.html.tagName,
                text: result.html.text,
              },
              broken: result.broken,
              brokenReason: result.brokenReason,
              excluded: result.excluded,
              excludedReason: result.excludedReason,
              http: {
                statusCode: result.http?.response?.statusCode,
              },
            });
          },
          page: (error, pageUrl) => {
            if (error) {
              errors.push({ pageUrl, error: error.message });
            } else {
              pages.push(pageUrl);
            }
          },
          end: () => {
            resolve({ results, errors, pages });
          },
        });
    
        siteChecker.enqueue(url);
      });
    }
  • Input schema defining the parameters for the 'check_site' tool: required 'url', optional 'excludeExternalLinks', 'honorRobotExclusions', and 'maxSocketsPerHost'.
    inputSchema: {
      type: "object",
      properties: {
        url: {
          type: "string",
          description: "The starting URL of the site to check",
        },
        excludeExternalLinks: {
          type: "boolean",
          description:
            "If true, only check internal links (default: false)",
          default: false,
        },
        honorRobotExclusions: {
          type: "boolean",
          description:
            "If true, respect robots.txt and meta robots tags (default: true)",
          default: true,
        },
        maxSocketsPerHost: {
          type: "number",
          description:
            "Maximum concurrent requests per host (default: 1)",
          default: 1,
        },
      },
      required: ["url"],
    },
  • server.js:142-174 (registration)
    Registration of the 'check_site' tool in the ListToolsRequestSchema handler, providing name, description, and input schema.
    {
      name: "check_site",
      description:
        "Recursively crawl and check all links across an entire website. This will scan multiple pages and check all internal and external links found. Use with caution on large sites as it may take significant time.",
      inputSchema: {
        type: "object",
        properties: {
          url: {
            type: "string",
            description: "The starting URL of the site to check",
          },
          excludeExternalLinks: {
            type: "boolean",
            description:
              "If true, only check internal links (default: false)",
            default: false,
          },
          honorRobotExclusions: {
            type: "boolean",
            description:
              "If true, respect robots.txt and meta robots tags (default: true)",
            default: true,
          },
          maxSocketsPerHost: {
            type: "number",
            description:
              "Maximum concurrent requests per host (default: 1)",
            default: 1,
          },
        },
        required: ["url"],
      },
    },
  • Dispatcher logic in CallToolRequestSchema handler that processes 'check_site' tool calls, prepares options, invokes checkSite, processes results into summary and broken links, and formats the MCP response.
    } else if (name === "check_site") {
      const options = {
        excludeExternalLinks: args.excludeExternalLinks || false,
        honorRobotExclusions: args.honorRobotExclusions !== false,
        maxSocketsPerHost: args.maxSocketsPerHost || 1,
      };
    
      const result = await checkSite(args.url, options);
    
      const brokenLinks = result.results.filter((link) => link.broken);
      const summary = {
        pagesScanned: result.pages.length,
        totalLinks: result.results.length,
        brokenLinks: brokenLinks.length,
        workingLinks: result.results.length - brokenLinks.length,
        errors: result.errors.length,
      };
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              {
                summary,
                brokenLinks,
                pages: result.pages,
                errors: result.errors,
              },
              null,
              2
            ),
          },
        ],
      };
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: the recursive crawling nature, scanning of multiple pages, checking of both internal and external links, and the performance warning about time consumption on large sites. This gives the agent important context about what to expect from this operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly concise and well-structured in just two sentences. The first sentence clearly states the tool's purpose and scope, while the second provides important usage guidance. Every word earns its place with no redundancy or unnecessary information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (recursive crawling operation with performance implications), no annotations, and no output schema, the description does a good job of providing essential context. It explains what the tool does, its scope, and important behavioral considerations. However, it doesn't describe what the output looks like or any error conditions, which would be helpful given the absence of an output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, so all parameters are well-documented in the schema itself. The description doesn't add any additional parameter semantics beyond what's already in the schema descriptions. The baseline score of 3 is appropriate when the schema does the heavy lifting of parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('recursively crawl and check all links') and resource ('across an entire website'). It distinguishes from the sibling tool 'check_page_links' by emphasizing it checks 'all links across an entire website' rather than just a single page.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('Use with caution on large sites as it may take significant time'), which helps the agent understand performance implications. However, it doesn't explicitly state when to use the alternative 'check_page_links' tool versus this one, nor does it provide exclusion criteria beyond the caution about large sites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/davinoishi/broken-link-checker-mcp'

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