From: Edward Delaporte Date: Tue, 28 Jul 2026 03:13:29 +0000 (-0500) Subject: cleanup X-Git-Url: https://us-delaporte.pagekite.me/gitweb/matrix-shop-bot.git/commitdiff_plain/a23a70fa486a42c46e818392c6140361d4e4bd59 cleanup --- diff --git a/skill.py b/skill.py index bc99032..428edc4 100644 --- a/skill.py +++ b/skill.py @@ -19,50 +19,29 @@ mcp = FastMCP("Shop Bot") def add_item(name: str) -> str: return '\n'.join(Data().add_item(name)) - -# Configure CORS for browser-based clients -middleware = [ - Middleware( - CORSMiddleware, - allow_origins=["*"], # Allow all origins; use specific origins for security - allow_methods=["GET", "POST", "DELETE", "OPTIONS"], - allow_headers=[ - "mcp-protocol-version", - "mcp-session-id", - "Authorization", - "Content-Type", - ], - expose_headers=["mcp-session-id"], - ) -] - -# if __name__ == "__main__": - - +@mcp.tool +def buy(items:str) -> 'list[str]': + return Data().purchase_items(items) -#@mcp.tool -#def buy(items:str) -> 'list[str]': -# return Data().purchase_items(items) -# -#@mcp.tool -#def list_bought(store:str) -> 'list[str]': -# return Data().list_purchases(store) +@mcp.tool +def list_bought(store:str) -> 'list[str]': + return Data().list_purchases(store) # #@mcp.tool #def clear(store_name: str, clear_all:bool=False) -> 'list[str]': # return Data().clear_list(store_name, clear_all) # # -#@mcp.tool -#def shop_at(store_name:str) -> 'list[str]': -# '''Select store to shop at''' -# return Data().get_shopping_list(store_name) -# -# -#@mcp.tool -#def list() -> 'list[str]': -# '''Use previous store''' -# return Data().get_last_shopping_list() +@mcp.tool +def shop_at(store_name:str) -> 'list[str]': + '''Select store to shop at''' + return Data().get_shopping_list(store_name) + + +@mcp.tool +def list() -> 'list[str]': + '''Use previous store''' + return Data().get_last_shopping_list() # # #@mcp.tool @@ -74,14 +53,26 @@ middleware = [ #def list_purchases(store: str) -> 'list[str]': # return Data().list_purchases(store) -if __name__ == "__main__": -# mcp.run( -# transport="http", -# host=MY_IP, -# stateless_http=True, -# port=9000) +# Configure CORS for browser-based clients +middleware = [ + Middleware( + CORSMiddleware, + allow_origins=["*"], # Allow all origins; use specific origins for security + allow_methods=["GET", "POST", "DELETE", "OPTIONS"], + allow_headers=[ + "mcp-protocol-version", + "mcp-session-id", + "Authorization", + "Content-Type", + ], + expose_headers=["mcp-session-id"], + ) +] + +if __name__ == "__main__": + # Create the ASGI app mcp_app = mcp.http_app( path="/mcp",