MCP URL Fetcher
MCP URL 格式转换器
模型上下文协议 (MCP) 服务器可从任何 URL 获取内容并将其转换为所需的输出格式。
概述
MCP URL 格式转换器提供从任何 Web URL 检索内容并将其转换为各种格式(HTML、JSON、Markdown 或纯文本)的工具,无论原始内容类型如何。它旨在与任何兼容 MCP 的客户端(包括 Claude for Desktop)配合使用,使 LLM 能够以一致的格式访问、转换和分析 Web 内容。
Related MCP server: MCP Web Tools Server
特征
🔄格式转换:将任何 Web 内容转换为 HTML、JSON、Markdown 或纯文本
🌐通用输入支持:处理网站、API、原始文件等
🔍自动内容检测:智能识别源格式
🧰强大的库支持:使用行业标准库:
Cheerio 用于 HTML 解析
标记为 Markdown 处理
用于 XML 处理的 Fast-XML-Parser
CSVtoJSON 用于 CSV 转换
SanitizeHTML 安全性
拒绝 HTML 到 Markdown 的转换
🔧高级格式处理:
使用元数据提取进行 HTML 解析
JSON 漂亮打印和结构保存
Markdown 渲染与样式
CSV 到表格的转换
XML 到 JSON 的转换
📜历史记录跟踪:维护最近获取的 URL 的日志
🛡️安全焦点:内容清理以防止 XSS 攻击
安装
先决条件
Node.js 16.x 或更高版本
npm 或 yarn
快速入门
克隆存储库:
git clone https://github.com/yourusername/mcp-url-converter.git cd mcp-url-converter安装依赖项:
npm install构建项目:
npm run build运行服务器:
npm start
与 Claude for Desktop 集成
打开您的 Claude for Desktop 配置文件:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
将 URL 转换器服务器添加到您的配置中:
{ "mcpServers": { "url-converter": { "command": "node", "args": ["/absolute/path/to/mcp-url-converter/build/index.js"] } } }重启 Claude 桌面版
可用工具
fetch
从任何 URL 获取内容并自动检测最佳输出格式。
参数:
url(字符串,必需):获取内容的 URLformat(字符串,可选):要转换为的格式(auto,html,json,markdown,text)。默认值:auto
例子:
Can you fetch https://example.com and choose the best format to display it?fetch-json
从任何 URL 获取内容并将其转换为 JSON 格式。
参数:
url(字符串,必需):获取内容的 URLprettyPrint(布尔值,可选):是否以美观的方式打印 JSON。默认值:true
例子:
Can you fetch https://example.com and convert it to JSON format?fetch-html
从任何 URL 获取内容并将其转换为 HTML 格式。
参数:
url(字符串,必需):获取内容的 URLextractText(布尔值,可选):是否仅提取文本内容。默认值:false
例子:
Can you fetch https://api.example.com/users and convert it to HTML?fetch-markdown
从任何 URL 获取内容并将其转换为 Markdown 格式。
参数:
url(字符串,必需):获取内容的 URL
例子:
Can you fetch https://example.com and convert it to Markdown?fetch-text
从任何 URL 获取内容并将其转换为纯文本格式。
参数:
url(字符串,必需):获取内容的 URL
例子:
Can you fetch https://example.com and convert it to plain text?web-search和deep-research
这些工具为 Perplexity 搜索功能提供接口(当 MCP 主机支持时)。
可用资源
recent-urls://list
返回最近获取的带有时间戳和输出格式的 URL 列表。
例子:
What URLs have I fetched recently?安全
该服务器实施了多项安全措施:
使用
sanitize-html进行 HTML 清理以防止 XSS 攻击处理之前的内容验证
错误处理和安全默认值
使用 Zod 进行输入参数验证
安全输出编码
测试
您可以使用 MCP 检查器测试服务器:
npm run test故障排除
常见问题
连接错误:验证 URL 是否可访问且格式正确
转换错误:某些复杂内容可能无法在格式之间顺利转换
跨域问题:某些网站可能会阻止来自未知来源的请求
调试模式
要获取更多调试信息,请设置DEBUG环境变量:
DEBUG=mcp:* npm start执照
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。
致谢
使用模型上下文协议构建
使用现代的、积极维护的库,并注重安全
基于 OWASP 建议的清理方法
最后更新:2025年3月29日
Available Tools
5 toolsfetchC
Fetch content from a URL with automatic content type detection
Inputs: url (required), format.
fetch-htmlB
Fetch content from any URL and convert to HTML format
Inputs: url (required), extractText.
fetch-jsonC
Fetch content from any URL and convert to JSON format
Inputs: url (required), prettyPrint.
fetch-markdownA
Fetch content from any URL and convert to Markdown format
Inputs: url (required).
fetch-textC
Fetch content from any URL and convert to plain text format
Inputs: url (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
The tools have significant overlap in purpose, as all fetch content from URLs, differing only in output format. An agent could easily misselect between fetch-html, fetch-json, fetch-markdown, and fetch-text, since the descriptions don't clarify when to use one format over another. The generic 'fetch' tool with automatic detection further confuses boundaries, as it might duplicate or conflict with the format-specific tools.
Tool names follow a highly consistent verb-noun pattern throughout, with all tools using 'fetch' as the verb followed by a hyphen and format descriptor (e.g., fetch-html, fetch-json). There are no deviations in style or convention, making the naming predictable and easy to parse for an agent.
With 5 tools, the count is reasonable for a URL fetching server, but it feels borderline due to redundancy. The tools could potentially be consolidated into fewer, more flexible tools (e.g., a single fetch tool with a format parameter), making the current set feel slightly over-specified for the simple domain of fetching URLs.
For the domain of fetching URL content, the tool set is nearly complete, covering automatic detection and common output formats (HTML, JSON, Markdown, plain text). A minor gap exists in handling errors or advanced configurations (e.g., headers, timeouts), but agents can likely work around this with the provided tools for basic fetching tasks.
Maintenance
Related MCP Connectors
Jina AI Reader/Search MCP — turn any URL into clean LLM-ready markdown, plus web search.
PDF, DOCX and image URLs to clean, LLM-ready Markdown or text, with OCR for scanned pages.
Autonomous Website Intelligence & OSINT Suite for AI Agents (10 Tools) Surgically extract clean token-optimized Markdown for RAG, detect 65+ tech stacks, identify corporate mail providers (Google Workspace vs Microsoft 365), and audit SSL/security posture with hardened SSRF protection. Quick Install in Claude Desktop (claude_desktop_config.json): json { "mcpServers": { "webintel": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-fetch", "https://webintel-apis.vercel.app/api/mcp"] } } }
Document-to-Markdown MCP server — convert PDF, Office and HTML into LLM-ready Markdown.
Related MCP Servers
- AlicenseAqualityDmaintenanceA production-ready Model Context Protocol server that enables language models to leverage AI-powered web scraping capabilities, offering tools for transforming webpages to markdown, extracting structured data, and executing AI-powered web searches.8109 PyPI123MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that allows LLMs to interact with web content through standardized tools, currently supporting web scraping functionality.1MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that intelligently fetches and processes web content, transforming websites and documentation into clean, structured markdown with nested URL crawling capabilities.29 npm9MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables AI assistants to securely fetch and extract readable text content from web pages through a standardized interface.1MIT