ai-mcp-demo.py The provided code demonstrates a simple MCP (Model Context Protocol) server named "host info mcp" built using the `FastMCP` library. It defines a single tool, `get_host_info`, which collects and returns system information—including OS details, memory, CPU count, and CPU model—as a formatted JSON string. The server is configured to run over standard I/O (stdio) and registers the tool for use by an MCP client. ai-mcp-demo.py This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters main.py from mcp.server.fastmcp import FastMCP import tools mcp = FastMCP "host info mcp" mcp.add tool tools.get host info @mcp.tool def foo : return "" def main : mcp.run "stdio" sse if name == " main ": main tools.py import platform import psutil import subprocess import json def get host info - str: """get host information Returns: str: the host information in JSON string """ info: dict str, str = { "system": platform.system , "release": platform.release , "machine": platform.machine , "processor": platform.processor , "memory gb": str round psutil.virtual memory .total / 1024 3 , 2 , } cpu count = psutil.cpu count logical=True if cpu count is None: info "cpu count" = "-1" else: info "cpu count" = str cpu count try: cpu model = subprocess.check output "sysctl", "-n", "machdep.cpu.brand string" .decode .strip info "cpu model" = cpu model except Exception: info "cpu model" = "Unknown" return json.dumps info, indent=4 if name == ' main ': print get host info