MCP Website Fetcher
Model Context Protocol (MCP) Website Fetcher is a lightweight MCP server implementation that provides a simple tool for fetching website content.It serves as a demonstration project to show how tools can be exposed and interacted with using the MCP protocol.
Overview
This project exposes an MCP-compatible API endpoint with a tool called fetch
that allows clients to retrieve the raw content of a specified URL.It's designed mainly for demo purposes and testing how clients can interact with tools over the MCP protocol.
Running the Server Using Docker
The application is automatically built and pushed to GitHub Container Registry (GHCR) on every push to the main branch.
To run the latest version locally using Docker:
docker run -d -p 8000:8000 ghcr.io/electrocucaracha/mcp-website-fetcher:main
This will start the MCP server and expose it on port 8000.
Testing Locally
Once the container is running, you can interact with the server using curl
to test its capabilities.
Get the List of Tools
To retrieve the list of available tools exposed by the MCP server:
curl -H "Accept: application/json, text/event-stream" \
-H "Content-Type: application/json" \
-d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/list"}' \
http://127.0.0.1:8000/mcp
Fetch the Content of a Website
To fetch the content of https://electrocucaracha.com/
:
curl -H "Accept: application/json, text/event-stream" \
-H "Content-Type: application/json" \
-d '{ "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "fetch", "arguments": { "url": "https://electrocucaracha.com/" }}}' \
http://127.0.0.1:8000/mcp
The server will return the HTML content of the requested URL.