mcp hosted on a server and client app
In this post, we are going to host our mcp tool on a remote server and let it called by a client. First ensure we have initialize the directory and added the right packages here uv add fastmcp uvicorn Then we will have our server.py where we will use uvicorn to host it and then expose /sse endpoint for client to call. server.py # server.py import os from fastmcp import FastMCP # 1. Initialize FastMCP mcp = FastMCP ( " Remote Centralized Tooling " ) # 2. Define your tool(s) @ mcp . tool () def calculate_server_metrics ( cpu_load : float , memory_load : float ) -> str : """ Performs complex analysis on system performance metrics. """ # Since this lives entirely on your remote server, you can update this logic # at any time, and local clients will get the updated behavior instantly. score = ( cpu_load * 0.7 ) + ( memory_load * 0.3 ) if score > 80 : ...