# generated by fastapi-codegen:
# filename: openapi.yaml
# timestamp: 2025-06-28T19:39:56+00:00
import argparse
import json
import os
from typing import *
from typing import Optional
from autogen.mcp.mcp_proxy import MCPProxy
from autogen.mcp.mcp_proxy.security import APIKeyQuery, BaseSecurity
from fastapi import Path
from models import (
GifsGetResponse,
GifsGifIdGetResponse,
GifsRandomGetResponse,
GifsSearchGetResponse,
GifsTranslateGetResponse,
GifsTrendingGetResponse,
StickersRandomGetResponse,
StickersSearchGetResponse,
StickersTranslateGetResponse,
StickersTrendingGetResponse,
)
app = MCPProxy(
contact={'email': 'support@giphy.com'},
description='Giphy API',
termsOfService='https://developers.giphy.com/',
title='Giphy API',
version='1.0',
servers=[{'url': 'https://api.giphy.com/v1'}],
)
@app.get(
'/gifs',
description=""" A multiget version of the get GIF by ID endpoint.
""",
tags=['gif_handling'],
security=[
APIKeyQuery(name="api_key"),
],
)
def get_gifs_by_id(ids: Optional[str] = None):
"""
Get GIFs by ID
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/gifs/random',
description=""" Returns a random GIF, limited by tag. Excluding the tag parameter will return a random GIF from the GIPHY catalog.
""",
tags=['gif_handling'],
security=[
APIKeyQuery(name="api_key"),
],
)
def random_gif(tag: Optional[str] = None, rating: Optional[str] = None):
"""
Random GIF
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/gifs/search',
description=""" Search all GIPHY GIFs for a word or phrase. Punctuation will be stripped and ignored. Use a plus or url encode for phrases. Example paul+rudd, ryan+gosling or american+psycho.
""",
tags=['gif_handling'],
security=[
APIKeyQuery(name="api_key"),
],
)
def search_gifs(
q: str,
limit: Optional[int] = 25,
offset: Optional[int] = 0,
rating: Optional[str] = None,
lang: Optional[str] = None,
):
"""
Search GIFs
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/gifs/translate',
description=""" The translate API draws on search, but uses the GIPHY `special sauce` to handle translating from one vocabulary to another. In this case, words and phrases to GIF
""",
tags=['gif_handling'],
security=[
APIKeyQuery(name="api_key"),
],
)
def translate_gif(s: str):
"""
Translate phrase to GIF
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/gifs/trending',
description=""" Fetch GIFs currently trending online. Hand curated by the GIPHY editorial team. The data returned mirrors the GIFs showcased on the GIPHY homepage. Returns 25 results by default.
""",
tags=['gif_handling'],
security=[
APIKeyQuery(name="api_key"),
],
)
def trending_gifs(
limit: Optional[int] = 25, offset: Optional[int] = 0, rating: Optional[str] = None
):
"""
Trending GIFs
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/gifs/{gifId}',
description=""" Returns a GIF given that GIF's unique ID
""",
tags=['gif_handling'],
security=[
APIKeyQuery(name="api_key"),
],
)
def get_gif_by_id(gif_id: int = Path(..., alias='gifId')):
"""
Get GIF by Id
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/stickers/random',
description=""" Returns a random GIF, limited by tag. Excluding the tag parameter will return a random GIF from the GIPHY catalog.
""",
tags=['sticker_handling'],
security=[
APIKeyQuery(name="api_key"),
],
)
def random_sticker(tag: Optional[str] = None, rating: Optional[str] = None):
"""
Random Sticker
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/stickers/search',
description=""" Replicates the functionality and requirements of the classic GIPHY search, but returns animated stickers rather than GIFs.
""",
tags=['sticker_handling'],
security=[
APIKeyQuery(name="api_key"),
],
)
def search_stickers(
q: str,
limit: Optional[int] = 25,
offset: Optional[int] = 0,
rating: Optional[str] = None,
lang: Optional[str] = None,
):
"""
Search Stickers
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/stickers/translate',
description=""" The translate API draws on search, but uses the GIPHY `special sauce` to handle translating from one vocabulary to another. In this case, words and phrases to GIFs.
""",
tags=['sticker_handling'],
security=[
APIKeyQuery(name="api_key"),
],
)
def translate_sticker(s: str):
"""
Translate phrase to Sticker
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/stickers/trending',
description=""" Fetch Stickers currently trending online. Hand curated by the GIPHY editorial team. Returns 25 results by default.
""",
tags=['sticker_handling'],
security=[
APIKeyQuery(name="api_key"),
],
)
def trending_stickers(
limit: Optional[int] = 25, offset: Optional[int] = 0, rating: Optional[str] = None
):
"""
Trending Stickers
"""
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)