main.py•2.84 kB
# generated by fastapi-codegen:
# filename: openapi.yaml
# timestamp: 2025-05-28T16:33:16+00:00
import argparse
import os
from typing import *
from autogen.mcp.mcp_proxy import MCPProxy
from autogen.mcp.mcp_proxy.security import BaseSecurity
from models import CheckoutUtilityRequest, CheckoutUtilityResponse
app = MCPProxy(
contact={
'email': 'support@adyen.com',
'name': 'Adyen Support',
'url': 'https://support.adyen.com/',
'x-twitter': 'Adyen',
},
description='A web service containing utility functions available for merchants integrating with Checkout APIs.\n## Authentication\nEach request to the Checkout Utility API must be signed with an API key. For this, obtain an API Key from your Customer Area, as described in [How to get the Checkout API key](https://docs.adyen.com/developers/user-management/how-to-get-the-checkout-api-key). Then set this key to the `X-API-Key` header value, for example:\n\n```\ncurl\n-H "Content-Type: application/json" \\\n-H "X-API-Key: Your_Checkout_API_key" \\\n...\n```\nNote that when going live, you need to generate a new API Key to access the [live endpoints](https://docs.adyen.com/developers/api-reference/live-endpoints).\n\n## Versioning\nCheckout API supports versioning of its endpoints through a version suffix in the endpoint URL. This suffix has the following format: "vXX", where XX is the version number.\n\nFor example:\n```\nhttps://checkout-test.adyen.com/v1/originKeys\n```',
termsOfService='https://docs.adyen.com/legal/terms-conditions',
title='Adyen Checkout Utility Service',
version='1',
servers=[{'url': 'https://checkout-test.adyen.com/v1'}],
)
@app.post(
'/originKeys',
description=""" This operation takes the origin domains and returns a JSON object containing the corresponding origin keys for the domains. """,
tags=['origin_key_management'],
)
def post_origin_keys(body: CheckoutUtilityRequest = None):
"""
Create originKey values for one or more merchant domains.
"""
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"], help="Transport mode (stdio or sse)"
)
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)
app.mcp.run(transport=args.transport)