openboost-cli 2.0.2__py3-none-any.whl → 2.1.0__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.
Files changed (117) hide show
  1. openboost_cli/__init__.py +5 -1
  2. openboost_cli/cli/main.py +167 -33
  3. openboost_cli/client.py +19 -1
  4. openboost_cli/parse_result.py +27 -27
  5. openboost_cli/registry.py +29 -0
  6. openboost_cli/schemas/account/__init__.py +1 -0
  7. openboost_cli/schemas/account/account_catalog.json +17 -0
  8. openboost_cli/schemas/account/account_info.json +8 -0
  9. openboost_cli/schemas/account/account_links.json +8 -0
  10. openboost_cli/schemas/account/account_order_create.json +20 -0
  11. openboost_cli/schemas/account/account_order_status.json +16 -0
  12. openboost_cli/schemas/account/account_orders.json +17 -0
  13. openboost_cli/schemas/amazon/amz_aba_research_trends.json +26 -0
  14. openboost_cli/schemas/amazon/amz_aba_research_weekly.json +132 -0
  15. openboost_cli/schemas/amazon/amz_category_query.json +4 -4
  16. openboost_cli/schemas/amazon/amz_category_query_v2.json +28 -0
  17. openboost_cli/schemas/amazon/amz_google_trends.json +26 -0
  18. openboost_cli/schemas/amazon/amz_hot_amz_hot_cat_tree.json +7 -7
  19. openboost_cli/schemas/amazon/amz_hot_amz_hot_list_v2.json +33 -0
  20. openboost_cli/schemas/amazon/amz_keyword_miner.json +152 -0
  21. openboost_cli/schemas/amazon/amz_keyword_order.json +46 -0
  22. openboost_cli/schemas/amazon/amz_keyword_research.json +148 -0
  23. openboost_cli/schemas/amazon/amz_keyword_research_trends.json +21 -0
  24. openboost_cli/schemas/amazon/amz_market_brand.json +33 -0
  25. openboost_cli/schemas/amazon/amz_market_goods.json +37 -0
  26. openboost_cli/schemas/amazon/amz_market_price.json +17 -12
  27. openboost_cli/schemas/amazon/amz_market_rating.json +33 -0
  28. openboost_cli/schemas/amazon/amz_market_ratings.json +33 -0
  29. openboost_cli/schemas/amazon/amz_market_research.json +260 -0
  30. openboost_cli/schemas/amazon/amz_market_seller.json +33 -0
  31. openboost_cli/schemas/amazon/amz_market_seller_location.json +29 -0
  32. openboost_cli/schemas/amazon/amz_market_seller_type.json +29 -0
  33. openboost_cli/schemas/amazon/amz_market_shelf_time.json +33 -0
  34. openboost_cli/schemas/amazon/amz_market_shelf_trend.json +33 -0
  35. openboost_cli/schemas/amazon/amz_market_statistics.json +36 -0
  36. openboost_cli/schemas/amazon/amz_product_competitor.json +68 -0
  37. openboost_cli/schemas/amazon/amz_product_selection.json +138 -50
  38. openboost_cli/schemas/amazon/amz_research_monthly.json +132 -0
  39. openboost_cli/schemas/amazon/amz_review_query.json +4 -4
  40. openboost_cli/schemas/amazon/amz_sales_prediction_bsr.json +26 -0
  41. openboost_cli/schemas/amazon/amz_sales_query.json +4 -4
  42. openboost_cli/schemas/amazon/amz_sku_query.json +5 -5
  43. openboost_cli/schemas/amazon/amz_traffic_extend.json +153 -0
  44. openboost_cli/schemas/amazon/amz_traffic_keyword.json +157 -0
  45. openboost_cli/schemas/amazon/amz_traffic_keyword_stat.json +25 -0
  46. openboost_cli/schemas/amazon/amz_traffic_listing_page.json +46 -0
  47. openboost_cli/schemas/amazon/amz_traffic_listing_stat.json +21 -0
  48. openboost_cli/schemas/amazon/amz_traffic_source.json +41 -0
  49. openboost_cli/schemas/patent/patent_abstract_image.json +3 -3
  50. openboost_cli/schemas/patent/patent_abstract_translated.json +3 -3
  51. openboost_cli/schemas/patent/patent_bibliography.json +3 -3
  52. openboost_cli/schemas/patent/patent_claim_data.json +3 -3
  53. openboost_cli/schemas/patent/patent_claim_translated.json +3 -3
  54. openboost_cli/schemas/patent/patent_description.json +3 -3
  55. openboost_cli/schemas/patent/patent_description_translated.json +3 -3
  56. openboost_cli/schemas/patent/patent_family.json +3 -3
  57. openboost_cli/schemas/patent/patent_fulltext_image.json +3 -3
  58. openboost_cli/schemas/patent/patent_image_search_multiple.json +9 -6
  59. openboost_cli/schemas/patent/patent_image_search_single.json +9 -6
  60. openboost_cli/schemas/patent/patent_legal_status.json +3 -3
  61. openboost_cli/schemas/patent/patent_pdf.json +3 -3
  62. openboost_cli/schemas/patent/patent_query_count.json +8 -5
  63. openboost_cli/schemas/patent/patent_query_search.json +8 -5
  64. openboost_cli/schemas/patent/patent_query_search_with_agg.json +8 -5
  65. openboost_cli/schemas/patent/patent_semantic_search.json +8 -5
  66. openboost_cli/schemas/social/__init__.py +1 -0
  67. openboost_cli/schemas/social/instagram_fetch_hashtag_posts.json +21 -0
  68. openboost_cli/schemas/social/instagram_fetch_post_comments.json +20 -0
  69. openboost_cli/schemas/social/instagram_fetch_post_info.json +20 -0
  70. openboost_cli/schemas/social/instagram_fetch_reel_info.json +16 -0
  71. openboost_cli/schemas/social/instagram_fetch_user_info.json +20 -0
  72. openboost_cli/schemas/social/instagram_fetch_user_reels.json +21 -0
  73. openboost_cli/schemas/social/reddit_fetch_post_comments.json +24 -0
  74. openboost_cli/schemas/social/reddit_fetch_post_details.json +20 -0
  75. openboost_cli/schemas/social/youtube_fetch_post_comments.json +25 -0
  76. openboost_cli/schemas/social/youtube_fetch_post_info.json +20 -0
  77. openboost_cli/schemas/social/youtube_fetch_user_info.json +20 -0
  78. openboost_cli/schemas/tiktok/tk_expert_sale_show.json +3 -3
  79. openboost_cli/schemas/tiktok/tt_commodity_detail.json +4 -4
  80. openboost_cli/schemas/tiktok/tt_commodity_expert_draw_expert_trend.json +3 -3
  81. openboost_cli/schemas/tiktok/tt_commodity_get_commodity_cat_tree.json +3 -3
  82. openboost_cli/schemas/tiktok/tt_commodity_info_list.json +10 -10
  83. openboost_cli/schemas/tiktok/tt_commodity_sales_trend.json +3 -3
  84. openboost_cli/schemas/tiktok/tt_commodity_statistics_get_category_statistics.json +3 -3
  85. openboost_cli/schemas/tiktok/tt_commodity_statistics_get_expert_statistics.json +3 -3
  86. openboost_cli/schemas/tiktok/tt_commodity_statistics_get_price_statistics.json +10 -10
  87. openboost_cli/schemas/tiktok/tt_commodity_statistics_get_total_statistics.json +9 -5
  88. openboost_cli/schemas/tiktok/tt_commodity_voice_analyze.json +3 -3
  89. openboost_cli/schemas/tiktok/tt_commodity_voice_read.json +41 -0
  90. openboost_cli/schemas/tiktok/tt_expert_basic_analyze.json +3 -3
  91. openboost_cli/schemas/tiktok/tt_expert_category_analyze.json +3 -3
  92. openboost_cli/schemas/tiktok/tt_expert_detail.json +3 -3
  93. openboost_cli/schemas/tiktok/tt_expert_fans_analyze.json +3 -3
  94. openboost_cli/schemas/tiktok/tt_expert_fans_portrait.json +3 -3
  95. openboost_cli/schemas/tiktok/tt_expert_info_list.json +42 -46
  96. openboost_cli/schemas/tiktok/tt_hashtag_list.json +48 -0
  97. openboost_cli/schemas/tiktok/tt_shop_commodity_account_list.json +3 -3
  98. openboost_cli/schemas/tiktok/tt_shop_detail.json +3 -3
  99. openboost_cli/schemas/tiktok/tt_shop_info_list.json +3 -3
  100. openboost_cli/schemas/tiktok/tt_shop_market_info.json +8 -8
  101. openboost_cli/schemas/tiktok/tt_shop_sales_trend.json +3 -3
  102. openboost_cli/schemas/tiktok/tt_video_content.json +3 -3
  103. openboost_cli/schemas/tiktok/tt_video_detail.json +3 -3
  104. openboost_cli/schemas/tiktok/tt_video_info_list.json +3 -3
  105. openboost_cli/schemas/tiktok/tt_video_new_video_summary.json +3 -3
  106. openboost_cli/schemas/tiktok/tt_video_script_diy_query.json +3 -3
  107. openboost_cli/schemas/tiktok/tt_video_voice_read.json +4 -4
  108. openboost_cli/schemas/tiktok/tt_video_voice_summary.json +3 -3
  109. {openboost_cli-2.0.2.dist-info → openboost_cli-2.1.0.dist-info}/METADATA +24 -4
  110. openboost_cli-2.1.0.dist-info/RECORD +124 -0
  111. openboost_cli/schemas/amazon/amz_hot_amz_hot_list.json +0 -33
  112. openboost_cli/schemas/tiktok/tt_sale_channel_sale_channel.json +0 -26
  113. openboost_cli-2.0.2.dist-info/RECORD +0 -76
  114. {openboost_cli-2.0.2.dist-info → openboost_cli-2.1.0.dist-info}/WHEEL +0 -0
  115. {openboost_cli-2.0.2.dist-info → openboost_cli-2.1.0.dist-info}/entry_points.txt +0 -0
  116. {openboost_cli-2.0.2.dist-info → openboost_cli-2.1.0.dist-info}/licenses/LICENSE +0 -0
  117. {openboost_cli-2.0.2.dist-info → openboost_cli-2.1.0.dist-info}/top_level.txt +0 -0
