Skip to main content
Glama

E-commerce API MCP Server

main.py4.97 kB
# generated by fastapi-codegen: # filename: openapi.yaml # timestamp: 2025-08-18T17:59:43+00:00 import argparse import json import os from typing import * from typing import Optional, Union from uuid import UUID from autogen.mcp.mcp_proxy import MCPProxy from autogen.mcp.mcp_proxy.security import BaseSecurity, HTTPBearer from fastapi import Path from models import ( Address, AddressesGetResponse, AuthLoginPostRequest, AuthRegisterPostRequest, CartGetResponse, CartItem, CheckoutPostRequest, Order, OrdersGetResponse, Product, ProductsGetResponse, ) app = MCPProxy( description='This is an e-commerce API spec for a storefront. \nIt includes authentication, product browsing, cart, and checkout operations.\nAuth is token-based. Explore, test, and mock this API freely.\n', title='E-commerce API', version='1.0.0', servers=[ { 'description': 'Production environment', 'url': 'https://api.demo-ecommerce.com/v1', }, { 'description': 'Development environment', 'url': 'https://api.dev.demo-ecommerce.com/v1', }, ], ) @app.get( '/addresses', tags=['address_management'], security=[ HTTPBearer(name="None"), ], ) def get_addresses(): """ Get your saved addresses """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post( '/addresses', tags=['address_management'], security=[ HTTPBearer(name="None"), ], ) def post_addresses(body: Address): """ Add a new address """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post('/auth/login', tags=['user_account_management']) def post_auth_login(body: AuthLoginPostRequest): """ Login and get access token """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post('/auth/register', tags=['user_account_management']) def post_auth_register(body: AuthRegisterPostRequest): """ Create a new user account """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/cart', tags=['cart_operations'], security=[ HTTPBearer(name="None"), ], ) def get_cart(): """ Get current user's cart """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post( '/cart/items', tags=['cart_operations'], security=[ HTTPBearer(name="None"), ], ) def post_cart_items(body: CartItem): """ Add item to cart """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post( '/checkout', tags=['order_processing'], security=[ HTTPBearer(name="None"), ], ) def post_checkout(body: CheckoutPostRequest): """ Checkout and place order """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/orders', tags=['order_processing'], security=[ HTTPBearer(name="None"), ], ) def get_orders(): """ List your past orders """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/orders/{orderId}', tags=['order_processing'], security=[ HTTPBearer(name="None"), ], ) def get_orders__order_id(order_id: UUID = Path(..., alias='orderId')): """ Get order details """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get('/products', tags=['product_info_management']) def get_products( category: Optional[str] = None, search: Optional[str] = None, min_price: Optional[float] = None, max_price: Optional[float] = None, ): """ List all products with filters """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get('/products/{id}', tags=['product_info_management']) def get_products__id(id: UUID): """ Get product details by ID """ 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)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ag2-mcp-servers/e-commerce-api'

If you have feedback or need assistance with the MCP directory API, please join our Discord server