mcp-web-content-server
This MCP server provides tools for fetching website content. It can be started using standard input/output or SSE transport, allowing users to retrieve the content of a specified URL. In streaming mode, it can fetch content in chunks of 500 characters, making it suitable for token-aware applications.
GitHub Stars
1
User Rating
Not Rated
Favorites
0
Views
29
Forks
0
Issues
0
MCP Server
A simple MCP server that exposes website fetching tools.
Usage
Start the server using either stdio (default) or SSE transport:
# Using stdio transport (default)
uv run mcp-simple-tool
# Using SSE transport on custom port
uv run mcp-simple-tool --transport sse --port 8000
The server exposes two tools:
fetch: Fetches a website and returns its full content as a single response.fetch_streamed: Fetches a website and returns its content in 500-character chunks for streaming or token-aware use.
Both tools accept one required argument:
url: The URL of the website to fetch
Example
Using the MCP client, you can use the tools like this (STDIO transport):
import asyncio
from mcp.client.session import ClientSession
from mcp.client.stdio import StdioServerParameters, stdio_client
async def main():
async with stdio_client(
StdioServerParameters(command="uv", args=["run", "mcp-simple-tool"])
) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
# List available tools
tools = await session.list_tools()
print(tools)
# Call the fetch tool (returns full content)
result = await session.call_tool("fetch", {"url": "https://example.com"})
print("Fetch result:", result)
# Call the fetch_streamed tool (returns content in chunks)
streamed_result = await session.call_tool("fetch_streamed", {"url": "https://example.com"})
print("Fetch streamed result:")
for chunk_content in streamed_result:
print(chunk_content)
asyncio.run(main())
Output for fetch_streamed
The fetch_streamed tool returns a list of TextContent objects, each containing a chunk of the website's content. To reconstruct the full content, concatenate the .text fields:
full_content = "".join(chunk.text for chunk in streamed_result)
For more details, see the code in mcp_simple_tool/server.py