Skip to main content

title: “Local Server Server” description: “Tool integration example.” ---~~~python """ fastmcp is required for this demo.
Run this with fastmcp run cookbook/90_tools/mcp/local_server/server.py """ from fastmcp import FastMCP

---------------------------------------------------------------------------

Create Agent

---------------------------------------------------------------------------

mcp = FastMCP(“weather_tools”) @mcp.tool() def get_weather(city: str) -> str: return f”The weather in is sunny” @mcp.tool() def get_temperature(city: str) -> str: return f”The temperature in is 70 degrees”

---------------------------------------------------------------------------

Run Agent

---------------------------------------------------------------------------

if name == “main”: mcp.run(transport=“stdio”)