Skip to main content
Glama
skrapeai

Skrape MCP Server

Official
by skrapeai

get_markdown

Extract clean markdown content from webpages for language model processing, with JavaScript rendering and JSON output options.

Instructions

Get markdown content from a webpage using skrape.ai

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL of the webpage to scrape
returnJsonNoWhether to return JSON response (true) or raw markdown (false)
optionsNoAdditional scraping options

Implementation Reference

  • The main handler for the 'get_markdown' tool. It destructures arguments, validates the URL, calls the Skrape.ai API via axios, handles the response as markdown or JSON, and manages errors.
    case "get_markdown": {
      const { url, returnJson = false, options = { renderJs: true } } = request.params.arguments || {};
    
      if (!url || typeof url !== "string") {
        throw new McpError(ErrorCode.InvalidParams, "URL is required and must be a string");
      }
    
      try {
        const response = await axios.post(
          "https://skrape.ai/api/markdown",
          { url, options },
          {
            headers: {
              "Authorization": `Bearer ${API_KEY}`,
              "Content-Type": returnJson ? "application/json" : "text/markdown"
            }
          }
        );
    
        return {
          content: [{
            type: "text",
            text: returnJson ? JSON.stringify(response.data, null, 2) : response.data
          }]
        };
      } catch (error) {
        if (axios.isAxiosError(error)) {
          throw new McpError(
            ErrorCode.InternalError,
            `Skrape API error: ${error.response?.data?.message || error.message}`
          );
        }
        throw error;
      }
    }
  • Input schema for the 'get_markdown' tool defining the expected parameters: url (required), returnJson, and options with renderJs.
    inputSchema: {
      type: "object",
      properties: {
        url: {
          type: "string",
          description: "URL of the webpage to scrape"
        },
        returnJson: {
          type: "boolean",
          description: "Whether to return JSON response (true) or raw markdown (false)",
          default: false
        },
        options: {
          type: "object",
          description: "Additional scraping options",
          properties: {
            renderJs: {
              type: "boolean",
              description: "Whether to render the JavaScript content of the website",
              default: true
            }
          },
          default: { renderJs: true }
        }
      },
      required: ["url"]
    }
  • src/index.ts:33-63 (registration)
    Registration of the 'get_markdown' tool in the ListTools handler response, providing name, description, and schema.
    {
      name: "get_markdown",
      description: "Get markdown content from a webpage using skrape.ai",
      inputSchema: {
        type: "object",
        properties: {
          url: {
            type: "string",
            description: "URL of the webpage to scrape"
          },
          returnJson: {
            type: "boolean",
            description: "Whether to return JSON response (true) or raw markdown (false)",
            default: false
          },
          options: {
            type: "object",
            description: "Additional scraping options",
            properties: {
              renderJs: {
                type: "boolean",
                description: "Whether to render the JavaScript content of the website",
                default: true
              }
            },
            default: { renderJs: true }
          }
        },
        required: ["url"]
      }
    }
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/skrapeai/skrape-mcp'

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