@roxybrowser/openapi 1.0.10 → 1.0.12-beta.0
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 +66 -14
- package/lib/cli.cjs.map +1 -1
- package/lib/cli.js +66 -14
- package/lib/cli.js.map +1 -1
- package/lib/index.cjs +66 -14
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +9 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +66 -14
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -125,6 +125,10 @@ var ListAccounts = class {
|
|
|
125
125
|
|
|
126
126
|
error message: ${result.msg}`;
|
|
127
127
|
} else {
|
|
128
|
+
const currentPage = params.pageIndex ?? 1;
|
|
129
|
+
const pageSize = params.pageSize ?? 15;
|
|
130
|
+
const totalPages = Math.max(1, Math.ceil((data.total || 0) / pageSize));
|
|
131
|
+
const hasNextPage = currentPage < totalPages;
|
|
128
132
|
text = `Found ${data.total} accounts in workspace ${params.workspaceId}:
|
|
129
133
|
|
|
130
134
|
${data.rows.map(
|
|
@@ -133,7 +137,14 @@ ${data.rows.map(
|
|
|
133
137
|
- Platform URL: ${account.platformUrl}
|
|
134
138
|
- Remarks: ${account.platformRemarks || "N/A"}
|
|
135
139
|
- Created: ${account.createTime}`
|
|
136
|
-
).join("\n\n")}
|
|
140
|
+
).join("\n\n")}
|
|
141
|
+
|
|
142
|
+
Pagination:
|
|
143
|
+
- currentPage: ${currentPage}
|
|
144
|
+
- pageSize: ${pageSize}
|
|
145
|
+
- totalPages: ${totalPages}
|
|
146
|
+
- hasNextPage: ${hasNextPage}
|
|
147
|
+
${hasNextPage ? `- nextPageHint: Call roxy_list_accounts again with pageIndex=${currentPage + 1}` : "- nextPageHint: No more pages"}`;
|
|
137
148
|
}
|
|
138
149
|
return {
|
|
139
150
|
content: [
|
|
@@ -570,13 +581,13 @@ var ProxyList = class {
|
|
|
570
581
|
}
|
|
571
582
|
async handle(params) {
|
|
572
583
|
const searchParams = new URLSearchParams();
|
|
573
|
-
searchParams.append("workspaceId", params.workspaceId);
|
|
584
|
+
searchParams.append("workspaceId", params.workspaceId.toString());
|
|
574
585
|
if (params.id)
|
|
575
|
-
searchParams.append("id", params.id);
|
|
576
|
-
if (params.
|
|
577
|
-
searchParams.append("page_index", params.pageIndex);
|
|
578
|
-
if (params.
|
|
579
|
-
searchParams.append("page_size", params.pageSize);
|
|
586
|
+
searchParams.append("id", params.id.toString());
|
|
587
|
+
if (params.pageIndex)
|
|
588
|
+
searchParams.append("page_index", params.pageIndex.toString());
|
|
589
|
+
if (params.pageSize)
|
|
590
|
+
searchParams.append("page_size", params.pageSize.toString());
|
|
580
591
|
if (!params.workspaceId) {
|
|
581
592
|
throw new Error("workspaceId is required");
|
|
582
593
|
}
|
|
@@ -584,6 +595,10 @@ var ProxyList = class {
|
|
|
584
595
|
let text = "";
|
|
585
596
|
if (result.code === 0) {
|
|
586
597
|
const data = result.data;
|
|
598
|
+
const currentPage = params.pageIndex ?? 1;
|
|
599
|
+
const pageSize = params.pageSize ?? 15;
|
|
600
|
+
const totalPages = Math.max(1, Math.ceil((data.total || 0) / pageSize));
|
|
601
|
+
const hasNextPage = currentPage < totalPages;
|
|
587
602
|
const proxyListText = data.rows.length > 0 ? data.rows.map((proxy, index) => {
|
|
588
603
|
const statusText = proxy.checkStatus === 1 ? "\u2705 available" : proxy.checkStatus === 2 ? "\u274C unavailable" : "\u23F3 not checked";
|
|
589
604
|
const name = `proxy (id: ${proxy.id}) ${proxy.remark ? `remark: ${proxy.remark}` : ""}`;
|
|
@@ -610,7 +625,14 @@ ${ipInfo.length > 0 ? `${ipInfo.join("")}
|
|
|
610
625
|
}).join("\n\n") : "";
|
|
611
626
|
text = `\u{1F4CB} **proxy list** (total: ${data.total})
|
|
612
627
|
|
|
613
|
-
${proxyListText}
|
|
628
|
+
${proxyListText}
|
|
629
|
+
|
|
630
|
+
Pagination:
|
|
631
|
+
- currentPage: ${currentPage}
|
|
632
|
+
- pageSize: ${pageSize}
|
|
633
|
+
- totalPages: ${totalPages}
|
|
634
|
+
- hasNextPage: ${hasNextPage}
|
|
635
|
+
${hasNextPage ? `- nextPageHint: Call roxy_list_proxies again with pageIndex=${currentPage + 1}` : "- nextPageHint: No more pages"}`;
|
|
614
636
|
} else {
|
|
615
637
|
text = `\u274C **get proxy list failed**
|
|
616
638
|
|
|
@@ -657,16 +679,20 @@ var ProxyStore = class {
|
|
|
657
679
|
async handle(params) {
|
|
658
680
|
const searchParams = new URLSearchParams();
|
|
659
681
|
searchParams.append("workspaceId", params.workspaceId.toString());
|
|
660
|
-
if (params.
|
|
661
|
-
searchParams.append("page_index", params.
|
|
662
|
-
if (params.
|
|
663
|
-
searchParams.append("page_size", params.
|
|
682
|
+
if (params.pageIndex)
|
|
683
|
+
searchParams.append("page_index", params.pageIndex.toString());
|
|
684
|
+
if (params.pageSize)
|
|
685
|
+
searchParams.append("page_size", params.pageSize.toString());
|
|
664
686
|
if (params.type)
|
|
665
687
|
searchParams.append("type", params.type.toString());
|
|
666
688
|
const result = await request(`/proxy/bought_list?${searchParams}`);
|
|
667
689
|
let text = "";
|
|
668
690
|
if (result.code === 0) {
|
|
669
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;
|
|
670
696
|
const proxyListText = data.rows.length > 0 ? data.rows.map((proxy, index) => {
|
|
671
697
|
const statusText = proxy.checkStatus === 1 ? "\u2705 available" : proxy.checkStatus === 2 ? "\u274C unavailable" : "\u23F3 not checked";
|
|
672
698
|
const name = `proxy (id: ${proxy.id}) ${proxy.remark ? `remark: ${proxy.remark}` : ""}`;
|
|
@@ -690,7 +716,14 @@ ${ipInfo.join("")}
|
|
|
690
716
|
}).join("\n\n") : "";
|
|
691
717
|
text = `\u{1F4CB} **proxy store** (total: ${data.total})
|
|
692
718
|
|
|
693
|
-
${proxyListText}
|
|
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"}`;
|
|
694
727
|
} else {
|
|
695
728
|
text = `\u274C **get proxy store failed**
|
|
696
729
|
|
|
@@ -2129,6 +2162,10 @@ var ListBrowsers = class {
|
|
|
2129
2162
|
|
|
2130
2163
|
error message: ${result.msg}`;
|
|
2131
2164
|
} else {
|
|
2165
|
+
const currentPage = params.pageIndex ?? 1;
|
|
2166
|
+
const pageSize = params.pageSize ?? 15;
|
|
2167
|
+
const totalPages = Math.max(1, Math.ceil((data.total || 0) / pageSize));
|
|
2168
|
+
const hasNextPage = currentPage < totalPages;
|
|
2132
2169
|
text = `Found ${data.total} browsers in workspace ${params.workspaceId}:
|
|
2133
2170
|
|
|
2134
2171
|
${data.rows.map(
|
|
@@ -2137,7 +2174,14 @@ ${data.rows.map(
|
|
|
2137
2174
|
- OSVersion: ${browser.osVersion}
|
|
2138
2175
|
- OS: ${browser.os}
|
|
2139
2176
|
- Remark: ${browser.windowRemark}`
|
|
2140
|
-
).join("\n\n")}
|
|
2177
|
+
).join("\n\n")}
|
|
2178
|
+
|
|
2179
|
+
Pagination:
|
|
2180
|
+
- currentPage: ${currentPage}
|
|
2181
|
+
- pageSize: ${pageSize}
|
|
2182
|
+
- totalPages: ${totalPages}
|
|
2183
|
+
- hasNextPage: ${hasNextPage}
|
|
2184
|
+
${hasNextPage ? `- nextPageHint: Call roxy_list_browsers again with pageIndex=${currentPage + 1}` : "- nextPageHint: No more pages"}`;
|
|
2141
2185
|
}
|
|
2142
2186
|
return {
|
|
2143
2187
|
content: [
|
|
@@ -3047,6 +3091,14 @@ var RoxyBrowserMCPServer = class {
|
|
|
3047
3091
|
}
|
|
3048
3092
|
});
|
|
3049
3093
|
}
|
|
3094
|
+
/**
|
|
3095
|
+
* Connect the server to any MCP transport (stdio, InMemoryTransport, SSE, etc.).
|
|
3096
|
+
* Use this for in-process embedding — e.g. passing an InMemoryTransport from
|
|
3097
|
+
* @modelcontextprotocol/sdk to avoid spawning a subprocess.
|
|
3098
|
+
*/
|
|
3099
|
+
async connect(transport) {
|
|
3100
|
+
await this.server.connect(transport);
|
|
3101
|
+
}
|
|
3050
3102
|
async run() {
|
|
3051
3103
|
console.error("\u{1F680} Starting RoxyBrowser MCP Server...");
|
|
3052
3104
|
const transport = new StdioServerTransport();
|