Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@j0hanz/superfetch

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@j0hanz/superfetch

Intelligent web content fetcher MCP server that converts HTML to clean, AI-readable Markdown

latest
Source
npmnpm
Version
2.7.1
Version published
Maintainers
1
Created
Source

SuperFetch MCP Server

SuperFetch MCP Logo

npm version License: MIT Node.js TypeScript MCP SDK

Install in VS Code Install in VS Code Insiders Install in Cursor

Fetch and convert public web content to clean Markdown both readable by humans and optimized for LLM context.

Overview

superFetch is a Model Context Protocol (MCP) server that fetches public web pages, extracts meaningful content using Mozilla's Readability algorithm, and converts the result into clean Markdown optimized for LLM context windows. It handles noise removal, caching, SSRF protection, async task execution, and supports both stdio and Streamable HTTP transports.

Key Features

  • HTML to Markdown using Mozilla Readability + node-html-markdown.
  • Raw content URL rewriting for GitHub, GitLab, Bitbucket, and Gist.
  • In-memory LRU cache exposed as MCP resources and HTTP download endpoints.
  • Stdio or Streamable HTTP transport with session management.
  • SSRF protections: blocked private IP ranges and internal hostnames.

Note: Content extraction quality varies depending on the HTML structure and complexity of the source page. SuperFetch works best with standard article and documentation layouts. Always verify the fetched content to ensure it meets your expectations, as some pages may require manual adjustment or alternative approaches.

Tech Stack

ComponentTechnology
RuntimeNode.js ≥ 24
LanguageTypeScript 5.9
MCP SDK@modelcontextprotocol/sdk ^1.26.0
Content Extraction@mozilla/readability ^0.6.0
DOM Parsinglinkedom ^0.18.12
Markdown Conversionnode-html-markdown ^2.0.0
Schema Validationzod ^4.3.6
Package Managernpm

Architecture

URL → Validate → DNS Preflight → HTTP Fetch → Decompress
  → Truncate HTML → Readability Extract → Noise Removal
  → Markdown Convert → Cleanup Pipeline → Cache → Response
  • URL Validation — Normalize, block private hosts, transform raw-content URLs (GitHub, GitLab, Bitbucket)
  • Fetch — HTTP request via undici with redirect following, DNS preflight SSRF checks, and size limits
  • Transform — Offloaded to worker threads: parse HTML with linkedom, extract with Readability, remove DOM noise, convert to Markdown
  • Cleanup — Multi-pass Markdown normalization (heading promotion, spacing, skip-link removal, TypeDoc comment stripping)
  • Cache + Respond — Store result, apply inline content limits, return structured content with optional resource links

Repository Structure

superFetch/
├── assets/
│   └── logo.svg
├── scripts/
│   ├── tasks.mjs
│   └── validate-fetch.mjs
├── src/
│   ├── workers/
│   │   ├── transform-child.ts
│   │   └── transform-worker.ts
│   ├── cache.ts
│   ├── config.ts
│   ├── crypto.ts
│   ├── dom-noise-removal.ts
│   ├── errors.ts
│   ├── fetch.ts
│   ├── host-normalization.ts
│   ├── http-native.ts
│   ├── index.ts
│   ├── instructions.md
│   ├── ip-blocklist.ts
│   ├── json.ts
│   ├── language-detection.ts
│   ├── markdown-cleanup.ts
│   ├── mcp-validator.ts
│   ├── mcp.ts
│   ├── observability.ts
│   ├── resources.ts
│   ├── server-tuning.ts
│   ├── session.ts
│   ├── tasks.ts
│   ├── timer-utils.ts
│   ├── tools.ts
│   ├── transform-types.ts
│   ├── transform.ts
│   └── type-guards.ts
├── tests/
│   └── *.test.ts
├── package.json
├── tsconfig.json
└── AGENTS.md

Requirements

  • Node.js ≥ 24

Quickstart

npx -y @j0hanz/superfetch@latest --stdio

Add to your MCP client configuration:

{
  "mcpServers": {
    "superfetch": {
      "command": "npx",
      "args": ["-y", "@j0hanz/superfetch@latest", "--stdio"]
    }
  }
}

Installation

No installation required — runs directly:

npx -y @j0hanz/superfetch@latest --stdio

Global Install

npm install -g @j0hanz/superfetch
superfetch --stdio

From Source

git clone https://github.com/j0hanz/super-fetch-mcp-server.git
cd super-fetch-mcp-server
npm install
npm run build
node dist/index.js --stdio

Configuration

Runtime Modes

FlagDescription
--stdioRun in stdio mode (for desktop MCP clients)
--helpShow usage help
--versionPrint server version

When no --stdio flag is passed, the server starts in HTTP mode (Streamable HTTP on port 3000 by default).

Environment Variables

Core Settings

VariableDefaultDescription
HOST127.0.0.1HTTP server bind address
PORT3000HTTP server port (1024–65535)
LOG_LEVELinfoLog level: debug, info, warn, error
FETCH_TIMEOUT_MS15000HTTP fetch timeout in ms (1000–60000)
CACHE_ENABLEDtrueEnable/disable in-memory content cache
USER_AGENTsuperFetch-MCP/{version}Custom User-Agent header
ALLOW_REMOTEfalseAllow remote connections in HTTP mode
ALLOWED_HOSTS(empty)Comma-separated hostnames allowed to bypass block list

Authentication (HTTP Mode)

VariableDefaultDescription
ACCESS_TOKENS(empty)Comma-separated static bearer tokens
API_KEY(empty)Single API key (added to static tokens)
OAUTH_ISSUER_URL(empty)OAuth issuer URL (enables OAuth mode)
OAUTH_AUTHORIZATION_URL(empty)OAuth authorization endpoint
OAUTH_TOKEN_URL(empty)OAuth token endpoint
OAUTH_INTROSPECTION_URL(empty)OAuth token introspection endpoint
OAUTH_REVOCATION_URL(empty)OAuth token revocation endpoint
OAUTH_REGISTRATION_URL(empty)OAuth dynamic client registration
OAUTH_REQUIRED_SCOPES(empty)Required OAuth scopes
OAUTH_CLIENT_ID(empty)OAuth client ID
OAUTH_CLIENT_SECRET(empty)OAuth client secret

Transform & Workers

VariableDefaultDescription
TRANSFORM_WORKER_MODEthreadsWorker mode: threads or process
TRANSFORM_WORKER_MAX_OLD_GENERATION_MB(unset)V8 old generation heap limit per worker
TRANSFORM_WORKER_MAX_YOUNG_GENERATION_MB(unset)V8 young generation heap limit per worker
TRANSFORM_WORKER_CODE_RANGE_MB(unset)V8 code range limit per worker
TRANSFORM_WORKER_STACK_MB(unset)Stack size limit per worker

Content Tuning

VariableDefaultDescription
SUPERFETCH_EXTRA_NOISE_TOKENS(empty)Additional CSS class/id tokens for noise removal
SUPERFETCH_EXTRA_NOISE_SELECTORS(empty)Additional CSS selectors for noise removal
MARKDOWN_HEADING_KEYWORDS(built-in list)Keywords triggering heading promotion
SUPERFETCH_LOCALE(system)Locale for content processing

Server Tuning

VariableDefaultDescription
SERVER_MAX_CONNECTIONS0 (unlimited)Maximum concurrent HTTP connections
SERVER_BLOCK_PRIVATE_CONNECTIONSfalseBlock connections from private IP ranges

Hardcoded Defaults

SettingValue
Max HTML size10 MB
Max inline content chars0 (unlimited)
Fetch timeout15 s
Transform timeout30 s
Tool timeoutFetch + Transform + 5 s padding
Max redirects5
Cache TTL86400 s (24 h)
Cache max keys100
Rate limit100 requests / 60 s
Max sessions200
Session TTL30 min
Max URL length2048 chars
Worker pool max scale4

Usage

Stdio Mode

superfetch --stdio

The server communicates via JSON-RPC over stdin/stdout. All MCP clients that support stdio transport can connect directly.

HTTP Mode

superfetch
# or
PORT=8080 HOST=0.0.0.0 ALLOW_REMOTE=true superfetch

The server starts a Streamable HTTP endpoint at /mcp. Authenticate with bearer tokens via the ACCESS_TOKENS or API_KEY environment variables.

MCP Surface

Tools

fetch-url

Fetches a webpage and converts it to clean Markdown format optimized for LLM context.

Useful for:

  • Reading documentation, blog posts, or articles
  • Extracting main content while removing navigation and ads
  • Caching content to speed up repeated queries

Limitations:

  • Does not execute complex client-side JavaScript interactions
Parameters
ParameterTypeRequiredDefaultDescription
urlstring (URL)YesThe URL of the webpage to fetch (http/https, max 2048 chars)
skipNoiseRemovalbooleanNofalsePreserve navigation, footers, and other elements normally filtered
forceRefreshbooleanNofalseBypass cache and fetch fresh content
Returns
{
  "url": "https://example.com",
  "resolvedUrl": "https://example.com",
  "inputUrl": "https://example.com",
  "title": "Example Domain",
  "markdown": "# Example Domain\n\nThis domain is for use in illustrative examples...",
  "truncated": false
}
FieldTypeDescription
urlstringThe canonical URL (pre-raw-transform)
inputUrlstringThe original URL provided by the caller
resolvedUrlstringThe normalized/transformed URL that was fetched
titlestring?Extracted page title
markdownstring?Extracted content in Markdown format
truncatedboolean?Whether inline markdown was truncated
errorstring?Error message if the request failed
statusCodenumber?HTTP status code for failed requests
detailsobject?Additional error details
Annotations
AnnotationValue
readOnlyHinttrue
destructiveHintfalse
idempotentHinttrue
openWorldHinttrue
Async Task Execution

The fetch-url tool supports optional async task execution. Include a task field in the tool call to run the fetch in the background:

{
  "method": "tools/call",
  "params": {
    "name": "fetch-url",
    "arguments": { "url": "https://example.com" },
    "task": { "ttl": 300 }
  }
}

Then poll tasks/get until the task status is completed or failed, and retrieve the result via tasks/result.

