Spaces:
Sleeping
Sleeping
Download examples/desktop.py from purecipher/xsecuremcp: direct link, hf CLI and curl.
- Browser
- Download file 648 Bytes
-
https://huggingface.co/spaces/purecipher/xsecuremcp/resolve/main/examples/desktop.py
- Command line
-
hf download hf://spaces/purecipher/xsecuremcp/examples/desktop.py
-
curl -L -o desktop.py https://huggingface.co/spaces/purecipher/xsecuremcp/resolve/main/examples/desktop.py
648 Bytes
| """ | |
| FastMCP Desktop Example | |
| A simple example that exposes the desktop directory as a resource. | |
| """ | |
| from pathlib import Path | |
| from fastmcp import FastMCP | |
| # Create server | |
| mcp = FastMCP("Demo") | |
| def desktop() -> list[str]: | |
| """List the files in the user's desktop""" | |
| desktop = Path.home() / "Desktop" | |
| return [str(f) for f in desktop.iterdir()] | |
| # Add a dynamic greeting resource | |
| def get_greeting(name: str) -> str: | |
| """Get a personalized greeting""" | |
| return f"Hello, {name}!" | |
| def add(a: int, b: int) -> int: | |
| """Add two numbers""" | |
| return a + b | |