@tgebrowser/mcp 1.1.1 → 1.1.2
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/build/server.js +41 -1
- package/package.json +1 -1
package/build/server.js
CHANGED
|
@@ -76,7 +76,9 @@ var ENDPOINTS = {
|
|
|
76
76
|
UPDATE_PROXY: (proxyId) => `/api/proxies/${proxyId}`,
|
|
77
77
|
DELETE_PROXY: (proxyId) => `/api/proxies/${proxyId}`,
|
|
78
78
|
WINDOW_HIDE: "/api/window/hide",
|
|
79
|
-
WINDOW_SHOW: "/api/window/show"
|
|
79
|
+
WINDOW_SHOW: "/api/window/show",
|
|
80
|
+
UPDATE_COOKIE: "/api/browser/cookie/update",
|
|
81
|
+
BATCH_UPDATE: "/api/browser/batch/update"
|
|
80
82
|
};
|
|
81
83
|
var apiClient = import_axios.default.create({
|
|
82
84
|
baseURL: BASE_URL,
|
|
@@ -257,6 +259,20 @@ To automate this browser, use connect-browser-with-ws with wsUrl="${wsUrl}"`;
|
|
|
257
259
|
const response = await apiClient.post(ENDPOINTS.GET_BROWSER_DETAIL, body);
|
|
258
260
|
assertSuccess(response.data, "get browser detail");
|
|
259
261
|
return `Browser detail: ${JSON.stringify(response.data.data, null, 2)}`;
|
|
262
|
+
},
|
|
263
|
+
async updateCookie({ envId, userIndex, cookie }) {
|
|
264
|
+
const body = { cookie };
|
|
265
|
+
if (envId !== void 0) body.envId = envId;
|
|
266
|
+
if (userIndex !== void 0) body.userIndex = userIndex;
|
|
267
|
+
const response = await apiClient.post(ENDPOINTS.UPDATE_COOKIE, body);
|
|
268
|
+
assertSuccess(response.data, "update cookie");
|
|
269
|
+
return `Cookie updated for envId=${body.envId ?? ""} userIndex=${body.userIndex ?? ""}`;
|
|
270
|
+
},
|
|
271
|
+
async batchUpdate({ envIds, field, value }) {
|
|
272
|
+
const response = await apiClient.put(ENDPOINTS.BATCH_UPDATE, { envIds, field, value });
|
|
273
|
+
assertSuccess(response.data, "batch update");
|
|
274
|
+
const info = response.data.data || {};
|
|
275
|
+
return `Batch update result: total=${info.total}, success=${info.success}, failed=${info.failed}`;
|
|
260
276
|
}
|
|
261
277
|
};
|
|
262
278
|
|
|
@@ -546,6 +562,18 @@ var profileSchemas = {
|
|
|
546
562
|
userIndex: import_zod.z.number().int().min(1).optional().describe("Environment index")
|
|
547
563
|
}).refine((data) => data.envId !== void 0 || data.userIndex !== void 0, {
|
|
548
564
|
message: "Either envId or userIndex must be provided"
|
|
565
|
+
}),
|
|
566
|
+
updateCookie: import_zod.z.object({
|
|
567
|
+
envId: import_zod.z.number().int().positive().optional().describe("Environment id"),
|
|
568
|
+
userIndex: import_zod.z.number().int().min(1).optional().describe("Environment index"),
|
|
569
|
+
cookie: import_zod.z.string().describe("Cookie string. Empty string or null clears the cookie.")
|
|
570
|
+
}).refine((data) => data.envId !== void 0 || data.userIndex !== void 0, {
|
|
571
|
+
message: "Either envId or userIndex must be provided"
|
|
572
|
+
}),
|
|
573
|
+
batchUpdate: import_zod.z.object({
|
|
574
|
+
envIds: import_zod.z.array(import_zod.z.number().int().positive()).describe("Array of environment ids"),
|
|
575
|
+
field: import_zod.z.string().describe('Field name to update, e.g. "browserName", "remark", "fingerprint"'),
|
|
576
|
+
value: import_zod.z.any().describe("New value for the field")
|
|
549
577
|
})
|
|
550
578
|
};
|
|
551
579
|
|
|
@@ -1089,6 +1117,18 @@ function registerTools(server2) {
|
|
|
1089
1117
|
profileSchemas.detail.shape,
|
|
1090
1118
|
wrapHandler(profileActions.getDetail, profileSchemas.detail)
|
|
1091
1119
|
);
|
|
1120
|
+
server2.tool(
|
|
1121
|
+
"update-cookie",
|
|
1122
|
+
"Update the cookie for a specific environment. Pass empty string to clear.",
|
|
1123
|
+
schemaShape(profileSchemas.updateCookie),
|
|
1124
|
+
wrapHandler(profileActions.updateCookie, profileSchemas.updateCookie)
|
|
1125
|
+
);
|
|
1126
|
+
server2.tool(
|
|
1127
|
+
"batch-update",
|
|
1128
|
+
"Batch update a specific field across multiple environments",
|
|
1129
|
+
profileSchemas.batchUpdate.shape,
|
|
1130
|
+
wrapHandler(profileActions.batchUpdate, profileSchemas.batchUpdate)
|
|
1131
|
+
);
|
|
1092
1132
|
server2.tool(
|
|
1093
1133
|
"get-group-list",
|
|
1094
1134
|
"Get the list of groups",
|