main.py•5.29 kB
# generated by fastapi-codegen:
# filename: openapi.yaml
# timestamp: 2025-06-29T09:37:59+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 (
FieldFormatDepthChartsGetResponse,
FieldFormatDfsSlatesByDateDateGetResponse,
FieldFormatInjuredPlayersGetResponse,
FieldFormatPlayerGameProjectionStatsByDateDateGetResponse,
FieldFormatPlayerGameProjectionStatsByPlayerDatePlayeridGetResponse,
FieldFormatPlayerSeasonProjectionStatsSeasonGetResponse,
FieldFormatStartingLineupsByDateDateGetResponse,
Format,
)
app = MCPProxy(
contact={'x-twitter': 'nfldata'},
description='MLB projections API.',
title='MLB v3 Projections',
version='1.0',
servers=[
{'url': 'http://azure-api.sportsdata.io/v3/mlb/projections'},
{'url': 'https://azure-api.sportsdata.io/v3/mlb/projections'},
],
)
@app.get(
'/{format}/DepthCharts',
description=""" Returns Depth Charts for all active MLB teams. """,
tags=['team_lineup_management'],
security=[
APIKeyHeader(name="Ocp-Apim-Subscription-Key"),
APIKeyQuery(name="key"),
],
)
def depth_charts(format: Format = 'XML'):
"""
Depth Charts
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/{format}/DfsSlatesByDate/{date}',
tags=['daily_fantasy_sports_management', 'team_lineup_management'],
security=[
APIKeyHeader(name="Ocp-Apim-Subscription-Key"),
APIKeyQuery(name="key"),
],
)
def dfs_slates_by_date(format: Format = 'XML', date: str = ...):
"""
DFS Slates by Date
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/{format}/InjuredPlayers',
description=""" This endpoint provides all currently injured MLB players, along with injury details. """,
tags=['player_injury_reporting', 'player_statistics_projection'],
security=[
APIKeyHeader(name="Ocp-Apim-Subscription-Key"),
APIKeyQuery(name="key"),
],
)
def injured_players(format: Format = 'XML'):
"""
Injured Players
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/{format}/PlayerGameProjectionStatsByDate/{date}',
tags=[
'player_statistics_projection',
'player_injury_reporting',
'daily_fantasy_sports_management',
],
security=[
APIKeyHeader(name="Ocp-Apim-Subscription-Key"),
APIKeyQuery(name="key"),
],
)
def projected_player_game_stats_by_date_w_injuries_dfs_salaries(
format: Format = 'XML', date: str = ...
):
"""
Projected Player Game Stats by Date (w/ Injuries, DFS Salaries)
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/{format}/PlayerGameProjectionStatsByPlayer/{date}/{playerid}',
tags=[
'player_statistics_projection',
'player_injury_reporting',
'daily_fantasy_sports_management',
],
security=[
APIKeyHeader(name="Ocp-Apim-Subscription-Key"),
APIKeyQuery(name="key"),
],
)
def projected_player_game_stats_by_player_w_injuries_dfs_salaries(
format: Format = 'XML', date: str = ..., playerid: str = ...
):
"""
Projected Player Game Stats by Player (w/ Injuries, DFS Salaries)
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/{format}/PlayerSeasonProjectionStats/{season}',
tags=['player_statistics_projection', 'daily_fantasy_sports_management'],
security=[
APIKeyHeader(name="Ocp-Apim-Subscription-Key"),
APIKeyQuery(name="key"),
],
)
def projected_player_season_stats_with_adp(format: Format = 'XML', season: str = ...):
"""
Projected Player Season Stats (with ADP)
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/{format}/StartingLineupsByDate/{date}',
tags=['team_lineup_management'],
security=[
APIKeyHeader(name="Ocp-Apim-Subscription-Key"),
APIKeyQuery(name="key"),
],
)
def starting_lineups_by_date(format: Format = 'XML', date: str = ...):
"""
Starting Lineups by Date
"""
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)