Skip to main content
Glama
emzimmer

Mozilla Readability Parser MCP Server

by emzimmer

parse

Extract webpage content into clean, LLM-optimized Markdown by removing ads, navigation, and non-essential elements. Retrieve article title, main content, excerpt, byline, and site name using Mozilla's Readability algorithm.

Instructions

Extracts and transforms webpage content into clean, LLM-optimized Markdown. Returns article title, main content, excerpt, byline and site name. Uses Mozilla's Readability algorithm to remove ads, navigation, footers and non-essential elements while preserving the core content structure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe website URL to parse

Implementation Reference

  • Core handler function that fetches the webpage, parses it using Readability, extracts main content, converts to Markdown, and returns structured article data.
    async fetchAndParse(url) {
      try {
        // Fetch the webpage
        const response = await axios.get(url, {
          headers: {
            'User-Agent': 'Mozilla/5.0 (compatible; MCPBot/1.0)'
          }
        });
    
        // Create a DOM from the HTML
        const dom = new JSDOM(response.data, { url });
        const document = dom.window.document;
    
        // Use Readability to extract main content
        const reader = new Readability(document);
        const article = reader.parse();
    
        if (!article) {
          throw new Error('Failed to parse content');
        }
    
        // Convert HTML to Markdown
        const markdown = turndownService.turndown(article.content);
    
        return {
          title: article.title,
          content: markdown,
          excerpt: article.excerpt,
          byline: article.byline,
          siteName: article.siteName
        };
      } catch (error) {
        throw new Error(`Failed to fetch or parse content: ${error.message}`);
      }
    }
  • MCP tool call handler that validates input, executes the parse tool logic via WebsiteParser, formats output as MCP content block, handles errors.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
    
      if (name !== "parse") {
        throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
      }
    
      if (!args?.url) {
        throw new McpError(ErrorCode.InvalidParams, "URL is required");
      }
    
      try {
        const result = await parser.fetchAndParse(args.url);
        
        return {
          content: [{
            type: "text",
            text: JSON.stringify({
              title: result.title,
              content: result.content,
              metadata: {
                excerpt: result.excerpt,
                byline: result.byline,
                siteName: result.siteName
              }
            }, null, 2)
          }]
        };
      } catch (error) {
        return {
          isError: true,
          content: [{
            type: "text",
            text: `Error: ${error.message}`
          }]
        };
      }
    });
  • dist/index.js:64-79 (registration)
    Registers the 'parse' tool with MCP server by defining it in the listTools response, including name, description, and input schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [{
        name: "parse",
        description: "Extracts and transforms webpage content into clean, LLM-optimized Markdown. Returns article title, main content, excerpt, byline and site name. Uses Mozilla's Readability algorithm to remove ads, navigation, footers and non-essential elements while preserving the core content structure.",
        inputSchema: {
          type: "object",
          properties: {
            url: {
              type: "string",
              description: "The website URL to parse"
            }
          },
          required: ["url"]
        }
      }]
    }));
  • Input schema for the 'parse' tool: requires a 'url' string.
    inputSchema: {
      type: "object",
      properties: {
        url: {
          type: "string",
          description: "The website URL to parse"
        }
      },
      required: ["url"]
    }
  • Helper class encapsulating the WebsiteParser with fetchAndParse method used by the tool handler.
    class WebsiteParser {
      async fetchAndParse(url) {
        try {
          // Fetch the webpage
          const response = await axios.get(url, {
            headers: {
              'User-Agent': 'Mozilla/5.0 (compatible; MCPBot/1.0)'
            }
          });
    
          // Create a DOM from the HTML
          const dom = new JSDOM(response.data, { url });
          const document = dom.window.document;
    
          // Use Readability to extract main content
          const reader = new Readability(document);
          const article = reader.parse();
    
          if (!article) {
            throw new Error('Failed to parse content');
          }
    
          // Convert HTML to Markdown
          const markdown = turndownService.turndown(article.content);
    
          return {
            title: article.title,
            content: markdown,
            excerpt: article.excerpt,
            byline: article.byline,
            siteName: article.siteName
          };
        } catch (error) {
          throw new Error(`Failed to fetch or parse content: ${error.message}`);
        }
      }
    }
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 behaviors: the transformation process ('extracts and transforms'), the algorithm used ('Mozilla's Readability algorithm'), what gets removed ('ads, navigation, footers and non-essential elements'), and what is preserved ('core content structure'). However, it doesn't mention potential limitations like rate limits, authentication needs, or error conditions.

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 appropriately sized and front-loaded, with two sentences that efficiently convey the tool's purpose, output, and key behavioral traits. Every sentence adds value without redundancy, making it easy to understand at a glance.

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 moderate complexity (single parameter, no output schema, no annotations), the description is largely complete. It explains what the tool does, how it processes content, and what it returns. However, without an output schema, it could benefit from more detail on the return structure (e.g., format of the Markdown), and it lacks information on error handling or edge cases.

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 schema description coverage is 100%, with the parameter 'url' clearly documented as 'The website URL to parse'. The description doesn't add any additional meaning or context about the parameter beyond what the schema provides, such as URL format requirements or examples. With high schema coverage, the baseline score of 3 is appropriate.

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 ('extracts and transforms') and resources ('webpage content'), specifying the output format ('clean, LLM-optimized Markdown') and what it returns ('article title, main content, excerpt, byline and site name'). It distinguishes itself by mentioning the algorithm used ('Mozilla's Readability algorithm') and what it removes ('ads, navigation, footers and non-essential elements').

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

Usage Guidelines3/5

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

The description implies usage for extracting structured content from webpages, but does not explicitly state when to use this tool versus alternatives, nor provide exclusions or prerequisites. With no sibling tools, the lack of explicit guidelines is less critical, but it still doesn't offer clear when/when-not instructions.

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

Related 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/emzimmer/server-moz-readability'

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