mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-21 13:04:18 +02:00
commit
67ad3441b2
2 changed files with 20 additions and 0 deletions
19
examples/echo.py
Normal file
19
examples/echo.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
"""
|
||||
FastMCP Echo Server
|
||||
"""
|
||||
|
||||
from fastmcp import FastMCP
|
||||
|
||||
|
||||
# Create server
|
||||
mcp = FastMCP("Echo Server")
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
def echo(text: str) -> str:
|
||||
"""Echo the input text"""
|
||||
return text
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
mcp.run()
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue