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