Node Fetch MCP server

Enables web content retrieval and processing with tools for fetching URLs, extracting HTML fragments, and checking site availability using Node.js's undici library.
Back to servers
Provider
Matteo Collina
Release date
Mar 09, 2025
Language
TypeScript
Package
Stats
150 downloads
10 stars

The MCP Node Fetch server enables fetching web content using the Node.js undici library. It provides tools for retrieving content from URLs, extracting HTML fragments using CSS selectors, and checking website status—all accessible to Claude through the Model Context Protocol.

Installation

To use the MCP Node Fetch server with Claude for Desktop, add the server configuration to your claude_desktop_config.json file:

{
  "mcpServers": {
    "node-fetch": {
      "command": "node",
      "args": ["dist/index.js"]
    }
  }
}

Available Tools

The server provides three main tools for interacting with web content.

Fetch URL

The fetch-url tool retrieves content from any URL and returns it in various formats.

Parameters:

  • url (string, required): The URL to fetch
  • method (string, optional): HTTP method (default: "GET")
  • headers (object, optional): HTTP headers to include
  • body (string, optional): Request body for POST/PUT requests
  • timeout (number, optional): Request timeout in milliseconds
  • responseType (string, optional): How to parse the response ("text", "json", "binary", "html-fragment")
  • fragmentSelector (string, optional): CSS selector to extract specific HTML fragments (when responseType is "html-fragment")
  • followRedirects (boolean, optional): Whether to follow redirects (default: true)

Example usage:

// Basic GET request
const response = await fetch-url({
  url: "https://example.com"
});

// POST request with JSON body
const postResponse = await fetch-url({
  url: "https://api.example.com/data",
  method: "POST",
  headers: {
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ key: "value" }),
  responseType: "json"
});

Extract HTML Fragment

The extract-html-fragment tool extracts specific content from a webpage using CSS selectors.

Parameters:

  • url (string, required): The URL to fetch
  • selector (string, required): CSS selector for the HTML fragment to extract
  • anchorId (string, optional): Optional anchor ID to locate a specific fragment
  • method (string, optional): HTTP method (default: "GET")
  • headers (object, optional): HTTP headers to include
  • body (string, optional): Request body for POST requests
  • timeout (number, optional): Request timeout in milliseconds
  • followRedirects (boolean, optional): Whether to follow redirects (default: true)

Example usage:

// Extract main content section
const mainContent = await extract-html-fragment({
  url: "https://example.com",
  selector: "main"
});

// Extract content and navigate to specific anchor
const specificSection = await extract-html-fragment({
  url: "https://example.com",
  selector: ".content-section",
  anchorId: "section-3"
});

Check Status

The check-status tool verifies if a URL is accessible without downloading the full content.

Parameters:

  • url (string, required): The URL to check
  • timeout (number, optional): Request timeout in milliseconds

Example usage:

// Check if a website is accessible
const status = await check-status({
  url: "https://example.com",
  timeout: 5000
});

Common Usage Patterns

Retrieving Website Content

const htmlContent = await fetch-url({
  url: "https://news-site.com/article/12345",
  responseType: "text"
});

Working with APIs

const apiResponse = await fetch-url({
  url: "https://api.service.com/data",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN"
  },
  responseType: "json"
});

Extracting Specific Content Elements

const articleHeadlines = await extract-html-fragment({
  url: "https://news-site.com",
  selector: "h2.headline"
});

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later