Skip to main content
Glama
local_server.py561 B
from __future__ import annotations from fastmcp import FastMCP mcp=FastMCP("math-server") def _as_number(x): "Accepts int/float or numeric strigs else throws an error" if isinstance(x,(int,float)): return float(x) if isinstance(x,str): return float(x.strip()) raise TypeError("Expected a number") @mcp.tool async def add(a:float , b:float)->float: return _as_number(a) + _as_number(b) @mcp.tool async def sub(a:float , b:float)->float: return _as_number(a) - _as_number(b) if __name__ == "__main__": mcp.run()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Omkar4141/test_mcp_server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server