# generated by fastapi-codegen:
# filename: openapi.yaml
# timestamp: 2025-06-29T12:18:48+00:00
import argparse
import json
import os
from typing import *
from typing import Optional
from uuid import UUID
from autogen.mcp.mcp_proxy import MCPProxy
from autogen.mcp.mcp_proxy.security import (
BaseSecurity,
HTTPBasic,
UnsuportedSecurityStub,
)
from fastapi import Query
from models import ConnectionsGetResponse
app = MCPProxy(
contact={
'email': 'api@xero.com',
'name': 'Xero Platform Team',
'url': 'https://developer.xero.com',
'x-twitter': 'XeroAPI',
},
description='These endpoints are related to managing authentication tokens and identity for Xero API',
license={
'name': 'MIT',
'url': 'https://github.com/XeroAPI/Xero-OpenAPI/blob/master/LICENSE',
},
termsOfService='https://developer.xero.com/xero-developer-platform-terms-conditions/',
title='Xero OAuth 2 Identity Service API',
version='2.9.4',
servers=[
{'description': 'Xero Identity service API', 'url': 'https://api.xero.com'}
],
)
@app.get(
'/Connections',
description=""" Override the base server url that include version """,
tags=['user_connection_management'],
security=[
UnsuportedSecurityStub(name="None"),
],
)
def get_connections(auth_event_id: Optional[UUID] = Query(None, alias='authEventId')):
"""
Retrieves the connections for this user
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.delete(
'/Connections/{id}',
description=""" Override the base server url that include version """,
tags=['user_connection_management'],
security=[
UnsuportedSecurityStub(name="None"),
],
)
def delete_connection(id: UUID):
"""
Deletes a connection for this user (i.e. disconnect a tenant)
"""
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)