Skip to main content
Glama
Dhavaleswar

Explore MCP

by Dhavaleswar
mcp_server.py707 B
from fastmcp import FastMCP from fastapi import FastAPI # IMPORTANT: server name must match what OpenAI uses mcp = FastMCP("local-fastmcp", auth=None) @mcp.tool() def ping() -> str: """ Simple health-check tool. """ return "pong" @mcp.tool() def add(a: int, b: int) -> int: """ Adds two integers. """ print("MCP add called") return a + b @mcp.tool() def subtract(a: int, b: int) -> int: """ Subtracts two integers. """ print("MCP subtract called") return a - b mcp_app = mcp.http_app(path="/mcp") app = FastAPI(lifespan=mcp_app.lifespan) app.mount("/", mcp_app) if __name__ == "__main__": import uvicorn uvicorn.run(app, port=8000)

Latest Blog Posts

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/Dhavaleswar/explore-mcp'

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