openboost_cli/__init__.py CHANGED
@@ -1,17 +1,21 @@
1
1
  """Unified OpenBoost MCP CLI and Python client."""
2
2
 
3
- __version__ = "2.0.2"
3
+ __version__ = "2.1.0"
4
4
 
5
5
  DEFAULT_BASE_URLS = {
6
6
  "tiktok": "http://mcp.microdata-inc.com/mcp-servers/openboost-all-mcp/sse",
7
7
  "patent": "http://mcp.microdata-inc.com/mcp-servers/openboost-all-mcp/sse",
8
8
  "amazon": "http://mcp.microdata-inc.com/mcp-servers/openboost-all-mcp/sse",
9
+ "social": "http://mcp.microdata-inc.com/mcp-servers/openboost-all-mcp/sse",
10
+ "account": "http://mcp.microdata-inc.com/mcp-servers/openboost-all-mcp/sse",
9
11
  }
10
12
 
11
13
  MCP_LABELS = {
12
14
  "tiktok": "TikTok",
13
15
  "patent": "Patent",
14
16
  "amazon": "Amazon",
17
+ "social": "Social",
18
+ "account": "Account",
15
19
  }
16
20
 
17
21
  MCP_NAMES = tuple(DEFAULT_BASE_URLS.keys())
openboost_cli/cli/main.py CHANGED
@@ -34,7 +34,7 @@ console = Console()
34
34
 
