This example demonstrates how to create a simple MCP server with streamable HTTP transport, featuring several tools, prompts, and resources.
By default, the server runs on port 8000.
python simple_streamable_http_mcp_server.pyOr with uv:
uv run mcp-serverChange the port (default is 8000):
MCP_SERVER_PORT=9000 python simple_streamable_http_mcp_server.pyEnable debug logs for tool calls:
MCP_DEBUG=1 python simple_streamable_http_mcp_server.pyMCP_SERVER_PORT=9000 MCP_DEBUG=1 python simple_streamable_http_mcp_server.pyhello_world(name)- Say helloadd_numbers(a, b)- Add two numbersrandom_number(min_val, max_val)- Generate random numberreturn_json_example()- Return example JSONcalculate_bmi(weight, height)- Calculate BMI
BMI Calculator- Prompt for BMI calculation
server://info- Get server info