mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-28 10:18:08 +02:00
Rename server
This commit is contained in:
parent
b3ca9e2df1
commit
ead41caa0d
7 changed files with 60 additions and 23 deletions
|
|
@ -7,10 +7,10 @@ A simple example that exposes the desktop directory as a resource.
|
|||
import asyncio
|
||||
from pathlib import Path
|
||||
|
||||
from fastmcp.server import FastMCPServer
|
||||
from fastmcp.server import FastMCP
|
||||
|
||||
# Create server
|
||||
app = FastMCPServer("desktop")
|
||||
app = FastMCP("desktop")
|
||||
|
||||
# Add desktop as a directory resource
|
||||
desktop = Path.home() / "Desktop"
|
||||
|
|
@ -24,7 +24,7 @@ app.add_dir_resource(
|
|||
|
||||
def main123():
|
||||
# Run the server
|
||||
asyncio.run(FastMCPServer.run_stdio(app))
|
||||
asyncio.run(FastMCP.run_stdio(app))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ FastMCP Weather Server Example
|
|||
import os
|
||||
import httpx
|
||||
from pydantic import BaseModel, Field
|
||||
from fastmcp.server import FastMCPServer
|
||||
from fastmcp.server import FastMCP
|
||||
|
||||
# Load env vars
|
||||
API_KEY = os.getenv("OPENWEATHER_API_KEY")
|
||||
|
|
@ -32,7 +32,7 @@ class AlertParams(BaseModel):
|
|||
|
||||
|
||||
# Create server
|
||||
app = FastMCPServer("weather-service")
|
||||
app = FastMCP("weather-service")
|
||||
|
||||
|
||||
# Tools using Pydantic models
|
||||
|
|
@ -126,7 +126,7 @@ def main():
|
|||
)
|
||||
|
||||
# Run the server
|
||||
asyncio.run(FastMCPServer.run_stdio(app))
|
||||
asyncio.run(FastMCP.run_stdio(app))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue