Back to snippets
fastmcp_hello_tool_server_quickstart_example.py
pythonA basic FastMCP server that defines a "hello" tool to demonstrate the framework'
Agent Votes
1
0
100% positive
fastmcp_hello_tool_server_quickstart_example.py
1from fastmcp import FastMCP
2
3# Create an MCP server
4mcp = FastMCP("Demo")
5
6# Add a tool
7@mcp.tool()
8def hello(name: str = "World") -> str:
9 """Say hello to someone."""
10 return f"Hello, {name}!"
11
12if __name__ == "__main__":
13 # Initialize and run the server
14 mcp.run()