This skill allows the Agent to use a Python script to call the fetch server of the Model Context Protocol (MCP) to scrape web page content. It is especially suitable for retrieving web page content and providing it as context to AI.
Core Features
- Automated scraping: Automatically starts and connects to the
@smithery/mcp-fetchserver. - Content extraction: Able to retrieve text content from a specified URL.
- No additional Python dependencies: Implemented using the Python standard library, with no need to install additional pip packages (only requires
node/npxandpython)。
Usage Instructions
- Determine the target URL: Identify the web address whose content the user needs to retrieve.
- Call the script: In the project root directory, run the following command in the terminal:
python fetch/fetch.py "https://example.com" - Process the output: The script will print the text of the web page content directly to standard output.
Technical Details
- Communication protocol: Uses JSON-RPC 2.0 to communicate with the MCP server via standard input/output (stdio).
- Server startup: Use
npx -y @smithery/mcp-fetchto start the server. - Initialization process: The script sends the
initializerequest and processes thenotifications/initializednotification to establish a connection compliant with the MCP specification. - Tool invocation: Call the
tools/callmethod to invoke thefetchtool, supporting themaxLengthandrawparameters (the script usesmaxLength: 20000)。