Resources

URI PatternMIME TypeDescription
internal://instructionstext/markdownServer instructions and usage guidance
internal://configapplication/jsonCurrent runtime configuration (secrets redacted)
superfetch://cache/{namespace}/{urlHash}text/markdownCached web content snapshots (subscribable)

The superfetch://cache/... resource supports subscriptions — clients receive notifications when cached content is updated.

Tasks

The server declares full MCP task support:

EndpointDescription
tasks/listList tasks (scoped to session/owner)
tasks/getGet task status by ID
tasks/resultRetrieve completed task result
tasks/cancelCancel an in-flight task

HTTP Mode Endpoints

MethodPathAuthDescription
GET/healthNoHealth check with server stats
POST/mcpYesMCP JSON-RPC (Streamable HTTP)
GET/mcpYesSSE stream for server-initiated messages
DELETE/mcpYesTerminate MCP session
GET/mcp/downloads/{namespace}/{hash}YesDownload cached content

Session Behavior

  • Sessions are created on the first POST /mcp request with an initialize message
  • Session ID is returned in the mcp-session-id response header
  • Sessions expire after 30 minutes of inactivity (max 200 concurrent)

Authentication

  • Static tokens: Set ACCESS_TOKENS or API_KEY environment variables; pass as Authorization: Bearer <token>
  • OAuth: Configure OAUTH_* environment variables to enable OAuth 2.0 token introspection

Client Configuration Examples

VS Code / VS Code Insiders

Add to your VS Code settings (.vscode/mcp.json or User Settings):

{
  "servers": {
    "superfetch": {
      "command": "npx",
      "args": ["-y", "@j0hanz/superfetch@latest", "--stdio"]
    }
  }
}
Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "superfetch": {
      "command": "npx",
      "args": ["-y", "@j0hanz/superfetch@latest", "--stdio"]
    }
  }
}
Cursor

Install in Cursor

Or manually add to Cursor MCP settings:

{
  "mcpServers": {
    "superfetch": {
      "command": "npx",
      "args": ["-y", "@j0hanz/superfetch@latest", "--stdio"]
    }
  }
}
Windsurf

Add to your Windsurf MCP configuration:

{
  "mcpServers": {
    "superfetch": {
      "command": "npx",
      "args": ["-y", "@j0hanz/superfetch@latest", "--stdio"]
    }
  }
}

Security

SSRF Protection

superFetch blocks requests to private and internal network addresses:

  • Blocked hosts: localhost, 127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16, 100.64.0.0/10
  • Blocked IPv6: ::1, fc00::/7, fe80::/10, IPv4-mapped private addresses (::ffff:10.*, etc.)
  • Cloud metadata: 169.254.169.254 (AWS), metadata.google.internal, metadata.azure.com, 100.100.100.200 (Azure IMDS)

DNS preflight checks run on every redirect hop to prevent DNS rebinding attacks.

Stdio Transport Safety

The server never writes non-protocol data to stdout. All logs and diagnostics go to stderr.

Rate Limiting

HTTP mode enforces a rate limit of 100 requests per 60-second window per client.

Content Safety

  • HTML downloads are capped at 10 MB
  • Worker threads run in isolation with configurable resource limits
  • Auth tokens are stored in-memory only and compared using timing-safe equality

Development Workflow

Install Dependencies

npm install

Scripts

ScriptCommandDescription
devnpm run devTypeScript watch mode
dev:runnpm run dev:runRun compiled output with watch + .env
buildnpm run buildClean, compile, copy assets, make executable
startnpm startRun compiled server
testnpm testRun test suite (Node.js native test runner)
test:coveragenpm run test:coverageRun tests with coverage
lintnpm run lintESLint
lint:fixnpm run lint:fixESLint with auto-fix
formatnpm run formatPrettier
type-checknpm run type-checkTypeScript type checking
inspectornpm run inspectorBuild and launch MCP Inspector

Build and Release

npm run build        # Clean → Compile → Copy Assets → chmod
npm run prepublishOnly  # Lint → Type-Check → Build
npm publish          # Publish to npm

The prepare script runs npm run build automatically on npm install from source.

Troubleshooting

MCP Inspector

Use the built-in inspector to test the server interactively:

npm run inspector

This builds the project and launches @modelcontextprotocol/inspector pointing to the compiled server.

Common Issues

IssueSolution
VALIDATION_ERROR on URLURL is blocked (private IP/localhost) or malformed. Do not retry.
queue_full errorWorker pool is saturated. Wait briefly, then retry or use async task mode.
Garbled outputBinary content (images, PDFs) cannot be converted. Ensure the URL serves HTML.
No output in stdio modeEnsure --stdio flag is passed. Without it, the server starts in HTTP mode.
Auth errors in HTTP modeSet ACCESS_TOKENS or API_KEY env var and pass as Authorization: Bearer <token>.

Stdout / Stderr Guidance

In stdio mode, stdout is reserved exclusively for MCP JSON-RPC messages. Logs and diagnostics are written to stderr. Never pipe stdout to a log file when using stdio transport.

License

MIT

Keywords

mcp

FAQs

Package last updated on 07 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts