A TypeScript implementation of an MCP server that fetches web content using Puppeteer and converts it to markdown.
Useful for breaking your LLM out of infinite "search loops"- you can just tell it to read a doc directly after initial context as a tool!
- Uses Puppeteer to fetch and render web pages, including JavaScript-heavy sites
- Extracts text content from web pages
- Converts HTML content to Markdown format
- Provides both stdio and SSE transport for MCP communication
npm install @odgrim/mcp-fetchOr install globally:
npm install -g @odgrim/mcp-fetchmcp-fetchmcp-fetch --sseYou can specify a custom port:
mcp-fetch --sse --port=3001You can run the package directly using npx without installing it:
# Run with stdio transport
npx @odgrim/mcp-fetch
# Run with SSE transport
npx @odgrim/mcp-fetch --sse
# Run with SSE transport on a specific port
npx @odgrim/mcp-fetch --sse --port=3001If you're in the project directory during development:
# Run with stdio transport
npx .
# Run with SSE transport
npx . --sseimport { fetchUrl } from '@odgrim/mcp-fetch';
// Fetch a URL and convert to markdown
const result = await fetchUrl('https://example.com');
console.log(result.markdown);Fetches a URL using Puppeteer and returns the content as markdown.
Parameters:
url(string): The URL to fetchtimeout(number, optional): Timeout in milliseconds (default: 30000)waitForSelector(string, optional): CSS selector to wait forincludeImages(boolean, optional): Whether to include image references in markdown (default: false)
Returns:
- Markdown representation of the page content
Resource URI pattern: fetch://{url}
Fetches a URL and returns the content.
- Node.js 14.16.0 or later
git clone https://github.com/odgrim/mcp-fetch.git
cd mcp-fetch
npm installnpm run buildnpm testnpm run devMPL-2.0