Skip to main content
Glama

Example MCP Server

main.py807 B
# server.py from fastmcp import FastMCP import random magic_words = ["consistent", "honor", "attitude", "motivation", "perseverance", "integrity", "optimistic", "never giving up"] mcp = FastMCP("Demo 🚀") @mcp.tool def add(a: int, b: int) -> int: """Add two numbers""" return a + b @mcp.tool def subtract(a: int, b: int) -> int: """Subtract two numbers""" return a - b @mcp.tool def multiply(a: int, b: int) -> int: """Multiply two numbers""" return a * b @mcp.tool def divide(a: int, b: int) -> float: """Divide two numbers""" if b == 0: raise ValueError("Cannot divide by zero") return a / b @mcp.tool def magic_word() -> str: """Return a random word from the list""" return random.choice(magic_words) if __name__ == "__main__": mcp.run()

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Joseph19820124/joseph_mcp_server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server