nathanonn mcp url fetcher

nathanonn mcp url fetcher avatar

by nathanonn

What is nathanonn mcp url fetcher

MCP URL Format Converter

A Model Context Protocol (MCP) server that fetches content from any URL and converts it to your desired output format.

Overview

MCP URL Format Converter provides tools for retrieving content from any web URL and transforming it into various formats (HTML, JSON, Markdown, or plain text), regardless of the original content type. It's designed to work with any MCP-compatible client, including Claude for Desktop, enabling LLMs to access, transform, and analyze web content in a consistent format.

Features

  • 🔄 Format Conversion: Transform any web content to HTML, JSON, Markdown, or plain text
  • 🌐 Universal Input Support: Handle websites, APIs, raw files, and more
  • 🔍 Automatic Content Detection: Intelligently identifies source format
  • 🧰 Robust Library Support: Uses industry-standard libraries:
    • Cheerio for HTML parsing
    • Marked for Markdown processing
    • Fast-XML-Parser for XML handling
    • CSVtoJSON for CSV conversion
    • SanitizeHTML for security
    • Turndown for HTML-to-Markdown conversion
  • 🔧 Advanced Format Processing:
    • HTML parsing with metadata extraction
    • JSON pretty-printing and structure preservation
    • Markdown rendering with styling
    • CSV-to-table conversion
    • XML-to-JSON transformation
  • 📜 History Tracking: Maintains logs of recently fetched URLs
  • 🛡️ Security Focus: Content sanitization to prevent XSS attacks

Installation

Prerequisites

  • Node.js 16.x or higher
  • npm or yarn

Quick Start

  1. Clone the repository:

    git clone https://github.com/yourusername/mcp-url-converter.git
    cd mcp-url-converter
    
  2. Install dependencies:

    npm install
    
  3. Build the project:

    npm run build
    
  4. Run the server:

    npm start
    

Integration with Claude for Desktop

  1. Open your Claude for Desktop configuration file:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  2. Add the URL converter server to your configuration:

    {
      "mcpServers": {
        "url-converter": {
          "command": "node",
          "args": ["/absolute/path/to/mcp-url-converter/build/index.js"]
        }
      }
    }
    
  3. Restart Claude for Desktop

Available Tools

fetch

Fetches content from any URL and automatically detects the best output format.

Parameters:

  • url (string, required): The URL to fetch content from
  • format (string, optional): Format to convert to (auto, html, json, markdown, text). Default: auto

Example:

Can you fetch https://example.com and choose the best format to display it?

fetch-json

Fetches content from any URL and converts it to JSON format.

Parameters:

  • url (string, required): The URL to fetch content from
  • prettyPrint (boolean, optional): Whether to pretty-print the JSON. Default: true

Example:

Can you fetch https://example.com and convert it to JSON format?

fetch-html

Fetches content from any URL and converts it to HTML format.

Parameters:

  • url (string, required): The URL to fetch content from
  • extractText (boolean, optional): Whether to extract text content only. Default: false

Example:

Can you fetch https://api.example.com/users and convert it to HTML?

fetch-markdown

Fetches content from any URL and converts it to Markdown format.

Parameters:

  • url (string, required): The URL to fetch content from

Example:

Can you fetch https://example.com and convert it to Markdown?

fetch-text

Fetches content from any URL and converts it to plain text format.

Parameters:

  • url (string, required): The URL to fetch content from

Example:

Can you fetch https://example.com and convert it to plain text?

web-search and deep-research

These tools provide interfaces to Perplexity search capabilities (when supported by the MCP host).

Available Resources

recent-urls://list

Returns a list of recently fetched URLs with timestamps and output formats.

Example:

What URLs have I fetched recently?

Security

This server implements several security measures:

  • HTML sanitization using sanitize-html to prevent XSS attacks
  • Content validation before processing
  • Error handling and safe defaults
  • Input parameter validation with Zod
  • Safe output encoding

Testing

You can test the server using the MCP Inspector:

npm run test

Troubleshooting

Common Issues

  1. Connection errors: Verify that the URL is accessible and correctly formatted
  2. Conversion errors: Some complex content may not convert cleanly between formats
  3. Cross-origin issues: Some websites may block requests from unknown sources

Debug Mode

For additional debugging information, set the DEBUG environment variable:

DEBUG=mcp:* npm start

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Built with the Model Context Protocol
  • Uses modern, actively maintained libraries with security focus
  • Sanitization approach based on OWASP recommendations

Last updated: 29 March 2025

Leave a Comment

Frequently Asked Questions

What is MCP?

MCP (Model Context Protocol) is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications, providing a standardized way to connect AI models to different data sources and tools.

What are MCP Servers?

MCP Servers are lightweight programs that expose specific capabilities through the standardized Model Context Protocol. They act as bridges between LLMs like Claude and various data sources or services, allowing secure access to files, databases, APIs, and other resources.

How do MCP Servers work?

MCP Servers follow a client-server architecture where a host application (like Claude Desktop) connects to multiple servers. Each server provides specific functionality through standardized endpoints and protocols, enabling Claude to access data and perform actions through the standardized protocol.

Are MCP Servers secure?

Yes, MCP Servers are designed with security in mind. They run locally with explicit configuration and permissions, require user approval for actions, and include built-in security features to prevent unauthorized access and ensure data privacy.

Related MCP Servers

chrisdoc hevy mcp avatar

chrisdoc hevy mcp

mcp
sylphlab pdf reader mcp avatar

sylphlab pdf reader mcp

An MCP server built with Node.js/TypeScript that allows AI agents to securely read PDF files (local or URL) and extract text, metadata, or page counts. Uses pdf-parse.

pdf-parsetypescriptnodejs
aashari mcp server atlassian bitbucket avatar

aashari mcp server atlassian bitbucket

Node.js/TypeScript MCP server for Atlassian Bitbucket. Enables AI systems (LLMs) to interact with workspaces, repositories, and pull requests via tools (list, get, comment, search). Connects AI directly to version control workflows through the standard MCP interface.

atlassianrepositorymcp
aashari mcp server atlassian confluence avatar

aashari mcp server atlassian confluence

Node.js/TypeScript MCP server for Atlassian Confluence. Provides tools enabling AI systems (LLMs) to list/get spaces & pages (content formatted as Markdown) and search via CQL. Connects AI seamlessly to Confluence knowledge bases using the standard MCP interface.

atlassianmcpconfluence
prisma prisma avatar

prisma prisma

Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB

cockroachdbgomcp
Zzzccs123 mcp sentry avatar

Zzzccs123 mcp sentry

mcp sentry for typescript sdk

mcptypescript
zhuzhoulin dify mcp server avatar

zhuzhoulin dify mcp server

mcp
zhongmingyuan mcp my mac avatar

zhongmingyuan mcp my mac

mcp
zhixiaoqiang desktop image manager mcp avatar

zhixiaoqiang desktop image manager mcp

MCP 服务器,用于管理桌面图片、查看详情、压缩、移动等(完全让Trae实现)

mcp
zhixiaoqiang antd components mcp avatar

zhixiaoqiang antd components mcp

An MCP service for Ant Design components query | 一个减少 Ant Design 组件代码生成幻觉的 MCP 服务,包含系统提示词、组件文档、API 文档、代码示例和更新日志查询

designantdapi

Submit Your MCP Server

Share your MCP server with the community

Submit Now