π The fast, Pythonic way to build MCP servers and clients.
Add echo server
Jeremiah Lowin29a5c976dd01
diff --git a/examples/echo.py b/examples/echo.pynew file mode 100644index 000000000..2a81ca4c0--- /dev/null+++ b/examples/echo.py@@ -0,0 +1,19 @@+"""+FastMCP Echo Server+"""++from fastmcp import FastMCP+++# Create server+mcp = FastMCP("Echo Server")+++def echo(text: str) -> str:+ """Echo the input text"""+ return text+++if __name__ == "__main__":+ mcp.run()diff --git a/src/fastmcp/server.py b/src/fastmcp/server.pyindex 9564f5c0f..54cf5dff6 100644--- a/src/fastmcp/server.py+++ b/src/fastmcp/server.py@@ -279,6 +279,7 @@ class FastMCP:async def run_stdio_async(self) -> None:"""Run the server using stdio transport."""async with stdio_server() as (read_stream, write_stream):+ print(f'Starting "{self.name}"...')await self._mcp_server.run(read_stream,write_stream,