# generated by fastapi-codegen:
# filename: openapi.yaml
# timestamp: 2025-06-29T09:39:52+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 APIKeyHeader, APIKeyQuery, BaseSecurity
from models import (
Driver,
FieldFormatDriverRaceProjectionsRaceidGetResponse,
FieldFormatDriversGetResponse,
FieldFormatRacesSeasonGetResponse,
FieldFormatSeriesGetResponse,
Format,
RaceResult,
)
app = MCPProxy(
contact={'x-twitter': 'nfldata'},
title='NASCAR v2',
version='1.0',
servers=[
{'url': 'http://azure-api.sportsdata.io/nascar/v2'},
{'url': 'https://azure-api.sportsdata.io/nascar/v2'},
],
)
@app.get(
'/{format}/DriverRaceProjections/{raceid}',
tags=['driver_info_management', 'race_results_handling'],
security=[
APIKeyHeader(name="Ocp-Apim-Subscription-Key"),
APIKeyQuery(name="key"),
],
)
def driver_race_projections_entry_list(format: Format = 'xml', raceid: str = ...):
"""
Driver Race Projections (Entry List)
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/{format}/driver/{driverid}',
tags=['driver_info_management'],
security=[
APIKeyHeader(name="Ocp-Apim-Subscription-Key"),
APIKeyQuery(name="key"),
],
)
def driver_details(format: Format = 'xml', driverid: str = ...):
"""
Driver Details
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/{format}/drivers',
tags=['driver_info_management'],
security=[
APIKeyHeader(name="Ocp-Apim-Subscription-Key"),
APIKeyQuery(name="key"),
],
)
def drivers(format: Format = 'xml'):
"""
Drivers
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/{format}/raceresult/{raceid}',
tags=['race_results_handling'],
security=[
APIKeyHeader(name="Ocp-Apim-Subscription-Key"),
APIKeyQuery(name="key"),
],
)
def race_results(format: Format = 'xml', raceid: str = ...):
"""
Race Results
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/{format}/races/{season}',
tags=['race_results_handling', 'race_series_info'],
security=[
APIKeyHeader(name="Ocp-Apim-Subscription-Key"),
APIKeyQuery(name="key"),
],
)
def races_schedule(format: Format = 'xml', season: str = ...):
"""
Races / Schedule
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/{format}/series',
tags=['race_series_info'],
security=[
APIKeyHeader(name="Ocp-Apim-Subscription-Key"),
APIKeyQuery(name="key"),
],
)
def series(format: Format = 'xml'):
"""
Series
"""
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)