meta-ads-mcp 0.2.4__py3-none-any.whl → 0.2.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ import asyncio
5
5
  from .api import meta_api_tool
6
6
  from .auth import start_callback_server, auth_manager, get_current_access_token
7
7
  from .server import mcp_server
8
- from .utils import logger
8
+ from .utils import logger, META_APP_SECRET
9
9
 
10
10
 
11
11
  @mcp_server.tool()
@@ -46,6 +46,10 @@ async def get_login_link(access_token: str = None) -> str:
46
46
  login_url = auth_manager.get_auth_url()
47
47
  logger.info(f"Generated login URL: {login_url}")
48
48
 
49
+ # Check if we can exchange for long-lived tokens
50
+ token_exchange_supported = bool(META_APP_SECRET)
51
+ token_duration = "60 days" if token_exchange_supported else "1-2 hours"
52
+
49
53
  # Return a special format that helps the LLM format the response properly
50
54
  response = {
51
55
  "login_url": login_url,
@@ -54,6 +58,11 @@ async def get_login_link(access_token: str = None) -> str:
54
58
  "markdown_link": f"[Click here to authenticate with Meta Ads]({login_url})",
55
59
  "message": "IMPORTANT: Please use the Markdown link format in your response to allow the user to click it.",
56
60
  "instructions_for_llm": "You must present this link as clickable Markdown to the user using the markdown_link format provided.",
61
+ "token_exchange": "enabled" if token_exchange_supported else "disabled",
62
+ "token_duration": token_duration,
63
+ "token_exchange_message": f"Your authentication token will be valid for approximately {token_duration}." +
64
+ (" Long-lived token exchange is enabled." if token_exchange_supported else
65
+ " To enable long-lived tokens (60 days), set the META_APP_SECRET environment variable."),
57
66
  "note": "After authenticating, the token will be automatically saved."
58
67
  }
59
68