Member-only story
This is the 3rd article of our MCP series.
6 min read
14 hours ago
--
In the previous article (thumbnail below), I built a “Math MCP Server” using FastMCP and tested it via MCP Inspector — optional read.’
This article covers connecting that local MCP server to Claude Desktop on Windows.
Register MCP Server with Claude-Desktop
This is the main.py file of a local “Math MCP server” and we have added 2 basic tools (square and square root — shown below)
@mcp.tool()
def square(number: float) -> float:
"""
Calculate the square of a number. Args:
number (float): Input number
Returns:
float: Square of the input number
"""
return number * number
@mcp.tool()
def square_root(number: float) -> float:
"""
Calculate the square root of a number.
Args:
number (float): Input number
Returns:
float: Square root of the input number
Raises:
ValueError: If the number is negative
"""
if number < 0:
raise ValueError("Square root of negative numbers is not allowed.")
return sqrt(number)
