Skip to main content
Glama

OpenAPI to MCP Server

by jeweis
server.py823 B
# server.py """ MCP服务器主模块,各种 mcp 工具入口 """ import logging from fastmcp import FastMCP from src.app_config import config from src.core import helloworld # 创建MCP服务器实例 mcp = FastMCP(name=config.SERVER_NAME) @mcp.tool def hello_world_tool(name: str) -> str: """Hello world tool that echoes the input name""" return helloworld(name) def main() -> None: """主函数,用于启动mcp服务器""" logging.info("启动 MCP 服务器...") if config.TYPE=="streamable-http": mcp.run(transport="streamable-http", host="0.0.0.0", port=config.PORT,path=config.CONTEXT_PATH) elif config.TYPE=="sse": mcp.run(transport="sse", host="0.0.0.0", port=config.PORT,path=config.CONTEXT_PATH) else: mcp.run() if __name__ == "__main__": main()

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/jeweis/mcp-server-template'

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