Skip to main content
Glama

OpenAPI to MCP Server

by jeweis
server.py775 B
# server.py """ MCP服务器主模块,提供openapi2mcp功能 """ from fastmcp import FastMCP from src.app_config import config from src.core import helloworld import httpx # 创建MCP服务器实例 mcp = FastMCP(name=config.SERVER_NAME) @mcp.tool def echo_tool(text: str) -> str: """Echo the input text""" return helloworld(text) def main(): """主函数,用于启动mcp服务器""" print("启动 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