@roxybrowser/openapi 1.0.12 → 1.0.13-beta.1

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
@@ -544,10 +544,7 @@ var channelList = [
544
544
  ];
545
545
  var ProxyList = class {
546
546
  name = "roxy_list_proxies";
547
- /**
548
- * 仅当用户没有指定商店时调用
549
- */
550
- description = "Get list of proxy configurations. If you want to get the list of proxies configurations you've bought, please use `roxy_store_proxies`.";
547
+ description = "Get list of proxy IP List.";
551
548
  inputSchema = {
552
549
  type: "object",
553
550
  properties: {
@@ -555,7 +552,7 @@ var ProxyList = class {
555
552
  type: "number",
556
553
  description: "Workspace ID"
557
554
  },
558
- id: {
555
+ proxyType: {
559
556
  type: "number",
560
557
  description: "Filter by proxy ID"
561
558
  },
@@ -591,7 +588,7 @@ var ProxyList = class {
591
588
  if (!params.workspaceId) {
592
589
  throw new Error("workspaceId is required");
593
590
  }
594
- const result = await request(`/proxy/list?${searchParams}`);
591
+ const result = await request(`/proxy/list_merged?${searchParams}`);
595
592
  let text = "";
596
593
  if (result.code === 0) {
597
594
  const data = result.data;
@@ -601,9 +598,13 @@ var ProxyList = class {
601
598
  const hasNextPage = currentPage < totalPages;
602
599
  const proxyListText = data.rows.length > 0 ? data.rows.map((proxy, index) => {
603
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";
602
+ const canDelete = proxy.dataType === "proxyModule" ? "yes" : "no";
604
603
  const name = `proxy (id: ${proxy.id}) ${proxy.remark ? `remark: ${proxy.remark}` : ""}`;
605
604
  const location = proxy.lastCountry ? `${proxy.lastCity || ""}${proxy.lastCity && proxy.lastCountry ? ", " : ""}${proxy.lastCountry}` : null;
606
605
  let baseInfo = `${index + 1}. ${statusText} **${name}**
606
+ source: ${sourceType}
607
+ deletable: ${canDelete}
607
608
  protocol: ${proxy.protocol || "N/A"}
608
609
  ipType: ${proxy.ipType || "N/A"}
609
610
  bind profile count: ${proxy.bindCount || "N/A"}
@@ -623,7 +624,9 @@ ${ipInfo.length > 0 ? `${ipInfo.join("")}
623
624
  }
624
625
  return baseInfo;
625
626
  }).join("\n\n") : "";
626
- text = `\u{1F4CB} **proxy list** (total: ${data.total})
627
+ text = `\u{1F4F5} **proxy list** (total: ${data.total})
628
+
629
+ Only proxies with \`source: user-added\` can be deleted.
627
630
 
628
631
  ${proxyListText}
629
632
 
@@ -641,215 +644,8 @@ ${result.msg}`;
641
644
  return { content: [{ type: "text", text }] };
642
645
  }
643
646
  };
644
- var ProxyStore = class {
645
- name = "roxy_store_proxies";
646
- description = "Get list of proxy configurations in the Proxy Store";
647
- inputSchema = {
648
- type: "object",
649
- properties: {
650
- workspaceId: {
651
- type: "number",
652
- description: "Workspace ID"
653
- },
654
- pageIndex: {
655
- type: "number",
656
- description: "Page index for pagination (default: 1)",
657
- default: 1
658
- },
659
- pageSize: {
660
- type: "number",
661
- description: "Number of items per page (default: 15)",
662
- default: 15
663
- },
664
- type: {
665
- type: "number",
666
- description: "Type of proxies to get (0: list_use, 1: available_list)",
667
- default: 0
668
- }
669
- },
670
- required: ["workspaceId"]
671
- };
672
- get schema() {
673
- return {
674
- name: this.name,
675
- description: this.description,
676
- inputSchema: this.inputSchema
677
- };
678
- }
679
- async handle(params) {
680
- const searchParams = new URLSearchParams();
681
- searchParams.append("workspaceId", params.workspaceId.toString());
682
- if (params.pageIndex)
683
- searchParams.append("page_index", params.pageIndex.toString());
684
- if (params.pageSize)
685
- searchParams.append("page_size", params.pageSize.toString());
686
- if (params.type)
687
- searchParams.append("type", params.type.toString());
688
- const result = await request(`/proxy/bought_list?${searchParams}`);
689
- let text = "";
690
- if (result.code === 0) {
691
- const data = result.data;
692
- const currentPage = params.pageIndex ?? 1;
693
- const pageSize = params.pageSize ?? 15;
694
- const totalPages = Math.max(1, Math.ceil((data.total || 0) / pageSize));
695
- const hasNextPage = currentPage < totalPages;
696
- const proxyListText = data.rows.length > 0 ? data.rows.map((proxy, index) => {
697
- const statusText = proxy.checkStatus === 1 ? "\u2705 available" : proxy.checkStatus === 2 ? "\u274C unavailable" : "\u23F3 not checked";
698
- const name = `proxy (id: ${proxy.id}) ${proxy.remark ? `remark: ${proxy.remark}` : ""}`;
699
- const location = proxy.lastCountry ? `${proxy.lastCity || ""}${proxy.lastCity && proxy.lastCountry ? ", " : ""}${proxy.lastCountry}` : null;
700
- let baseInfo = `${index + 1}. ${statusText} **${name}**
701
- protocol: ${proxy.protocol || "N/A"}
702
- ipType: ${proxy.ipType || "N/A"}
703
- bind profile count: ${proxy.bindCount || "N/A"}
704
- Detection channel: ${proxy.checkChannel || "N/A"}
705
- expire date: ${proxy.expireDate}`;
706
- const ipInfo = [proxy.host, ":", proxy.port];
707
- if (proxy.proxyUserName) {
708
- ipInfo.push(...[proxy.proxyUserName, "@", proxy.proxyPassword]);
709
- }
710
- if (location) {
711
- baseInfo += `
712
- ${ipInfo.join("")}
713
- \u{1F4CD} ${location}`;
714
- }
715
- return baseInfo;
716
- }).join("\n\n") : "";
717
- text = `\u{1F4CB} **proxy store** (total: ${data.total})
718
-
719
- ${proxyListText}
720
-
721
- Pagination:
722
- - currentPage: ${currentPage}
723
- - pageSize: ${pageSize}
724
- - totalPages: ${totalPages}
725
- - hasNextPage: ${hasNextPage}
726
- ${hasNextPage ? `- nextPageHint: Call roxy_store_proxies again with pageIndex=${currentPage + 1}` : "- nextPageHint: No more pages"}`;
727
- } else {
728
- text = `\u274C **get proxy store failed**
729
-
730
- ${result.msg}`;
731
- }
732
- return { content: [{ type: "text", text }] };
733
- }
734
- };
735
- var CreateProxy = class {
736
- name = "roxy_create_proxy";
737
- description = "Create a new proxy configuration with automatic IP detection";
738
- inputSchema = {
739
- type: "object",
740
- properties: {
741
- workspaceId: {
742
- type: "number",
743
- description: "Workspace ID"
744
- },
745
- protocol: {
746
- type: "string",
747
- enum: ["HTTP", "HTTPS", "SOCKS5", "SSH"],
748
- description: "Proxy protocol type"
749
- },
750
- host: {
751
- type: "string",
752
- description: "Proxy host/IP address"
753
- },
754
- port: {
755
- type: "string",
756
- description: "Proxy port"
757
- },
758
- proxyUserName: {
759
- type: "string",
760
- description: "Proxy username"
761
- },
762
- proxyPassword: {
763
- type: "string",
764
- description: "Proxy password"
765
- },
766
- ipType: {
767
- type: "string",
768
- enum: ["IPV4", "IPV6"],
769
- description: "IP type (default: IPV4)"
770
- },
771
- checkChannel: {
772
- type: "string",
773
- enum: channelList.map((item) => item.label),
774
- description: "IP detection channel (default: IP123.in)"
775
- },
776
- refreshUrl: {
777
- type: "string",
778
- description: "Refresh URL for dynamic proxies"
779
- },
780
- remark: {
781
- type: "string",
782
- description: "Proxy remark/notes"
783
- }
784
- },
785
- required: ["workspaceId", "protocol", "host", "port"]
786
- };
787
- get schema() {
788
- return {
789
- name: this.name,
790
- description: this.description,
791
- inputSchema: this.inputSchema
792
- };
793
- }
794
- async handle(params) {
795
- if (!params.workspaceId || !params.protocol || !params.host || !params.port) {
796
- return {
797
- content: [
798
- {
799
- type: "text",
800
- text: "\u274C **Failed to create proxy:**\n\n workspaceId, protocol, host, and port are required"
801
- }
802
- ]
803
- };
804
- }
805
- const { workspaceId, ipType = "IPV4", checkChannel = "IP123.in", ...proxyData } = params;
806
- const proxyParams = {
807
- workspaceId,
808
- ...proxyData,
809
- ipType,
810
- checkChannel: checkChannel ? channelList.find((item) => item.label === checkChannel)?.value : null,
811
- proxyCategory: params.protocol
812
- };
813
- const result = await request("/proxy/create", {
814
- method: "POST",
815
- body: JSON.stringify(proxyParams)
816
- });
817
- let text = "";
818
- if (result.code !== 0) {
819
- if (result.data) {
820
- text = `\u274C **Failed to create proxy:**
821
-
822
- error message: ${result.msg}
823
-
824
- ${result.data.map((item) => ` - index: ${item.index}, error message: ${item.msg.join(", ")}`).join("\n")}`;
825
- } else {
826
- text = `\u274C **Failed to create proxy:**
827
-
828
- error message: ${result.msg}`;
829
- }
830
- } else {
831
- text = `\u2705 **Proxy Created Successfully**
832
-
833
- **Protocol:** ${params.protocol}
834
- **Host:** ${params.host}:${params.port}${params.proxyUserName ? `
835
- **Username:** ${params.proxyUserName}` : ""}${params.remark ? `
836
- **Remark:** ${params.remark}` : ""}${params.checkChannel ? `
837
- **Check Channel:** ${params.checkChannel}` : ""}
838
-
839
- *Proxy configuration created. IP detection will be performed automatically.*`;
840
- }
841
- return {
842
- content: [
843
- {
844
- type: "text",
845
- text
846
- }
847
- ]
848
- };
849
- }
850
- };
851
- var BatchCreateProxies = class {
852
- name = "roxy_batch_create_proxies";
647
+ var CreateProxies = class {
648
+ name = "roxy_create_proxies";
853
649
  description = "Batch create multiple proxy configurations";
854
650
  inputSchema = {
855
651
  type: "object",
@@ -858,11 +654,6 @@ var BatchCreateProxies = class {
858
654
  type: "number",
859
655
  description: "Workspace ID"
860
656
  },
861
- // checkChannel: {
862
- // type: 'string',
863
- // enum: channelList.map(item => item.label),
864
- // description: 'Default IP detection channel for all proxies',
865
- // },
866
657
  proxyList: {
867
658
  type: "array",
868
659
  description: "Array of proxy configurations",
@@ -1197,9 +988,7 @@ ${params.ids.map((id, index) => ` ${index + 1}. ${id}`).join("\n")}
1197
988
  }
1198
989
  };
1199
990
  var proxyList = new ProxyList();
1200
- var proxyStore = new ProxyStore();
1201
- var createProxy = new CreateProxy();
1202
- var batchCreateProxies = new BatchCreateProxies();
991
+ var createProxies = new CreateProxies();
1203
992
  var detectProxy = new DetectProxy();
1204
993
  var modifyProxy = new ModifyProxy();
1205
994
  var deleteProxies = new DeleteProxies();
@@ -1711,7 +1500,7 @@ var CreateBrowser = class {
1711
1500
  description: "Complete proxy configuration object",
1712
1501
  properties: {
1713
1502
  // 如果有 moduleId ,则其他参数不可传递 (moduleId 可通过 roxy_list_proxies 或 roxy_store_proxies 获取) 优先使用该参数来绑定代理IP
1714
- moduleId: { type: "number", description: `If moduleId is provided, no other parameters may be passed. (moduleId can be obtained via ${proxyList.name} or ${proxyStore.name}. field: id) Priority to use this parameter to bind proxy IP` },
1503
+ moduleId: { type: "number", description: `If moduleId is provided, no other parameters may be passed. (moduleId can be obtained via ${proxyList.name} field: id) Priority to use this parameter to bind proxy IP` },
1715
1504
  proxyMethod: { type: "string", enum: ["custom", "choose", "api"] },
1716
1505
  proxyCategory: { type: "string", enum: ["noproxy", "HTTP", "HTTPS", "SOCKS5", "SSH"] },
1717
1506
  ipType: { type: "string", enum: ["IPV4", "IPV6"] },
@@ -2166,11 +1955,12 @@ var ListBrowsers = class {
2166
1955
  const pageSize = params.pageSize ?? 15;
2167
1956
  const totalPages = Math.max(1, Math.ceil((data.total || 0) / pageSize));
2168
1957
  const hasNextPage = currentPage < totalPages;
1958
+ const serialNo = `${data.workspaceName?.slice(0, 3).toLocaleUpperCase()}-${data.windowSortNum}`;
2169
1959
  text = `Found ${data.total} browsers in workspace ${params.workspaceId}:
2170
1960
 
2171
1961
  ${data.rows.map(
2172
- (browser) => `**${browser.windowName || "Unnamed"}** (ID: ${browser.dirId})
2173
- - coreVersion: ${browser.coreVersion} - Sort: ${browser.windowSortNum}
1962
+ (browser) => `**${browser.windowName || "Unnamed"}** (Serial No: ${serialNo})
1963
+ - CoreVersion: ${browser.coreVersion} - DirId: ${browser.dirId}
2174
1964
  - OSVersion: ${browser.osVersion}
2175
1965
  - OS: ${browser.os}
2176
1966
  - Remark: ${browser.windowRemark}`
@@ -2385,11 +2175,13 @@ var GetBrowserDetail = class {
2385
2175
  } else {
2386
2176
  const cookieCount = detail.cookie?.length || 0;
2387
2177
  const { cookie: _cookie, ...detailWithoutCookies } = detail;
2178
+ const serialNo = `${detail.workspaceName?.slice(0, 3).toLocaleUpperCase()}-${detail.windowSortNum}`;
2388
2179
  text = `**Browser Details Summary**
2389
2180
 
2390
2181
  **ID:** \`${detail.dirId}\`
2182
+ **dirId**: \`${detail.dirId}\`
2183
+ **Serial No:** ${serialNo}
2391
2184
  **Name:** ${detail.windowName}
2392
- **Sort Number:** ${detail.windowSortNum}
2393
2185
  **Project:** ${detail.projectName} (ID: ${detail.projectId})
2394
2186
  **OS:** ${detail.os} ${detail.osVersion}
2395
2187
  **Core Version:** ${detail.coreVersion}
@@ -2978,9 +2770,7 @@ var TOOLS = [
2978
2770
  listLabels.schema,
2979
2771
  getConnectionInfo.schema,
2980
2772
  proxyList.schema,
2981
- proxyStore.schema,
2982
- createProxy.schema,
2983
- batchCreateProxies.schema,
2773
+ createProxies.schema,
2984
2774
  detectProxy.schema,
2985
2775
  modifyProxy.schema,
2986
2776
  deleteProxies.schema,
@@ -3058,12 +2848,8 @@ var RoxyBrowserMCPServer = class {
3058
2848
  // 代理相关
3059
2849
  case proxyList.name:
3060
2850
  return await proxyList.handle(args);
3061
- case proxyStore.name:
3062
- return await proxyStore.handle(args);
3063
- case createProxy.name:
3064
- return await createProxy.handle(args);
3065
- case batchCreateProxies.name:
3066
- return await batchCreateProxies.handle(args);
2851
+ case createProxies.name:
2852
+ return await createProxies.handle(args);
3067
2853
  case detectProxy.name:
3068
2854
  return await detectProxy.handle(args);
3069
2855
  case modifyProxy.name: