Add upload_cookies tool for manual session provision
All checks were successful
Build and Push Docker Image / build (push) Successful in 30s

This commit is contained in:
2026-04-24 01:54:45 +00:00
parent 650ea2d087
commit 5f038b753f

View File

@@ -94,6 +94,23 @@ async def get_morningstar_data(ticker: str, debug: bool = False) -> str:
result = await api.get_morningstar_data(ticker, debug=debug) result = await api.get_morningstar_data(ticker, debug=debug)
return json.dumps(result) 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() @mcp.tool()
async def api_call(endpoint: str, method: str = "GET", params: str = "{}") -> str: async def api_call(endpoint: str, method: str = "GET", params: str = "{}") -> str:
"""Executes a raw API call to the Schwab service (Dummy implementation). """Executes a raw API call to the Schwab service (Dummy implementation).