@roxybrowser/openapi 1.0.13-beta.7 → 1.0.13
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/README.md +32 -2
- package/lib/cli.cjs +39 -152
- package/lib/cli.cjs.map +1 -1
- package/lib/cli.js +35 -152
- package/lib/cli.js.map +1 -1
- package/lib/index.cjs +33 -150
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +6 -527
- package/lib/index.d.ts +6 -527
- package/lib/index.js +33 -150
- package/lib/index.js.map +1 -1
- package/package.json +6 -2
package/lib/cli.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Command } from 'commander';
|
|
|
3
3
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
4
4
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
5
5
|
import { ListToolsRequestSchema, CallToolRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
+
import dotenv from 'dotenv';
|
|
6
7
|
|
|
7
8
|
// src/types.ts
|
|
8
9
|
var ConfigError = class extends Error {
|
|
@@ -2143,23 +2144,29 @@ var ListBrowsers = class {
|
|
|
2143
2144
|
const pageSize = params.pageSize ?? 15;
|
|
2144
2145
|
const totalPages = Math.max(1, Math.ceil((data.total || 0) / pageSize));
|
|
2145
2146
|
const hasNextPage = currentPage < totalPages;
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
${data.
|
|
2149
|
-
const
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
-
|
|
2154
|
-
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2147
|
+
const readable = [];
|
|
2148
|
+
if (data.total > 0) {
|
|
2149
|
+
readable.push(`Found ${data.total} browsers in workspace ${params.workspaceId}:`);
|
|
2150
|
+
const browserList = data.rows.map((browser) => {
|
|
2151
|
+
const serialNo = `${browser.workspaceName?.slice(0, 3).toLocaleUpperCase()}-${browser.windowSortNum}`;
|
|
2152
|
+
const info = [
|
|
2153
|
+
`Profile Name: **${browser.windowName || "Unnamed"}** (SN: ${serialNo})`,
|
|
2154
|
+
` - CoreVersion: ${browser.coreVersion}`,
|
|
2155
|
+
` - OS: ${browser.os} ${browser.osVersion}`
|
|
2156
|
+
];
|
|
2157
|
+
if (browser.windowRemark) {
|
|
2158
|
+
info.push(` - Remark: ${browser.windowRemark}`);
|
|
2159
|
+
}
|
|
2160
|
+
return info.join("\n");
|
|
2161
|
+
}).join("\n\n");
|
|
2162
|
+
readable.push(browserList);
|
|
2163
|
+
if (totalPages > 1) {
|
|
2164
|
+
readable.push(`Pagination: page=${currentPage}, totalPages=${totalPages}, hasNext=${hasNextPage}`);
|
|
2165
|
+
}
|
|
2166
|
+
} else {
|
|
2167
|
+
readable.push(`No browsers found in workspace ${params.workspaceId}.`);
|
|
2168
|
+
}
|
|
2169
|
+
text = readable.join("\n\n");
|
|
2163
2170
|
}
|
|
2164
2171
|
return {
|
|
2165
2172
|
content: [
|
|
@@ -2792,26 +2799,10 @@ ${ws.project_details.map(
|
|
|
2792
2799
|
};
|
|
2793
2800
|
var HealthCheck = class {
|
|
2794
2801
|
name = "roxy_health_check";
|
|
2795
|
-
description = "Check
|
|
2802
|
+
description = "Check whether the RoxyBrowser server is running and reachable.";
|
|
2796
2803
|
inputSchema = {
|
|
2797
2804
|
type: "object",
|
|
2798
|
-
properties: {
|
|
2799
|
-
includeWorkspaceCheck: {
|
|
2800
|
-
type: "boolean",
|
|
2801
|
-
description: "Include workspace connectivity tests (optional, default: true)",
|
|
2802
|
-
default: true
|
|
2803
|
-
},
|
|
2804
|
-
includeBrowserCheck: {
|
|
2805
|
-
type: "boolean",
|
|
2806
|
-
description: "Include browser availability checks (optional, default: true)",
|
|
2807
|
-
default: true
|
|
2808
|
-
},
|
|
2809
|
-
verbose: {
|
|
2810
|
-
type: "boolean",
|
|
2811
|
-
description: "Include detailed diagnostic information (optional, default: false)",
|
|
2812
|
-
default: false
|
|
2813
|
-
}
|
|
2814
|
-
}
|
|
2805
|
+
properties: {}
|
|
2815
2806
|
};
|
|
2816
2807
|
get schema() {
|
|
2817
2808
|
return {
|
|
@@ -2820,126 +2811,19 @@ var HealthCheck = class {
|
|
|
2820
2811
|
inputSchema: this.inputSchema
|
|
2821
2812
|
};
|
|
2822
2813
|
}
|
|
2823
|
-
async handle(
|
|
2824
|
-
|
|
2825
|
-
let healthStatus = "unknown";
|
|
2826
|
-
let healthError = "";
|
|
2814
|
+
async handle(_params) {
|
|
2815
|
+
let text = "";
|
|
2827
2816
|
try {
|
|
2828
|
-
const
|
|
2817
|
+
const result = await request("/health", {
|
|
2829
2818
|
method: "GET"
|
|
2830
2819
|
});
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
healthStatus = "unhealthy";
|
|
2835
|
-
healthError = healthResult.msg || "Health check failed";
|
|
2836
|
-
}
|
|
2820
|
+
text = result.code === 0 ? "\u2705 **Server is healthy**\n\nThe RoxyBrowser server is running and reachable." : `\u274C **Server health check failed**
|
|
2821
|
+
|
|
2822
|
+
${result.msg || "Unknown server response"}`;
|
|
2837
2823
|
} catch (error) {
|
|
2838
|
-
|
|
2839
|
-
healthError = error.message || "Failed to connect to server";
|
|
2840
|
-
}
|
|
2841
|
-
let text = `## \u{1F50D} \u5065\u5EB7\u68C0\u67E5\u62A5\u544A / Health Check Report
|
|
2824
|
+
text = `\u274C **Server is unavailable**
|
|
2842
2825
|
|
|
2843
|
-
`;
|
|
2844
|
-
text += `### \u{1F310} \u670D\u52A1\u5668\u72B6\u6001 / Server Status
|
|
2845
|
-
`;
|
|
2846
|
-
text += `- **\u670D\u52A1\u5668\u8FDE\u63A5 / Server Connection**: ${healthStatus === "healthy" ? "\u2705 \u6B63\u5E38" : "\u274C \u5F02\u5E38"}
|
|
2847
|
-
`;
|
|
2848
|
-
if (healthStatus !== "healthy" && healthError) {
|
|
2849
|
-
text += `- **\u9519\u8BEF\u4FE1\u606F / Error**: ${healthError}
|
|
2850
|
-
`;
|
|
2851
|
-
}
|
|
2852
|
-
if (includeWorkspaceCheck && healthStatus === "healthy") {
|
|
2853
|
-
try {
|
|
2854
|
-
const workspaceResult = await request("/browser/workspace?page_index=1&page_size=5", {
|
|
2855
|
-
method: "GET"
|
|
2856
|
-
});
|
|
2857
|
-
if (workspaceResult.code === 0) {
|
|
2858
|
-
const workspaces = workspaceResult.data;
|
|
2859
|
-
text += `
|
|
2860
|
-
### \u{1F4C1} \u5DE5\u4F5C\u533A\u4FE1\u606F / Workspace Information
|
|
2861
|
-
`;
|
|
2862
|
-
text += `- **\u53EF\u7528\u5DE5\u4F5C\u533A / Available Workspaces**: ${workspaces.total}
|
|
2863
|
-
`;
|
|
2864
|
-
if (workspaces.rows && workspaces.rows.length > 0) {
|
|
2865
|
-
text += `- **\u5DE5\u4F5C\u533A\u8BE6\u60C5 / Workspace Details**:
|
|
2866
|
-
`;
|
|
2867
|
-
workspaces.rows.slice(0, 3).forEach((ws) => {
|
|
2868
|
-
const projectCount = ws.project_details?.length || 0;
|
|
2869
|
-
text += ` - ${ws.workspaceName} (ID: ${ws.id}) - ${projectCount} projects
|
|
2870
|
-
`;
|
|
2871
|
-
});
|
|
2872
|
-
if (workspaces.total > 3) {
|
|
2873
|
-
text += ` - ... and ${workspaces.total - 3} more
|
|
2874
|
-
`;
|
|
2875
|
-
}
|
|
2876
|
-
}
|
|
2877
|
-
} else {
|
|
2878
|
-
text += `
|
|
2879
|
-
### \u{1F4C1} \u5DE5\u4F5C\u533A\u4FE1\u606F / Workspace Information
|
|
2880
|
-
`;
|
|
2881
|
-
text += `- **\u72B6\u6001**: \u26A0\uFE0F \u65E0\u6CD5\u83B7\u53D6\u5DE5\u4F5C\u533A\u4FE1\u606F
|
|
2882
|
-
`;
|
|
2883
|
-
text += `- **\u9519\u8BEF**: ${workspaceResult.msg}
|
|
2884
|
-
`;
|
|
2885
|
-
}
|
|
2886
|
-
} catch (error) {
|
|
2887
|
-
text += `
|
|
2888
|
-
### \u{1F4C1} \u5DE5\u4F5C\u533A\u4FE1\u606F / Workspace Information
|
|
2889
|
-
`;
|
|
2890
|
-
text += `- **\u72B6\u6001**: \u274C \u65E0\u6CD5\u83B7\u53D6\u5DE5\u4F5C\u533A\u4FE1\u606F
|
|
2891
|
-
`;
|
|
2892
|
-
text += `- **\u9519\u8BEF**: ${error.message || "Unknown error"}
|
|
2893
|
-
`;
|
|
2894
|
-
}
|
|
2895
|
-
}
|
|
2896
|
-
if (includeBrowserCheck && healthStatus === "healthy") {
|
|
2897
|
-
try {
|
|
2898
|
-
const workspaceResult = await request("/browser/workspace?page_index=1&page_size=1", {
|
|
2899
|
-
method: "GET"
|
|
2900
|
-
});
|
|
2901
|
-
if (workspaceResult.code === 0 && workspaceResult.data.rows && workspaceResult.data.rows.length > 0) {
|
|
2902
|
-
const firstWorkspace = workspaceResult.data.rows[0];
|
|
2903
|
-
const browserResult = await request(`/browser/list_v3?workspaceId=${firstWorkspace.id}&page_index=1&page_size=5`, {
|
|
2904
|
-
method: "GET"
|
|
2905
|
-
});
|
|
2906
|
-
if (browserResult.code === 0) {
|
|
2907
|
-
const browsers = browserResult.data;
|
|
2908
|
-
text += `
|
|
2909
|
-
### \u{1F310} \u6D4F\u89C8\u5668\u4FE1\u606F / Browser Information
|
|
2910
|
-
`;
|
|
2911
|
-
text += `- **\u5DE5\u4F5C\u533A / Workspace**: ${firstWorkspace.workspaceName} (ID: ${firstWorkspace.id})
|
|
2912
|
-
`;
|
|
2913
|
-
text += `- **\u6D4F\u89C8\u5668\u603B\u6570 / Total Browsers**: ${browsers.total}
|
|
2914
|
-
`;
|
|
2915
|
-
if (browsers.rows && browsers.rows.length > 0) {
|
|
2916
|
-
text += `- **\u6D4F\u89C8\u5668\u793A\u4F8B / Browser Examples**:
|
|
2917
|
-
`;
|
|
2918
|
-
browsers.rows.slice(0, 3).forEach((browser) => {
|
|
2919
|
-
text += ` - ${browser.windowName || "Unnamed"} (ID: ${browser.dirId}) - ${browser.status}
|
|
2920
|
-
`;
|
|
2921
|
-
});
|
|
2922
|
-
}
|
|
2923
|
-
}
|
|
2924
|
-
}
|
|
2925
|
-
} catch (error) {
|
|
2926
|
-
text += `
|
|
2927
|
-
### \u{1F310} \u6D4F\u89C8\u5668\u4FE1\u606F / Browser Information
|
|
2928
|
-
`;
|
|
2929
|
-
text += `- **\u72B6\u6001**: \u26A0\uFE0F \u65E0\u6CD5\u83B7\u53D6\u6D4F\u89C8\u5668\u4FE1\u606F
|
|
2930
|
-
`;
|
|
2931
|
-
text += `- **\u9519\u8BEF**: ${error.message || "Unknown error"}
|
|
2932
|
-
`;
|
|
2933
|
-
}
|
|
2934
|
-
}
|
|
2935
|
-
if (verbose && healthStatus === "healthy") {
|
|
2936
|
-
text += `
|
|
2937
|
-
### \u{1F4CA} \u8BE6\u7EC6\u4FE1\u606F / Detailed Information
|
|
2938
|
-
`;
|
|
2939
|
-
text += `- **\u5065\u5EB7\u68C0\u67E5\u65F6\u95F4 / Check Time**: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
2940
|
-
`;
|
|
2941
|
-
text += `- **\u68C0\u67E5\u6A21\u5F0F / Check Mode**: ${includeWorkspaceCheck ? "Workspace + " : ""}${includeBrowserCheck ? "Browser" : ""}
|
|
2942
|
-
`;
|
|
2826
|
+
${error?.message || "Failed to connect to the server"}`;
|
|
2943
2827
|
}
|
|
2944
2828
|
return {
|
|
2945
2829
|
content: [
|
|
@@ -3099,8 +2983,7 @@ async function runServer() {
|
|
|
3099
2983
|
const server = new RoxyBrowserMCPServer();
|
|
3100
2984
|
await server.run();
|
|
3101
2985
|
}
|
|
3102
|
-
|
|
3103
|
-
// src/cli.ts
|
|
2986
|
+
dotenv.config();
|
|
3104
2987
|
var PKG_VERSION = "1.0.9";
|
|
3105
2988
|
var program = new Command();
|
|
3106
2989
|
program.name("roxy-browser-mcp").description("RoxyBrowser MCP Server - Model Context Protocol server for RoxyBrowser automation").version(PKG_VERSION, "-V, --version", "Show version").option(
|