@roxybrowser/openapi 1.0.13-beta.1 → 1.0.13-beta.3

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.
package/lib/cli.cjs CHANGED
@@ -544,6 +544,26 @@ var channelList = [
544
544
  value: "http://ipinfo.io"
545
545
  }
546
546
  ];
547
+ function formatProxySource(dataType) {
548
+ return dataType === "proxyModule" ? "user-added" : dataType === "buyProxy" ? "proxy store" : dataType || "unknown";
549
+ }
550
+ function formatCheckStatus(checkStatus) {
551
+ return checkStatus === 1 ? "\u2705 available" : "\u274C unavailable";
552
+ }
553
+ function formatValue(value) {
554
+ if (value === null || value === void 0 || value === "")
555
+ return "N/A";
556
+ if (Array.isArray(value))
557
+ return value.length > 0 ? value.join(", ") : "N/A";
558
+ return String(value);
559
+ }
560
+ function formatBool(value, truthy = "yes", falsy = "no") {
561
+ return value ? truthy : falsy;
562
+ }
563
+ function formatLocation(proxy) {
564
+ const locationParts = [proxy.lastCity, proxy.lastState, proxy.lastCountry].filter(Boolean);
565
+ return locationParts.length > 0 ? locationParts.join(", ") : "N/A";
566
+ }
547
567
  var ProxyList = class {
548
568
  name = "roxy_list_proxies";
549
569
  description = "Get list of proxy IP List.";
@@ -554,9 +574,31 @@ var ProxyList = class {
554
574
  type: "number",
555
575
  description: "Workspace ID"
556
576
  },
557
- proxyType: {
577
+ country: {
578
+ type: "string",
579
+ description: "Filter by country (us,cn,jp)"
580
+ },
581
+ checkStatus: {
558
582
  type: "number",
559
- description: "Filter by proxy ID"
583
+ description: "Filter by check status (0: unavailable, 1: available)"
584
+ },
585
+ startDate: {
586
+ type: "string",
587
+ description: "Filter by detection start date (YYYY-MM-DD)"
588
+ },
589
+ endDate: {
590
+ type: "string",
591
+ description: "Filter by detection end date (YYYY-MM-DD)"
592
+ },
593
+ checker: {
594
+ type: "string",
595
+ enum: channelList.map((item) => item.label),
596
+ description: "Filter by detection channel"
597
+ },
598
+ proxyType: {
599
+ type: "string",
600
+ enum: ["user-added", "proxy store"],
601
+ description: "Filter by proxy source type"
560
602
  },
561
603
  pageIndex: {
562
604
  type: "number",
@@ -581,12 +623,22 @@ var ProxyList = class {
581
623
  async handle(params) {
582
624
  const searchParams = new URLSearchParams();
583
625
  searchParams.append("workspaceId", params.workspaceId.toString());
584
- if (params.id)
585
- searchParams.append("id", params.id.toString());
586
626
  if (params.pageIndex)
587
627
  searchParams.append("page_index", params.pageIndex.toString());
588
628
  if (params.pageSize)
589
629
  searchParams.append("page_size", params.pageSize.toString());
630
+ if (params.country)
631
+ searchParams.append("country", params.country);
632
+ if (params.checkStatus !== void 0)
633
+ searchParams.append("check_status", params.checkStatus.toString());
634
+ if (params.startDate)
635
+ searchParams.append("start_date", params.startDate);
636
+ if (params.endDate)
637
+ searchParams.append("end_date", params.endDate);
638
+ if (params.checker)
639
+ searchParams.append("checker", params.checker);
640
+ if (params.proxyType)
641
+ searchParams.append("proxyType", params.proxyType === "user-added" ? "0" : "1");
590
642
  if (!params.workspaceId) {
591
643
  throw new Error("workspaceId is required");
592
644
  }
@@ -599,8 +651,8 @@ var ProxyList = class {
599
651
  const totalPages = Math.max(1, Math.ceil((data.total || 0) / pageSize));
600
652
  const hasNextPage = currentPage < totalPages;
601
653
  const proxyListText = data.rows.length > 0 ? data.rows.map((proxy, index) => {
602
- const statusText = proxy.checkStatus === 1 ? "\u2705 available" : proxy.checkStatus === 2 ? "\u274C unavailable" : "\u23F3 not checked";
603
- const sourceType = proxy.dataType === "proxyModule" ? "user-added" : proxy.dataType === "buyProxy" ? "proxy store" : proxy.dataType || "unknown";
654
+ const statusText = formatCheckStatus(proxy.checkStatus);
655
+ const sourceType = proxy.dataType === "proxyModule" ? "user-added" : "proxy store";
604
656
  const canDelete = proxy.dataType === "proxyModule" ? "yes" : "no";
605
657
  const name = `proxy (id: ${proxy.id}) ${proxy.remark ? `remark: ${proxy.remark}` : ""}`;
606
658
  const location = proxy.lastCountry ? `${proxy.lastCity || ""}${proxy.lastCity && proxy.lastCountry ? ", " : ""}${proxy.lastCountry}` : null;
@@ -646,6 +698,129 @@ ${result.msg}`;
646
698
  return { content: [{ type: "text", text }] };
647
699
  }
648
700
  };
701
+ var GetProxyDetail = class {
702
+ name = "roxy_proxy_detail";
703
+ description = "Get detailed information for a specific proxy configuration";
704
+ inputSchema = {
705
+ type: "object",
706
+ properties: {
707
+ workspaceId: {
708
+ type: "number",
709
+ description: "Workspace ID"
710
+ },
711
+ id: {
712
+ type: "number",
713
+ description: "Proxy ID to get detail for"
714
+ }
715
+ },
716
+ required: ["workspaceId", "id"]
717
+ };
718
+ get schema() {
719
+ return {
720
+ name: this.name,
721
+ description: this.description,
722
+ inputSchema: this.inputSchema
723
+ };
724
+ }
725
+ async handle(params) {
726
+ if (!params.workspaceId || !params.id) {
727
+ return {
728
+ content: [
729
+ {
730
+ type: "text",
731
+ text: "\u274C **Failed to get proxy detail:**\n\n workspaceId and id are required"
732
+ }
733
+ ]
734
+ };
735
+ }
736
+ const searchParams = new URLSearchParams();
737
+ searchParams.append("workspaceId", params.workspaceId.toString());
738
+ searchParams.append("id", params.id.toString());
739
+ const result = await request(`/proxy/detail?${searchParams}`);
740
+ let text = "";
741
+ if (result.code !== 0) {
742
+ text = `\u274C **Failed to get proxy detail:**
743
+
744
+ error message: ${result.msg}`;
745
+ } else {
746
+ const detail = result.data?.rows?.[0] || result.data || null;
747
+ if (!detail) {
748
+ text = `\u274C **Proxy Not Found**
749
+
750
+ No proxy detail found for ID ${params.id} in workspace ${params.workspaceId}.`;
751
+ } else {
752
+ const sourceType = formatProxySource(detail.dataType);
753
+ const sourceSpecificTitle = detail.dataType === "buyProxy" ? "Store Purchase Fields" : "User-added Fields";
754
+ const authText = detail.proxyUserName && detail.proxyPassword ? `${detail.proxyUserName}:${detail.proxyPassword}` : detail.proxyUserName || detail.proxyPassword || "N/A";
755
+ const commonLines = [
756
+ `**ID:** ${formatValue(detail.id)}`,
757
+ `**Source Type:** ${sourceType}`,
758
+ `**Workspace ID:** ${formatValue(detail.workspaceId)}`,
759
+ `**User ID:** ${formatValue(detail.userId)}`,
760
+ `**Remark:** ${formatValue(detail.remark)}`,
761
+ `**Protocol:** ${formatValue(detail.protocol)}`,
762
+ `**Host:** ${formatValue(detail.host)}`,
763
+ `**Port:** ${formatValue(detail.port)}`,
764
+ `**IP Type:** ${formatValue(detail.ipType)}`,
765
+ `**Proxy Account:** ${authText}`,
766
+ `**Bind Status:** ${formatBool(detail.isBind, "bound", "not bound")}`,
767
+ `**Bind Count:** ${formatValue(detail.bindCount)}`,
768
+ `**Bound Browser IDs:** ${formatValue(detail.bindList)}`,
769
+ `**Direct Connection:** ${formatBool(detail.isDirect)}`,
770
+ `**Check Status:** ${formatCheckStatus(detail.checkStatus)}`,
771
+ `**Check Channel:** ${formatValue(detail.checkChannel)}`,
772
+ `**Check Channel Value:** ${formatValue(detail.checkChannelValue)}`,
773
+ `**Last Check Time:** ${formatValue(detail.checkTime)}`,
774
+ `**Last IP:** ${formatValue(detail.lastIp)}`,
775
+ `**Last Location:** ${formatLocation(detail)}`,
776
+ `**Created At:** ${formatValue(detail.createTime)}`,
777
+ `**Updated At:** ${formatValue(detail.updateTime)}`
778
+ ];
779
+ const userAddedLines = [
780
+ `**Refresh URL:** ${formatValue(detail.refreshUrl)}`,
781
+ `**Model Param:** ${formatValue(detail.modelParam)}`
782
+ ];
783
+ const storePurchaseLines = [
784
+ `**Order No:** ${formatValue(detail.orderNo)}`,
785
+ `**Order Status:** ${formatValue(detail.orderStatus)}`,
786
+ `**Country:** ${formatValue(detail.country)}`,
787
+ `**Provider Type:** ${formatValue(detail.providerType)}`,
788
+ `**Provider Name:** ${formatValue(detail.proxyProviderName)}`,
789
+ `**Provider ID:** ${formatValue(detail.proxyProviderId)}`,
790
+ `**Provider Price:** ${formatValue(detail.proxyProviderPrice)}`,
791
+ `**Discount Price:** ${formatValue(detail.proxyProviderDiscountPrice)}`,
792
+ `**Proxy Check Channel:** ${formatValue(detail.proxyCheckChannel)}`,
793
+ `**Expire Date:** ${formatValue(detail.expireDate)}`,
794
+ `**Expire Status:** ${formatValue(detail.proxyExpireStatus)}`,
795
+ `**Auto Renew:** ${formatBool(detail.autoRenew, "enabled", "disabled")}`,
796
+ `**Can Renew:** ${formatBool(detail.canRenew)}`,
797
+ `**Can Refund:** ${formatBool(detail.canRefund)}`,
798
+ `**Renewal Time:** ${formatValue(detail.renewalTime)}`,
799
+ `**Proxy Months:** ${formatValue(detail.proxyMonths)}`,
800
+ `**Gift Days:** ${formatValue(detail.giftDays)}`,
801
+ `**Replace Status:** ${formatValue(detail.replaceStatus)}`,
802
+ `**Badge Type:** ${formatValue(detail.badgeTypeDesc)}`,
803
+ `**Operator Name:** ${formatValue(detail.opName)}`
804
+ ];
805
+ const sourceSpecificLines = detail.dataType === "buyProxy" ? storePurchaseLines : userAddedLines;
806
+ text = `\u{1F50E} **Proxy Detail**
807
+
808
+ ${commonLines.join("\n")}
809
+
810
+ **${sourceSpecificTitle}:**
811
+ ${sourceSpecificLines.join("\n")}`;
812
+ }
813
+ }
814
+ return {
815
+ content: [
816
+ {
817
+ type: "text",
818
+ text
819
+ }
820
+ ]
821
+ };
822
+ }
823
+ };
649
824
  var CreateProxies = class {
650
825
  name = "roxy_create_proxies";
651
826
  description = "Batch create multiple proxy configurations";
@@ -990,6 +1165,7 @@ ${params.ids.map((id, index) => ` ${index + 1}. ${id}`).join("\n")}
990
1165
  }
991
1166
  };
992
1167
  var proxyList = new ProxyList();
1168
+ var proxyDetail = new GetProxyDetail();
993
1169
  var createProxies = new CreateProxies();
994
1170
  var detectProxy = new DetectProxy();
995
1171
  var modifyProxy = new ModifyProxy();
@@ -2772,6 +2948,7 @@ var TOOLS = [
2772
2948
  listLabels.schema,
2773
2949
  getConnectionInfo.schema,
2774
2950
  proxyList.schema,
2951
+ proxyDetail.schema,
2775
2952
  createProxies.schema,
2776
2953
  detectProxy.schema,
2777
2954
  modifyProxy.schema,
@@ -2850,6 +3027,8 @@ var RoxyBrowserMCPServer = class {
2850
3027
  // 代理相关
2851
3028
  case proxyList.name:
2852
3029
  return await proxyList.handle(args);
3030
+ case proxyDetail.name:
3031
+ return await proxyDetail.handle(args);
2853
3032
  case createProxies.name:
2854
3033
  return await createProxies.handle(args);
2855
3034
  case detectProxy.name: