mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-24 14:34:17 +02:00
31 lines
553 B
Python
31 lines
553 B
Python
"""
|
|
FastMCP Desktop Example
|
|
|
|
A simple example that exposes the desktop directory as a resource.
|
|
"""
|
|
|
|
import asyncio
|
|
from pathlib import Path
|
|
|
|
from fastmcp.server import FastMCPServer
|
|
|
|
# Create server
|
|
app = FastMCPServer("desktop")
|
|
|
|
# Add desktop as a directory resource
|
|
desktop = Path.home() / "Desktop"
|
|
app.add_dir_resource(
|
|
str(desktop),
|
|
recursive=True,
|
|
name="Desktop",
|
|
description="Files on the desktop",
|
|
)
|
|
|
|
|
|
def main123():
|
|
# Run the server
|
|
asyncio.run(FastMCPServer.run_stdio(app))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main123()
|