Rename server

This commit is contained in:
Jeremiah Lowin 2024-11-29 17:59:44 -05:00
commit ead41caa0d
7 changed files with 60 additions and 23 deletions

View file

@ -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__":

View file

@ -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__":