diff --git a/server.py b/server.py index 3abe7ae..0f7d15a 100644 --- a/server.py +++ b/server.py @@ -94,6 +94,23 @@ async def get_morningstar_data(ticker: str, debug: bool = False) -> str: result = await api.get_morningstar_data(ticker, debug=debug) return json.dumps(result) +@mcp.tool() +async def upload_cookies(cookies_json: str) -> str: + """Upload session cookies to the server to assist with authentication. + + Args: + cookies_json: JSON string of cookies exported from a browser (Playwright format) + """ + try: + # Validate JSON + cookies = json.loads(cookies_json) + # Write to cookies.json + with open("cookies.json", "w") as f: + json.dump(cookies, f) + return json.dumps({"status": "success", "message": "cookies.json updated successfully"}) + except Exception as e: + return json.dumps({"status": "error", "message": str(e)}) + @mcp.tool() async def api_call(endpoint: str, method: str = "GET", params: str = "{}") -> str: """Executes a raw API call to the Schwab service (Dummy implementation).