35
35
  app = typer.Typer(
36
36
  name="openboost",
37
- help="OpenBoost CLI — 统一调用 TikTok / Patent / Amazon MCP",
37
+ help="OpenBoost CLI — 统一调用 TikTok / Patent / Amazon / Social MCP 与账号工具",
38
38
  no_args_is_help=False,
39
39
  add_completion=False,
40
40
  )
@@ -52,11 +52,18 @@ patent_image_app = typer.Typer(help="专利图像检索")
52
52
  amazon_app = typer.Typer(help="Amazon MCP")
53
53
  amazon_product_app = typer.Typer(help="Amazon 商品与市场")
54
54
  amazon_hot_app = typer.Typer(help="Amazon 榜单")
55
+ social_app = typer.Typer(help="Social MCP")
56
+ instagram_app = typer.Typer(help="Instagram 实时采集")
57
+ reddit_app = typer.Typer(help="Reddit 实时采集")
58
+ youtube_app = typer.Typer(help="YouTube 实时采集")
59
+ account_app = typer.Typer(help="账号、套餐与订单工具")
55
60
 
56
61
  app.add_typer(config_app, name="config")
57
62
  app.add_typer(tiktok_app, name="tiktok")
58
63
  app.add_typer(patent_app, name="patent")
59
64
  app.add_typer(amazon_app, name="amazon")
65
+ app.add_typer(social_app, name="social")
66
+ app.add_typer(account_app, name="account")
60
67
  tiktok_app.add_typer(tiktok_statistics_app, name="statistics")
61
68
  tiktok_app.add_typer(tiktok_commodity_app, name="commodity")
62
69
  tiktok_app.add_typer(tiktok_expert_app, name="expert")
@@ -67,12 +74,15 @@ patent_app.add_typer(patent_detail_app, name="detail")
67
74
  patent_app.add_typer(patent_image_app, name="image-search")
68
75
  amazon_app.add_typer(amazon_product_app, name="product")
69
76
  amazon_app.add_typer(amazon_hot_app, name="hot")
77
+ social_app.add_typer(instagram_app, name="instagram")
78
+ social_app.add_typer(reddit_app, name="reddit")
79
+ social_app.add_typer(youtube_app, name="youtube")
70
80
 
71
81
  _state: dict[str, str | None] = {"secret_key": None, "base_url": None}
72
82
 
73
83
  KeyOpt = Annotated[Optional[str], typer.Option("--key", "-k", help="secret-key")]
74
84
  BaseUrlOpt = Annotated[Optional[str], typer.Option("--base-url", "-u", help="MCP SSE URL")]
75
- McpArg = Annotated[str, typer.Argument(help="MCP 名称: tiktok / patent / amazon")]
85
+ McpArg = Annotated[str, typer.Argument(help="工具分组: tiktok / patent / amazon / social / account")]
76
86
  CountryOpt = Annotated[str, typer.Option("--country-region", "--country", help="国家/地区,如 美国")]
77
87
  CurrentOpt = Annotated[Optional[int], typer.Option("--current", help="当前页码")]
78
88
  SizeOpt = Annotated[Optional[int], typer.Option("--size", help="每页条数")]
@@ -80,6 +90,7 @@ DataPeriodOpt = Annotated[Optional[str], typer.Option("--data-period", help="数
80
90
  DateOpt = Annotated[Optional[str], typer.Option("--date", help="数据日期")]
81
91
  OrderTypeOpt = Annotated[Optional[str], typer.Option("--order-type", help="排序类型")]
82
92
  ExtraArg = Annotated[Optional[list[str]], typer.Argument(help="额外参数 key=value ...")]
93
+ PriorityOpt = Annotated[Optional[int], typer.Option("--priority", help="采集优先级")]
83
94
 
84
95
 
85
96
  @app.callback(invoke_without_command=True)
@@ -90,23 +101,23 @@ def main_callback(ctx: typer.Context, key: KeyOpt = None, base_url: BaseUrlOpt =
90
101
  interactive.run_interactive(secret_key=key, base_url=base_url)
91
102
 
92
103
 
93
- def _print_json(data: Any) -> None:
94
- if isinstance(data, (dict, list)):
95
- if sys.stdout.isatty():
96
- console.print_json(json.dumps(data, ensure_ascii=False))
97
- else:
98
- sys.stdout.write(json.dumps(data, ensure_ascii=True, separators=(",", ":")) + "\n")
99
- else:
100
- _print_text(str(data))
101
-
102
-
103
- def _print_text(text: str) -> None:
104
- if sys.stdout.isatty():
105
- console.print(text)
106
- else:
107
- sys.stdout.write(text)
108
- if not text.endswith("\n"):
109
- sys.stdout.write("\n")
104
+ def _print_json(data: Any) -> None:
105
+ if isinstance(data, (dict, list)):
106
+ if sys.stdout.isatty():
107
+ console.print_json(json.dumps(data, ensure_ascii=False))
108
+ else:
109
+ sys.stdout.write(json.dumps(data, ensure_ascii=True, separators=(",", ":")) + "\n")
110
+ else:
111
+ _print_text(str(data))
112
+
113
+
114
+ def _print_text(text: str) -> None:
115
+ if sys.stdout.isatty():
116
+ console.print(text)
117
+ else:
118
+ sys.stdout.write(text)
119
+ if not text.endswith("\n"):
120
+ sys.stdout.write("\n")
110
121
 
111
122
 
112
123
  def _props(mcp: str, tool_name: str) -> dict[str, Any]:
@@ -149,9 +160,9 @@ def _run_tool(mcp: str, tool_name: str, arguments: dict[str, Any], *, verbatim:
149
160
  console.print(str(exc), style="red")
150
161
  raise typer.Exit(2) from exc
151
162
 
152
- text = extract_result_text(result)
153
- if verbatim:
154
- _print_text(text)
163
+ text = extract_result_text(result)
164
+ if verbatim:
165
+ _print_text(text)
155
166
  raise typer.Exit(3 if result.isError else 0)
156
167
  if result.isError:
157
168
  console.print(text or "(tool error)", style="red")
@@ -160,10 +171,10 @@ def _run_tool(mcp: str, tool_name: str, arguments: dict[str, Any], *, verbatim:
160
171
  if isinstance(structured, (dict, list)):
161
172
  _print_json(structured)
162
173
  return
163
- try:
164
- _print_json(decode_embedded_payload(text))
165
- except ValueError:
166
- _print_text(text)
174
+ try:
175
+ _print_json(decode_embedded_payload(text))
176
+ except ValueError:
177
+ _print_text(text)
167
178
 
168
179
 
169
180
  @app.command("version")
@@ -181,7 +192,7 @@ def tui_cmd() -> None:
181
192
  @config_app.command("set")
182
193
  def config_set_cmd(
183
194
  secret_key: Annotated[Optional[str], typer.Option("--secret-key", "-k", help="secret-key")] = None,
184
- mcp: Annotated[Optional[str], typer.Option("--mcp", help="仅配置某个 MCP: tiktok / patent / amazon")] = None,
195
+ mcp: Annotated[Optional[str], typer.Option("--mcp", help="仅配置某个分组: tiktok / patent / amazon / social / account")] = None,
185
196
  base_url: BaseUrlOpt = None,
186
197
  ) -> None:
187
198
  """保存通用或单 MCP 配置"""
@@ -333,11 +344,6 @@ def tiktok_commodity_voice(commodity_id: Annotated[str, typer.Argument(help="商
333
344
  _run_tool("tiktok", "tt_commodity_voice_analyze", {"countryRegion": country_region, "commodityId": commodity_id, "size": size})
334
345
 
335
346
 
336
- @tiktok_commodity_app.command("channel")
337
- def tiktok_commodity_channel(product_id: Annotated[str, typer.Argument(help="商品 ID")], country_region: CountryOpt = "美国", sale_type: Annotated[int, typer.Option("--sale-type")] = 1) -> None:
338
- _run_tool("tiktok", "tt_sale_channel_sale_channel", {"countryRegion": country_region, "productId": product_id, "saleType": sale_type})
339
-
340
-
341
347
  @tiktok_commodity_app.command("expert-trend")
342
348
  def tiktok_commodity_expert_trend(commodity_id: Annotated[str, typer.Argument(help="商品 ID")], country_region: CountryOpt = "美国") -> None:
343
349
  _run_tool("tiktok", "tt_commodity_expert_draw_expert_trend", {"countryRegion": country_region, "commodityId": commodity_id})
@@ -563,7 +569,7 @@ def amazon_product_price(node_id: Annotated[str, typer.Argument(help="类目节
563
569
 
564
570
  @amazon_hot_app.command("list")
565
571
  def amazon_hot_list(web_site_id: Annotated[str, typer.Option("--web-site-id", "--site")], rank_type: Annotated[str, typer.Option("--rank-type")], cat_id: Annotated[Optional[str], typer.Option("--cat-id")] = None, current_page: Annotated[int, typer.Option("--current-page")] = 1, page_size: Annotated[int, typer.Option("--page-size")] = 10) -> None:
566
- _run_tool("amazon", "amz_hot_amz_hot_list", {"webSiteId": web_site_id, "rankType": rank_type, "catId": cat_id, "currentPage": current_page, "pageSize": page_size})
572
+ _run_tool("amazon", "amz_hot_amz_hot_list_v2", {"webSiteId": web_site_id, "rankType": rank_type, "catId": cat_id, "currentPage": current_page, "pageSize": page_size})
567
573
 
568
574
 
569
575
  @amazon_hot_app.command("cat-tree")
@@ -571,6 +577,134 @@ def amazon_hot_cat_tree(web_site_id: Annotated[str, typer.Option("--web-site-id"
571
577
  _run_tool("amazon", "amz_hot_amz_hot_cat_tree", {"webSiteId": web_site_id, "rankType": rank_type, "keyword": keyword})
572
578
 
573
579
 
580
+ # Social shortcuts
581
+ @instagram_app.command("hashtag-posts")
582
+ def instagram_hashtag_posts(
583
+ hashtag: Annotated[str, typer.Argument(help="话题标签,不含 #")],
584
+ max_pages: Annotated[int, typer.Option("--max-pages")],
585
+ ) -> None:
586
+ _run_tool("social", "instagram_fetch_hashtag_posts", {"hashtag": hashtag, "max_pages": max_pages})
587
+
588
+
589
+ @instagram_app.command("post-comments")
590
+ def instagram_post_comments(
591
+ post_id: Annotated[str, typer.Argument(help="帖子 shortcode")],
592
+ priority: PriorityOpt = None,
593
+ ) -> None:
594
+ _run_tool("social", "instagram_fetch_post_comments", {"post_id": post_id, "priority": priority})
595
+
596
+
597
+ @instagram_app.command("post-info")
598
+ def instagram_post_info(
599
+ post_id: Annotated[str, typer.Argument(help="帖子 shortcode")],
600
+ priority: PriorityOpt = None,
601
+ ) -> None:
602
+ _run_tool("social", "instagram_fetch_post_info", {"post_id": post_id, "priority": priority})
603
+
604
+
605
+ @instagram_app.command("reel-info")
606
+ def instagram_reel_info(post_id: Annotated[str, typer.Argument(help="Reel shortcode")]) -> None:
607
+ _run_tool("social", "instagram_fetch_reel_info", {"post_id": post_id})
608
+
609
+
610
+ @instagram_app.command("user-info")
611
+ def instagram_user_info(
612
+ user_id: Annotated[str, typer.Argument(help="Instagram 用户数字 ID")],
613
+ priority: PriorityOpt = None,
614
+ ) -> None:
615
+ _run_tool("social", "instagram_fetch_user_info", {"user_id": user_id, "priority": priority})
616
+
617
+
618
+ @instagram_app.command("user-reels")
619
+ def instagram_user_reels(
620
+ user_id: Annotated[str, typer.Argument(help="Instagram 用户数字 ID")],
621
+ max_pages: Annotated[int, typer.Option("--max-pages")],
622
+ ) -> None:
623
+ _run_tool("social", "instagram_fetch_user_reels", {"user_id": user_id, "max_pages": max_pages})
624
+
625
+
626
+ @reddit_app.command("post-comments")
627
+ def reddit_post_comments(
628
+ media_url: Annotated[str, typer.Argument(help="Reddit 帖子 URL")],
629
+ sort: Annotated[Optional[str], typer.Option("--sort")] = None,
630
+ priority: PriorityOpt = None,
631
+ ) -> None:
632
+ _run_tool("social", "reddit_fetch_post_comments", {"media_url": media_url, "sort": sort, "priority": priority})
633
+
634
+
635
+ @reddit_app.command("post-details")
636
+ def reddit_post_details(
637
+ media_url: Annotated[str, typer.Argument(help="Reddit 帖子 URL")],
638
+ priority: PriorityOpt = None,
639
+ ) -> None:
640
+ _run_tool("social", "reddit_fetch_post_details", {"media_url": media_url, "priority": priority})
641
+
642
+
643
+ @youtube_app.command("post-info")
644
+ def youtube_post_info(
645
+ media_id: Annotated[str, typer.Argument(help="YouTube 视频 ID")],
646
+ priority: PriorityOpt = None,
647
+ ) -> None:
648
+ _run_tool("social", "youtube_fetch_post_info", {"media_id": media_id, "priority": priority})
649
+
650
+
651
+ @youtube_app.command("post-comments")
652
+ def youtube_post_comments(
653
+ media_id: Annotated[str, typer.Argument(help="YouTube 视频 ID")],
654
+ review_token: Annotated[str, typer.Option("--review-token", help="由 post-info 返回")],
655
+ priority: PriorityOpt = None,
656
+ ) -> None:
657
+ _run_tool("social", "youtube_fetch_post_comments", {"media_id": media_id, "review_token": review_token, "priority": priority})
658
+
659
+
660
+ @youtube_app.command("user-info")
661
+ def youtube_user_info(
662
+ author_id: Annotated[str, typer.Argument(help="UC 开头的频道 ID")],
663
+ priority: PriorityOpt = None,
664
+ ) -> None:
665
+ _run_tool("social", "youtube_fetch_user_info", {"author_id": author_id, "priority": priority})
666
+
667
+
668
+ # Account shortcuts
669
+ @account_app.command("catalog")
670
+ def account_catalog(
671
+ scope: Annotated[Optional[str], typer.Option("--scope", help="all / mcp / api")] = None,
672
+ platform: Annotated[Optional[str], typer.Option("--platform", help="amazon / tiktok / patent / social")] = None,
673
+ ) -> None:
674
+ _run_tool("account", "account_catalog", {"scope": scope, "platform": platform})
675
+
676
+
677
+ @account_app.command("info")
678
+ def account_info() -> None:
679
+ _run_tool("account", "account_info", {})
680
+
681
+
682
+ @account_app.command("links")
683
+ def account_links() -> None:
684
+ _run_tool("account", "account_links", {})
685
+
686
+
687
+ @account_app.command("order-create")
688
+ def account_order_create(
689
+ plan_id: Annotated[str, typer.Argument(help="套餐 planId")],
690
+ payment_method: Annotated[Optional[str], typer.Option("--payment-method")] = None,
691
+ ) -> None:
692
+ _run_tool("account", "account_order_create", {"planId": plan_id, "paymentMethod": payment_method})
693
+
694
+
695
+ @account_app.command("order-status")
696
+ def account_order_status(mch_order_no: Annotated[str, typer.Argument(help="商户订单号")]) -> None:
697
+ _run_tool("account", "account_order_status", {"mchOrderNo": mch_order_no})
698
+
699
+
700
+ @account_app.command("orders")
701
+ def account_orders(
702
+ page: Annotated[Optional[int], typer.Option("--page")] = None,
703
+ page_size: Annotated[Optional[int], typer.Option("--page-size")] = None,
704
+ ) -> None:
705
+ _run_tool("account", "account_orders", {"page": page, "pageSize": page_size})
706
+
707
+
574
708
  def main() -> None:
575
709
  app()
576
710
 
openboost_cli/client.py CHANGED
@@ -6,7 +6,7 @@ from openboost_cli.mcp_client import McpClient
6
6
 
7
7
 
8
8
  class OpenBoost:
9
- """Unified Python client for OpenBoost MCP servers.
9
+ """Unified Python client for OpenBoost MCP tools.
10
10
 
11
11
  Usage:
12
12
 
@@ -16,6 +16,8 @@ class OpenBoost:
16
16
  client.tiktok.tt_video_content(countryRegion="美国", videoId="...")
17
17
  client.patent.patent_query_search(query_text="TACD: virtual reality")
18
18
  client.amazon.amz_product_selection(webSiteId="1")
19
+ client.social.youtube_fetch_post_info(media_id="...")
20
+ client.account.account_info()
19
21
  """
20
22
 
21
23
  def __init__(
@@ -25,9 +27,13 @@ class OpenBoost:
25
27
  tiktok_secret_key: str | None = None,
26
28
  patent_secret_key: str | None = None,
27
29
  amazon_secret_key: str | None = None,
30
+ social_secret_key: str | None = None,
31
+ account_secret_key: str | None = None,
28
32
  tiktok_base_url: str | None = None,
29
33
  patent_base_url: str | None = None,
30
34
  amazon_base_url: str | None = None,
35
+ social_base_url: str | None = None,
36
+ account_base_url: str | None = None,
31
37
  connect_timeout_sec: float = 30,
32
38
  read_timeout_sec: float = 300,
33
39
  ) -> None:
@@ -53,6 +59,18 @@ class OpenBoost:
53
59
  base_url=amazon_base_url,
54
60
  **shared,
55
61
  )
62
+ self.social = McpClient(
63
+ "social",
64
+ secret_key=social_secret_key or secret_key,
65
+ base_url=social_base_url,
66
+ **shared,
67
+ )
68
+ self.account = McpClient(
69
+ "account",
70
+ secret_key=account_secret_key or secret_key,
71
+ base_url=account_base_url,
72
+ **shared,
73
+ )
56
74
 
57
75
  def client(self, mcp: str) -> McpClient:
58
76
  return getattr(self, mcp)
@@ -5,25 +5,25 @@ import re
5
5
  from typing import Any
6
6
 
7
7
  _JSON_FENCE_RE = re.compile(r"```(?:json)?\s*([\s\S]*?)```", re.IGNORECASE)
8
- _MARKER = "响应数据(JSON)"
9
-
10
-
11
- def _loads_json(text: str) -> Any:
12
- value = json.loads(text)
13
- for _ in range(4):
14
- if not isinstance(value, str):
15
- break
16
- nested = value.strip()
17
- if not nested.startswith(("{", "[")):
18
- break
19
- try:
20
- value = json.loads(nested)
21
- except json.JSONDecodeError:
22
- break
23
- return value
24
-
25
-
26
- def _last_longest_json_value(text: str) -> tuple[Any | None, int]:
8
+ _MARKER = "响应数据(JSON)"
9
+
10
+
11
+ def _loads_json(text: str) -> Any:
12
+ value = json.loads(text)
13
+ for _ in range(4):
14
+ if not isinstance(value, str):
15
+ break
16
+ nested = value.strip()
17
+ if not nested.startswith(("{", "[")):
18
+ break
19
+ try:
20
+ value = json.loads(nested)
21
+ except json.JSONDecodeError:
22
+ break
23
+ return value
24
+
25
+
26
+ def _last_longest_json_value(text: str) -> tuple[Any | None, int]:
27
27
  decoder = json.JSONDecoder()
28
28
  best: Any | None = None
29
29
  best_len = -1
@@ -40,25 +40,25 @@ def _last_longest_json_value(text: str) -> tuple[Any | None, int]:
40
40
  return best, best_len
41
41
 
42
42
 
43
- def decode_embedded_payload(text: str) -> Any:
44
- stripped = text.strip()
45
- try:
46
- return _loads_json(stripped)
43
+ def decode_embedded_payload(text: str) -> Any:
44
+ stripped = text.strip()
45
+ try:
46
+ return _loads_json(stripped)
47
47
  except json.JSONDecodeError:
48
48
  pass
49
49
 
50
50
  marker_idx = text.find(_MARKER)
51
51
  if marker_idx >= 0:
52
- tail = text[marker_idx + len(_MARKER) :].lstrip("\n:")
52
+ tail = text[marker_idx + len(_MARKER) :].lstrip("\n:")
53
53
  try:
54
54
  return decode_embedded_payload(tail)
55
55
  except ValueError:
56
56
  pass
57
57
 
58
58
  for match in _JSON_FENCE_RE.finditer(text):
59
- block = match.group(1).strip()
60
- try:
61
- return _loads_json(block)
59
+ block = match.group(1).strip()
60
+ try:
61
+ return _loads_json(block)
62
62
  except json.JSONDecodeError:
63
63
  continue
64
64
 
openboost_cli/registry.py CHANGED
@@ -34,6 +34,20 @@ DOMAIN_LABELS: dict[str, dict[str, str]] = {
34
34
  "amazon": {
35
35
  "product": "商品与市场",
36
36
  "hot": "榜单",
37
+ "keyword": "关键词研究",
38
+ "market": "市场分析",
39
+ "traffic": "流量分析",
40
+ "aba": "ABA 数据",
41
+ "other": "其它",
42
+ },
43
+ "social": {
44
+ "instagram": "Instagram",
45
+ "reddit": "Reddit",
46
+ "youtube": "YouTube",
47
+ "other": "其它",
48
+ },
49
+ "account": {
50
+ "account": "账号与套餐",
37
51
  "other": "其它",
38
52
  },
39
53
  }
@@ -61,7 +75,22 @@ def domain_for(mcp: str, tool_name: str) -> str:
61
75
  if mcp == "amazon":
62
76
  if tool_name.startswith("amz_hot_"):
63
77
  return "hot"
78
+ if tool_name.startswith(("amz_keyword_", "amz_google_trends")):
79
+ return "keyword"
80
+ if tool_name.startswith("amz_market_"):
81
+ return "market"
82
+ if tool_name.startswith("amz_traffic_"):
83
+ return "traffic"
84
+ if tool_name.startswith(("amz_aba_", "amz_research_")):
85
+ return "aba"
64
86
  return "product"
87
+ if mcp == "social":
88
+ for platform in ("instagram", "reddit", "youtube"):
89
+ if tool_name.startswith(f"{platform}_"):
90
+ return platform
91
+ return "other"
92
+ if mcp == "account":
93
+ return "account" if tool_name.startswith("account_") else "other"
65
94
  return "other"
66
95
 
67
96
 
@@ -0,0 +1 @@
1
+ """Bundled OpenBoost tool schemas."""
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "account_catalog",
3
+ "description": "查询可购买套餐目录。可选 scope(all/mcp/api)、platform(amazon/tiktok/patent/social)。",
4
+ "arguments": {
5
+ "properties": {
6
+ "platform": {
7
+ "description": "amazon / tiktok / patent / social,缺省为全部平台",
8
+ "type": "string"
9
+ },
10
+ "scope": {
11
+ "description": "all / mcp / api,默认 all",
12
+ "type": "string"
13
+ }
14
+ },
15
+ "type": "object"
16
+ }
17
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "account_info",
3
+ "description": "查询当前登录账号已开通的 MCP/API 服务、套餐状态和剩余额度。用户问账号、余额、额度、订阅时调用。",
4
+ "arguments": {
5
+ "properties": {},
6
+ "type": "object"
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "account_links",
3
+ "description": "获取官网首页、价格、目录、企业微信客服二维码链接。",
4
+ "arguments": {
5
+ "properties": {},
6
+ "type": "object"
7
+ }
8
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "account_order_create",
3
+ "description": "按 planId 下单并返回支付链接/二维码。paymentMethod 缺省 WX_NATIVE。",
4
+ "arguments": {
5
+ "properties": {
6
+ "paymentMethod": {
7
+ "description": "支付方式,默认 WX_NATIVE",
8
+ "type": "string"
9
+ },
10
+ "planId": {
11
+ "description": "套餐 Plan ID,须先调 account_catalog 取得",
12
+ "type": "string"
13
+ }
14
+ },
15
+ "required": [
16
+ "planId"
17
+ ],
18
+ "type": "object"
19
+ }
20
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "account_order_status",
3
+ "description": "按商户订单号查询支付状态。mchOrderNo 来自 account_order_create。",
4
+ "arguments": {
5
+ "properties": {
6
+ "mchOrderNo": {
7
+ "description": "商户订单号 mchOrderNo",
8
+ "type": "string"
9
+ }
10
+ },
11
+ "required": [
12
+ "mchOrderNo"
13
+ ],
14
+ "type": "object"
15
+ }
16
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "account_orders",
3
+ "description": "分页查询当前账号支付订单列表。",
4
+ "arguments": {
5
+ "properties": {
6
+ "page": {
7
+ "description": "页码,默认 1",
8
+ "type": "integer"
9
+ },
10
+ "pageSize": {
11
+ "description": "每页条数,默认 10",
12
+ "type": "integer"
13
+ }
14
+ },
15
+ "type": "object"
16
+ }
17
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "amz_aba_research_trends",
3
+ "description": "按站点、关键词、时间粒度查询 Amazon ABA 关键词排名趋势。timeGranularity=M 返回月排名趋势 monthRankJson,=W 返回周排名趋势 weekRankJson",
4
+ "arguments": {
5
+ "properties": {
6
+ "keyword": {
7
+ "description": "关键词,如 toy sharks",
8
+ "type": "string"
9
+ },
10
+ "timeGranularity": {
11
+ "description": "时间粒度:W=周(返回 weekRankJson),M=月(返回 monthRankJson)",
12
+ "type": "string"
13
+ },
14
+ "webSiteId": {
15
+ "description": "市场站点 ID。常用:1=us,2=gb,3=de,4=fr,5=jp,6=ca,8=it,9=es,10=in,11=mx,12=au,13=br,17=pl,21=ae,22=sa,23=eg",
16
+ "type": "string"
17
+ }
18
+ },
19
+ "required": [
20
+ "webSiteId",
21
+ "keyword",
22
+ "timeGranularity"
23
+ ],
24
+ "type": "object"
25
+ }
26
+ }