# generated by fastapi-codegen:
# filename: openapi.yaml
# timestamp: 2025-06-29T11:11:02+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, HTTPBasic
from fastapi import Path
from starlette.requests import Request
from models import RoutesV2PhoneNumber, RoutesV2SipDomain, RoutesV2Trunks
app = MCPProxy(
contact={
'email': 'support@twilio.com',
'name': 'Twilio Support',
'url': 'https://support.twilio.com',
},
description='This is the public Twilio REST API.',
license={
'name': 'Apache 2.0',
'url': 'https://www.apache.org/licenses/LICENSE-2.0.html',
},
termsOfService='https://www.twilio.com/legal/tos',
title='Twilio - Routes',
version='1.42.0',
servers=[{'url': 'https://routes.twilio.com'}],
)
@app.get(
'/v2/PhoneNumbers/{PhoneNumber}',
description=""" Fetch the Inbound Processing Region assigned to a phone number. """,
tags=['phone_number_operations'],
security=[
HTTPBasic(name="None"),
],
)
def fetch_phone_number(phone_number: str = Path(..., alias='PhoneNumber')):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v2/PhoneNumbers/{PhoneNumber}',
description=""" Assign an Inbound Processing Region to a phone number. """,
tags=['phone_number_operations'],
security=[
HTTPBasic(name="None"),
],
)
def update_phone_number(
phone_number: str = Path(..., alias='PhoneNumber'), request: Request = ...
):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/v2/SipDomains/{SipDomain}',
tags=['sip_domain_operations'],
security=[
HTTPBasic(name="None"),
],
)
def fetch_sip_domain(sip_domain: str = Path(..., alias='SipDomain')):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v2/SipDomains/{SipDomain}',
tags=['sip_domain_operations'],
security=[
HTTPBasic(name="None"),
],
)
def update_sip_domain(
sip_domain: str = Path(..., alias='SipDomain'), request: Request = ...
):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/v2/Trunks/{SipTrunkDomain}',
description=""" Fetch the Inbound Processing Region assigned to a SIP Trunk. """,
tags=['sip_trunk_operations', 'sip_domain_operations'],
security=[
HTTPBasic(name="None"),
],
)
def fetch_trunks(sip_trunk_domain: str = Path(..., alias='SipTrunkDomain')):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/v2/Trunks/{SipTrunkDomain}',
description=""" Assign an Inbound Processing Region to a SIP Trunk """,
tags=['sip_trunk_operations', 'sip_domain_operations'],
security=[
HTTPBasic(name="None"),
],
)
def update_trunks(
sip_trunk_domain: str = Path(..., alias='SipTrunkDomain'), request: Request = ...
):
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)