mcp-web-content-server

MCPサーバーは、ウェブサイトのコンテンツを取得するためのツールを提供するシンプルなサーバーです。標準入出力またはSSEトランスポートを使用して起動でき、指定したURLからウェブサイトの内容を取得し、単一のレスポンスまたはストリーミング形式で返します。

GitHubスター

1

ユーザー評価

未評価

フォーク

0

イシュー

0

閲覧数

1

お気に入り

0

README
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

作者情報
Ezzaldeen Hamdan

Web & AI Enthusiast | Passionate About EdTech | Developed MADADCSS | Ex-IIAB

4

フォロワー

15

リポジトリ

0

Gist

4

貢献数

トップ貢献者

スレッド