mcp-web-content-server
The MCP server is a simple server that provides tools for fetching website content. It can be started using standard input/output or SSE transport, and it retrieves the content from a specified URL, returning it either as a single response or in a streaming format.
GitHub Stars
1
User Rating
Not Rated
Forks
0
Issues
0
Views
2
Favorites
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
4
Followers
15
Repositories
0
Gists
4
Total Contributions