wyze_login
Authenticate with your Wyze account to enable control and monitoring of smart home devices through the MCP server.
Instructions
Login to Wyze account using environment variables
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp_wyze_server/server.py:47-57 (handler)The main handler function for the 'wyze_login' tool. It calls get_wyze_client() to login using environment variables WYZE_EMAIL, WYZE_PASSWORD, WYZE_KEY_ID, WYZE_API_KEY and returns success/error status.@mcp.tool() def wyze_login() -> Dict[str, str]: """Login to Wyze account using environment variables""" try: client = get_wyze_client() return {"status": "success", "message": "Successfully logged in to Wyze"} except WyzeClientConfigurationError as e: return {"status": "error", "message": f"Configuration error: {str(e)}"} except Exception as e: return {"status": "error", "message": f"Unexpected error: {str(e)}"}
- src/mcp_wyze_server/server.py:47-47 (registration)The @mcp.tool() decorator registers the wyze_login function as an MCP tool.@mcp.tool()
- src/mcp_wyze_server/server.py:21-44 (helper)Supporting helper function that creates and caches the Wyze Client instance using environment variables, used by wyze_login and other tools.def get_wyze_client() -> Client: """Get or create Wyze client instance with auto-login if credentials available""" global _wyze_client if _wyze_client is None: # Get credentials from environment email = os.getenv("WYZE_EMAIL") password = os.getenv("WYZE_PASSWORD") key_id = os.getenv("WYZE_KEY_ID") api_key = os.getenv("WYZE_API_KEY") if not all([email, password, key_id, api_key]): raise WyzeClientConfigurationError( "Missing required environment variables: WYZE_EMAIL, WYZE_PASSWORD, WYZE_KEY_ID, WYZE_API_KEY" ) _wyze_client = Client( email=email, password=password, key_id=key_id, api_key=api_key ) return _wyze_client