# generated by fastapi-codegen:
# filename: openapi.yaml
# timestamp: 2025-06-29T03:16:50+00:00
import argparse
import json
import os
from typing import *
from typing import Optional, Union
from autogen.mcp.mcp_proxy import MCPProxy
from autogen.mcp.mcp_proxy.security import BaseSecurity
from fastapi import Query
from pydantic import conint
from models import (
ApiV1GetResponse,
ApiV1GroundhogsGetResponse,
ApiV1GroundhogsSlugGetResponse,
ApiV1GroundhogsSlugGetResponse1,
ApiV1PredictionsGetResponse,
ApiV1PredictionsGetResponse1,
IsGroundhog,
)
app = MCPProxy(
contact={
'email': 'hello@groundhog-day.com',
'name': 'Paul Craig',
'url': 'https://groundhog-day.com/api',
},
description='This API returns all of North America’s prognosticating animals and their yearly weather predictions.',
license={'name': 'MIT'},
title='Groundhog Day API',
version='1.2.1',
servers=[
{
'description': 'SwaggerHub API Auto Mocking',
'url': 'https://virtserver.swaggerhub.com/pcraig3/groundhog-day-api/1.2.1',
},
{'description': '', 'url': 'https://groundhog-day.com'},
],
)
@app.get(
'/api/v1',
description=""" Returns a welcome message. """,
tags=['general_root_commands'],
)
def root():
"""
Root
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/api/v1/groundhogs',
description=""" Returns all prognosticating animals with their known predictions. """,
tags=['groundhog_information'],
)
def groundhogs(
country: Optional[str] = None,
is_groundhog: Optional[IsGroundhog] = Query(None, alias='isGroundhog'),
):
"""
Get all groundhogs
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/api/v1/groundhogs/{slug}',
description=""" Returns a prognosticating animal and its known predictions. """,
tags=['groundhog_information'],
)
def groundhog(slug: str):
"""
Get a groundhog by slug
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/api/v1/predictions',
description=""" Get all predictions for a given year. """,
tags=['prediction_fetching'],
)
def predictions(year: Optional[conint(ge=1886)] = None):
"""
Get predictions for a given year
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/api/v1/spec',
description=""" Gets the schema for the JSON API as a yaml file. """,
tags=['json_schema_metadata'],
)
def spec():
"""
Get JSON schema
"""
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)