Skip to main content
Glama

Apple Find My MCP Server

by batteryshark
auth.py1.72 kB
""" Simple iCloud client management. """ from typing import Optional from pyicloud import PyiCloudService from fastmcp import Context from authentication import create_authenticated_client from secrets_manager import secrets_manager class ClientManager: """Manages iCloud client instances.""" def __init__(self): self._client: Optional[PyiCloudService] = None self._authenticated = False async def get_client(self, ctx: Context) -> PyiCloudService: """Get authenticated iCloud client.""" if self._client is None or not self._authenticated: self._client = await create_authenticated_client(ctx) self._authenticated = True return self._client def reset(self) -> None: """Reset authentication state.""" self._client = None self._authenticated = False # Global instance _client_manager = ClientManager() async def get_authenticated_client(ctx: Context) -> PyiCloudService: """Get authenticated iCloud client.""" return await _client_manager.get_client(ctx) def clear_stored_credentials() -> None: """Clear only the stored Apple credentials from secrets manager.""" try: secrets_manager.delete_secret("APPLE_ID") secrets_manager.delete_secret("APPLE_PASSWORD") except Exception: # Ignore errors if secrets don't exist or can't be deleted pass def reset_auth_state_only() -> None: """Reset only the authentication state without clearing stored credentials.""" _client_manager.reset() def reset_auth_state() -> None: """Reset authentication state and clear stored credentials.""" reset_auth_state_only() clear_stored_credentials()

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/batteryshark/mcp-findmy'

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