meta-ads-mcp 0.1.0__tar.gz → 0.2.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meta-ads-mcp
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Model Calling Protocol (MCP) plugin for interacting with Meta Ads API
5
5
  Project-URL: Homepage, https://github.com/nictuku/meta-ads-mcp
6
6
  Project-URL: Bug Tracker, https://github.com/nictuku/meta-ads-mcp/issues
@@ -1,9 +1,9 @@
1
1
  """Meta Ads MCP - Model Calling Protocol plugin for Meta Ads API."""
2
2
 
3
- __version__ = "0.1.0"
3
+ __version__ = "0.2.0"
4
4
 
5
5
  # Import key functions to make them available at package level
6
- from .meta_ads_generated import (
6
+ from .api import (
7
7
  get_ad_accounts,
8
8
  get_account_info,
9
9
  get_campaigns,
@@ -18,4 +18,10 @@ from .meta_ads_generated import (
18
18
  get_insights,
19
19
  get_login_link,
20
20
  login_cli,
21
- )
21
+ main, # Import main function for entry point
22
+ )
23
+
24
+ # Define a main function to be used as a package entry point
25
+ def entrypoint():
26
+ """Main entry point for the package when invoked with uvx."""
27
+ return main()
@@ -298,6 +298,9 @@ class AuthManager:
298
298
  except Exception as e:
299
299
  print(f"Error removing cached token: {e}")
300
300
 
301
+ def clear_token(self) -> None:
302
+ """Clear the current token and remove from cache"""
303
+ self.invalidate_token()
301
304
 
302
305
  # Initialize auth manager
303
306
  auth_manager = AuthManager(META_APP_ID)
@@ -1820,7 +1823,35 @@ def start_callback_server():
1820
1823
  return start_callback_server() # Recursive call with a new port
1821
1824
  raise e
1822
1825
 
1823
- if __name__ == "__main__":
1826
+ def login_cli():
1827
+ """
1828
+ Command line entry point for just the login function.
1829
+ """
1830
+ # Set up command line arguments
1831
+ parser = argparse.ArgumentParser(description="Meta Ads Login Utility")
1832
+ parser.add_argument("--app-id", type=str, help="Meta App ID (Client ID) for authentication")
1833
+ parser.add_argument("--force-login", action="store_true", help="Force a new login even if a token exists")
1834
+
1835
+ args = parser.parse_args()
1836
+
1837
+ # Update app ID if provided
1838
+ if args.app_id:
1839
+ auth_manager.app_id = args.app_id
1840
+
1841
+ if args.force_login:
1842
+ # Clear existing token
1843
+ auth_manager.clear_token()
1844
+
1845
+ # Perform login
1846
+ login()
1847
+
1848
+ return 0
1849
+
1850
+ def main():
1851
+ """
1852
+ Main entry point for the Meta Ads MCP server.
1853
+ This function handles command line arguments and runs the server.
1854
+ """
1824
1855
  # Set up command line arguments
1825
1856
  parser = argparse.ArgumentParser(description="Meta Ads MCP Server")
1826
1857
  parser.add_argument("--login", action="store_true", help="Authenticate with Meta and store the token")
@@ -1837,4 +1868,10 @@ if __name__ == "__main__":
1837
1868
  login()
1838
1869
  else:
1839
1870
  # Initialize and run the server
1840
- mcp_server.run(transport='stdio')
1871
+ mcp_server.run(transport='stdio')
1872
+
1873
+ return 0
1874
+
1875
+ # Modify the if __name__ block to use the main function
1876
+ if __name__ == "__main__":
1877
+ main()
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "meta-ads-mcp"
7
- version = "0.1.0"
7
+ version = "0.2.0"
8
8
  description = "Model Calling Protocol (MCP) plugin for interacting with Meta Ads API"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -32,7 +32,8 @@ dependencies = [
32
32
  "Bug Tracker" = "https://github.com/nictuku/meta-ads-mcp/issues"
33
33
 
34
34
  [project.scripts]
35
- meta-ads-login = "meta_ads_mcp.meta_ads_generated:login_cli"
35
+ meta-ads-mcp = "meta_ads_mcp:entrypoint"
36
+ meta-ads-login = "meta_ads_mcp.api:login_cli"
36
37
 
37
38
  [tool.hatch.build.targets.wheel]
38
39
  packages = ["meta_ads_mcp"]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes