main.py•2.19 kB
# generated by fastapi-codegen:
# filename: openapi.yaml
# timestamp: 2025-06-29T03:50:10+00:00
import argparse
import json
import os
from typing import *
from autogen.mcp.mcp_proxy import MCPProxy
from autogen.mcp.mcp_proxy.security import BaseSecurity
from models import GetglobaltimeGetResponse
app = MCPProxy(
contact={
'email': 'support@interzoid.com',
'name': 'API Support',
'url': 'https://www.interzoid.com',
'x-twitter': 'interzoid',
},
description='This API retrieves the current time for a city or geographic location around the globe.',
license={'name': 'Interzoid license', 'url': 'https://www.interzoid.com/license'},
termsOfService='https://www.interzoid.com/terms',
title='Interzoid Get Global Time API',
version='1.0.0',
servers=[{'url': 'https://api.interzoid.com'}],
)
@app.get(
'/getglobaltime',
description=""" Gets the current time for a global locale (city, state, region, or country such as Chicago, London, Paris, Seoul, Spain, Buenos Aires, Hawaii, Moscow, Tokyo, Hanoi, etc.) """,
tags=['global_time_management'],
)
def getglobaltime(license: str, locale: str = ...):
"""
Gets the current time for a global locale
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="MCP Server")
parser.add_argument(
"transport",
choices=["stdio", "sse", "streamable-http"],
help="Transport mode (stdio, sse or streamable-http)",
)
args = parser.parse_args()
if "CONFIG_PATH" in os.environ:
config_path = os.environ["CONFIG_PATH"]
app.load_configuration(config_path)
if "CONFIG" in os.environ:
config = os.environ["CONFIG"]
app.load_configuration_from_string(config)
if "SECURITY" in os.environ:
security_params = BaseSecurity.parse_security_parameters_from_env(
os.environ,
)
app.set_security_params(security_params)
mcp_settings = json.loads(os.environ.get("MCP_SETTINGS", "{}"))
app.get_mcp(**mcp_settings).run(transport=args.transport)