We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/sritajkumarpatel/learn_mcp_2025'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
crypto_mcp_server.py•977 B
from mcp.server.fastmcp import FastMCP
import requests
# Initialize the MCP server for managing local notes
mcp = FastMCP("Local Notes")
@mcp.tool()
def get_cryptocurrency_price(crypto: str) -> str:
"""
Get the current price of a specified cryptocurrency.
Args:
crypto: The cryptocurrency name (e.g., 'bitcoin', 'ethereum')
Returns:
A string with the current price of the cryptocurrency
"""
url = f"https://api.coingecko.com/api/v3/simple/price?ids={crypto}&vs_currencies=usd"
response = requests.get(url)
if response.status_code != 200:
return f"Error fetching price for {crypto}."
data = response.json()
if crypto not in data:
return f"Cryptocurrency '{crypto}' not found."
price = data[crypto]['usd']
return f"The current price of {crypto} is ${price} USD."
if __name__ == "__main__":
# Start the MCP server and listen for requests
mcp.run()