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