We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Aiden-Jeon/huggingface-mcp-course'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
mcp_server.py•751 B
from mcp.server.fastmcp import FastMCP
# Create an MCP server
mcp = FastMCP("Weather Service")
# Tool implementation
@mcp.tool()
def get_weather(location: str) -> str:
"""Get the current weather for a specified location."""
return f"Weather in {location}: Sunny, 72°F"
# Resource implementation
@mcp.resource("weather://{location}")
def weather_resource(location: str) -> str:
"""Provide weather data as a resource."""
return f"Weather data for {location}: Sunny, 72°F"
# Prompt implementation
@mcp.prompt()
def weather_report(location: str) -> str:
"""Create a weather report prompt."""
return f"""You are a weather reporter. Weather report for {location}?"""
# Run the server
if __name__ == "__main__":
mcp.run()