modelcontextprotocol / modelcontextprotocol/servers
Implement Mechanism to Exclude Specific <div> Elements by ID or Class Name in Fetch MCP Server
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 90.5k
- Forks
- 11.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 5
Description
Description:
We propose enhancing the Fetch MCP Server by introducing a feature that allows users to exclude certain
Problem Statement:
Currently, when fetching content from webpages with extensive sidebars or navigation menus—such as a lengthy index on the left side—the server retrieves these sections in large chunks (e.g., 20,000 tokens at a time). This can lead to inefficiencies, as large language models (LLMs) may process these sizable, non-essential sections first and prematurely determine that the website is unsuitable for the query, thereby diverting to alternative approaches. This behavior hampers the effectiveness of data retrieval and processing, especially when the main content is overshadowed by voluminous ancillary sections.
Use Case:
Consider a webpage where the left sidebar contains an extensive index with numerous items, each enclosed within
Proposed Solution:
Introduce a configuration option within the Fetch MCP Server that enables users to specify a list of ids and/or class names corresponding to
1. Configuration File: Allow users to define the ids and class names to exclude within the server’s configuration file.
2. API Parameters: Introduce API parameters that accept arrays of ids and class names to exclude during a fetch request.
Benefits:
• Enhanced Data Relevance: By excluding non-essential
• Optimized Token Utilization: Reducing the amount of irrelevant content helps in staying within token limits of LLMs, thereby preventing premature termination of processing due to token overflows. 
• Improved Processing Efficiency: With less extraneous data to handle, the overall efficiency of data processing workflows is enhanced, leading to faster and more accurate outcomes.
Potential Challenges:
• Complexity in Implementation: Accurately identifying and excluding specified
• User Configuration Errors: Incorrectly specified ids or class names could lead to unintended exclusions, necessitating robust validation and clear documentation to guide users in configuring exclusions appropriately.
References:
The need to manage large content sections during data processing with LLMs has been discussed in various forums. For instance, strategies to handle large HTML documents for LLMs with limited token sizes have been explored, highlighting the importance of content segmentation to optimize processing efficiency. 
Conclusion:
Implementing a feature to exclude specific
Thank you for considering this feature request.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Fetch MCP Server and its existing fetch configuration and API entry points, then trace how fetched HTML is parsed and processed. Determine how exclusion lists should be supplied and applied to div elements, including validation behavior. Done means users can specify IDs or class names and the resulting fetch omits the matching sections without disrupting other content.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100