We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/markjukerburg/MCP-'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
server.py•467 B
# server.py
from mcp.server.fastmcp import FastMCP
import yfinance as yf
# Create an MCP server
mcp = FastMCP("Demo")
# Add an addition tool
@mcp.tool()
def get_stock_price(ticker: str) -> float:
"""Fetch the latest stock price for a given ticker symbol from Yahoo Finance"""
stock = yf.Ticker(ticker)
return stock.history(period="1d")["Close"].iloc[-1]
if __name__ == "__main__":
# Initialize and run the server
mcp.run(transport='stdio')