pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/modelcontextprotocol/python-sdk/tree/main/examples/servers/simple-tool

esheet" href="https://github.githubassets.com/assets/primer-0fcd9af82350aeda.css" /> python-sdk/examples/servers/simple-tool at main · modelcontextprotocol/python-sdk · GitHub
Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

A simple MCP server that exposes a website fetching tool.

Usage

Start the server using either stdio (default) or Streamable HTTP transport:

# Using stdio transport (default)
uv run mcp-simple-tool

# Using Streamable HTTP transport on custom port
uv run mcp-simple-tool --transport streamable-http --port 8000

The server exposes a tool named "fetch" that accepts one required argument:

  • url: The URL of the website to fetch

Example

Using the MCP client, you can use the tool like this using the 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
            result = await session.call_tool("fetch", {"url": "https://example.com"})
            print(result)


asyncio.run(main())
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy