Trafilatura MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Trafilatura MCP Server extract the main content from https://news.example.com/article"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Trafilatura MCP Server
This repository contains a Model Context Protocol (MCP) server that provides a tool-based interface to the Trafilatura library, a powerful tool for web scraping. It is designed for use with MCP-compatible clients, allowing developers and models to extract main content and metadata from web pages programmatically.
Features
Web Scraping: Utilizes Trafilatura to extract the main text content from a given URL.
Metadata Extraction: Retrieves metadata such as title, author, date, and more.
Configurable Extraction: Options to include or exclude comments and tables from the output.
Simple Tool: Exposes a single, easy-to-use
fetch_and_extracttool.Asynchronous: Built with an asynchronous architecture for efficient I/O operations.
MCP Standard: Communicates over standard I/O, making it compatible with various MCP clients.
Related MCP server: Fetch MCP Server
Prerequisites
Before running the server, you need to have Python 3.12+ and uv installed. You will also need Node.js and npx to run the MCP Inspector tool for testing.
Installation
Clone the repository.
git clone <repository-url> cd trafilatura_mcpCreate a virtual environment and install the required dependencies:
# Create a virtual environment uv venv # Activate the virtual environment source .venv/bin/activate # Install the dependencies uv sync
Running and Testing the Server
The MCP server is a command-line application that communicates over standard I/O. To use it, a client (like an IDE, a coding agent, or an inspector tool) must launch the server process.
Running for Diagnostics
You can run the script directly from your terminal to see if it starts without errors. This is a quick way to validate your Python environment and the script's basic syntax.
python3 trafilatura_mcp.pyThe server will start and wait for input, but you won't be able to interact with it directly from your terminal.
Testing with MCP Inspector
The recommended way to test the server interactively is with MCP Inspector. It provides an interactive shell for sending requests to your server.
Launch the Inspector: You can run the inspector without a permanent installation using
npx. The inspector will launch your MCP server script for you. From your project directory, run:npx @modelcontextprotocol/inspector uv run -- python3 trafilatura_mcp.pyInteract with the Server: Once the inspector starts, you can connect to the server and use commands like
list_toolsandcall_tool.Example session:
# List the available tool > list_tools # Call the 'fetch_and_extract' tool with a URL > call_tool fetch_and_extract '''{"url": "https://www.theguardian.com/us-news/2025/sep/28/mass-shootings-north-carolina-texas-new-orleans"}'''
Configuration
This server does not require any external API keys or configuration files.
Usage with an MCP Client (VS Code Example)
You can connect to this server from any standard MCP client. Here’s how to do it in a VS Code environment that supports MCP:
Configure Your MCP Client: In your IDE's MCP client settings (e.g., in
mcp.jsonfor VS Code), configure a new MCP server that points to the script.Example
mcp.jsonentry:{ "servers": { "trafilatura_scraper": { "command": "uv", "args": [ "run", "python3", "trafilatura_mcp.py" ], "cwd": "/path/to/your/project/trafilatura_mcp" } } }Note: Replace
/path/to/your/project/trafilatura_mcpwith the absolute path to the project directory.Use the Tool: Once connected, you can use the exposed tool in your chat or agent interactions. For example, to extract content from a news article, you could send the following structured tool call:
{ "tool": "fetch_and_extract", "arguments": { "url": "https://apnews.com/article/elon-musk-x-twitter-hate-speech-antisemitism-0d35c5a69fd5c6183b729f7f3c87064a", "include_comments": false, "include_tables": true } }The server will fetch the URL, extract the main content and metadata, and return it as a JSON object.
Available Tools
1 toolfetch_and_extractB
Fetches a URL and extracts the main content, metadata, and comments. Returns a JSON object with the extracted data.
Inputs: url (required), include_comments, include_tables.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
With only one tool, there is no possibility of ambiguity or overlap between tools. The tool's purpose is clearly defined as fetching and extracting content from a URL, making it distinct by default.
Since there is only one tool, naming consistency is inherently perfect. The tool name 'fetch_and_extract' follows a clear verb_noun pattern, and there are no other tools to compare it against for inconsistency.
A single tool is generally too few for a server's purpose, as it limits functionality and may indicate an incomplete surface. For a content extraction server, one tool feels thin and could benefit from additional operations like batch processing or configuration options.
The tool surface is severely incomplete for a content extraction domain. While the single tool handles basic fetching and extraction, there are obvious gaps such as no ability to extract from local files, handle different extraction modes, or manage extraction settings, which could lead to agent failures in more complex scenarios.
Maintenance
Related MCP Connectors
Turn any web page URL or HTML into clean Markdown or plain text for an LLM to read.
Extract clean article text or Markdown from any public web page; ads and boilerplate stripped.
Scrape any URL into clean LLM-ready Markdown, or crawl a whole site.
PDF, DOCX and image URLs to clean, LLM-ready Markdown or text, with OCR for scanned pages.
Related MCP Servers
- FlicenseBqualityDmaintenanceEnables fetching visible text content and extracting all links from web pages through URL requests. Designed specifically for LM Studio integration to provide web scraping capabilities.22-
- AlicenseAqualityDmaintenanceEnables LLMs to fetch and process web content by converting HTML into markdown for easier consumption. It supports chunked reading via pagination and provides configuration options for robots.txt compliance and proxy usage.1MIT
- AlicenseAqualityDmaintenanceEnables fetching and parsing news articles from URLs, extracting title, text, author, and publication date.12MIT
- AlicenseNot gradedqualityCmaintenanceEnables web crawling and content extraction from web pages, supporting multiple output formats like text, markdown, XML, and JSON, with robots.txt compliance and rate limiting.14 npm1MIT