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

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