@attson/atwebpilot-mcp 0.0.28 → 0.0.30
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/dist/index.js +62 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -638,6 +638,8 @@ function capabilityForTool(tool, opts) {
|
|
|
638
638
|
return opts?.httpCookied ? "httpRequest:cookied" : "httpRequest:no-cookie";
|
|
639
639
|
case "askUser":
|
|
640
640
|
return "read:dom";
|
|
641
|
+
case "screenshot":
|
|
642
|
+
return "read:image";
|
|
641
643
|
default: {
|
|
642
644
|
const _exhaustive = tool;
|
|
643
645
|
throw new Error(`capabilityForTool: unknown tool ${_exhaustive}`);
|
|
@@ -1339,6 +1341,20 @@ var TOOL_DEFS = [
|
|
|
1339
1341
|
required: ["tabId"]
|
|
1340
1342
|
}
|
|
1341
1343
|
},
|
|
1344
|
+
{
|
|
1345
|
+
name: "screenshot",
|
|
1346
|
+
description: "\u622A\u5F53\u524D tab \u7684\u53EF\u89C1\u533A\u57DF\u4E3A PNG\uFF08base64 \u8FD4\u56DE\uFF0C\u81EA\u52A8\u4F5C\u4E3A image block \u6CE8\u5165\u5230\u4E0B\u8F6E\u4E0A\u4E0B\u6587\uFF09\u3002\u7528\u4E8E\uFF1A\u89C6\u89C9\u8C03\u8BD5 selector\u3001\u770B\u56FE\u56DE\u7B54\u5E03\u5C40\u95EE\u9898\u3001\u4FDD\u5B58\u8BC1\u636E\u3002\u8FD4\u56DE {ok: true, byteLen}\u3002",
|
|
1347
|
+
input_schema: {
|
|
1348
|
+
type: "object",
|
|
1349
|
+
properties: {
|
|
1350
|
+
selector: {
|
|
1351
|
+
type: "string",
|
|
1352
|
+
description: "\u53EF\u9009\uFF1ACSS selector\u3002\u57FA\u7840\u7248\u65E0\u89C6\u5B83\uFF0C\u59CB\u7EC8\u622A viewport\uFF1B\u4FDD\u7559\u5B57\u6BB5\u4E3A\u672A\u6765\u6269\u5C55\u3002"
|
|
1353
|
+
},
|
|
1354
|
+
tabId: { type: "integer", description: "\u76EE\u6807 tab\uFF1B\u7701\u7565 = \u672C\u4F1A\u8BDD tab" }
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
},
|
|
1342
1358
|
{
|
|
1343
1359
|
name: "askUser",
|
|
1344
1360
|
description: "\u5411\u7528\u6237\u4E3B\u52A8\u5F81\u8BE2\uFF08\u4E0D\u662F\u6267\u884C\u64CD\u4F5C\uFF09\u3002\u5F53\u4EFB\u52A1\u6709\u591A\u4E2A\u5019\u9009\u3001\u9700\u8981\u4E8C\u6B21\u786E\u8BA4\u3001\u6216\u7F3A\u5173\u952E\u4FE1\u606F\u65F6\u8C03\u7528\u3002\u8FD4\u56DE {choice} \u6216 {value} \u6216 {cancelled:true}\u3002\u4EC5\u5728\u4F60\u786E\u5B9E\u5361\u4F4F\u65F6\u624D\u7528\u2014\u2014\u522B\u7528\u5B83\u505A\u95F2\u804A\u3002",
|
|
@@ -1454,11 +1470,53 @@ async function handleBrowserTool(deps, gen, args) {
|
|
|
1454
1470
|
return result.return ?? null;
|
|
1455
1471
|
}
|
|
1456
1472
|
|
|
1473
|
+
// src/skill-bundle.ts
|
|
1474
|
+
import { readFileSync } from "fs";
|
|
1475
|
+
import { dirname, join } from "path";
|
|
1476
|
+
import { fileURLToPath } from "url";
|
|
1477
|
+
var SKILL_NAME = "atwebpilot-browser";
|
|
1478
|
+
var SKILL_DESCRIPTION = "Strategy + scenarios + safety rails for driving the AtWebPilot browser extension via MCP.";
|
|
1479
|
+
var cached = null;
|
|
1480
|
+
function locateSkillFile() {
|
|
1481
|
+
let here = dirname(fileURLToPath(import.meta.url));
|
|
1482
|
+
for (let i = 0; i < 6; i++) {
|
|
1483
|
+
const candidate = join(here, "skill", "SKILL.md");
|
|
1484
|
+
try {
|
|
1485
|
+
readFileSync(candidate, "utf-8");
|
|
1486
|
+
return candidate;
|
|
1487
|
+
} catch {
|
|
1488
|
+
}
|
|
1489
|
+
here = dirname(here);
|
|
1490
|
+
}
|
|
1491
|
+
return join(dirname(fileURLToPath(import.meta.url)), "../../../skill/SKILL.md");
|
|
1492
|
+
}
|
|
1493
|
+
function readSkillBundle() {
|
|
1494
|
+
if (cached == null) {
|
|
1495
|
+
try {
|
|
1496
|
+
cached = readFileSync(locateSkillFile(), "utf-8");
|
|
1497
|
+
} catch {
|
|
1498
|
+
cached = `# ${SKILL_NAME}
|
|
1499
|
+
|
|
1500
|
+
${SKILL_DESCRIPTION}
|
|
1501
|
+
|
|
1502
|
+
(Skill bundle not found at build time; see https://github.com/attson/atwebpilot)
|
|
1503
|
+
`;
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
return { name: SKILL_NAME, description: SKILL_DESCRIPTION, content: cached };
|
|
1507
|
+
}
|
|
1508
|
+
var SKILL_TOOL = {
|
|
1509
|
+
name: "atwebpilot_skill_read",
|
|
1510
|
+
description: "Return the `atwebpilot-browser` skill bundle \u2014 a recommended tool-usage flow, scenarios, and safety rails for driving AtWebPilot's browser tools.",
|
|
1511
|
+
inputSchema: { type: "object", properties: {}, required: [] }
|
|
1512
|
+
};
|
|
1513
|
+
|
|
1457
1514
|
// src/mcp-server.ts
|
|
1458
1515
|
var BROWSER_TOOLS = generateBrowserTools();
|
|
1459
1516
|
var BROWSER_BY_NAME = new Map(BROWSER_TOOLS.map((t) => [t.name, t]));
|
|
1460
1517
|
function buildToolList() {
|
|
1461
1518
|
return [
|
|
1519
|
+
{ name: SKILL_TOOL.name, description: SKILL_TOOL.description, inputSchema: SKILL_TOOL.inputSchema },
|
|
1462
1520
|
...CONTROL_TOOLS.map((t) => ({ name: t.name, description: t.description, inputSchema: t.inputSchema })),
|
|
1463
1521
|
...BROWSER_TOOLS.map((t) => ({ name: t.name, description: t.description, inputSchema: t.inputSchema }))
|
|
1464
1522
|
];
|
|
@@ -1467,6 +1525,10 @@ var ok = (data) => ({ content: [{ type: "text", text: JSON.stringify(data ?? nul
|
|
|
1467
1525
|
var fail2 = (message) => ({ content: [{ type: "text", text: message }], isError: true });
|
|
1468
1526
|
async function dispatchCall(deps, name, args) {
|
|
1469
1527
|
try {
|
|
1528
|
+
if (name === SKILL_TOOL.name) {
|
|
1529
|
+
const bundle = readSkillBundle();
|
|
1530
|
+
return { content: [{ type: "text", text: bundle.content }] };
|
|
1531
|
+
}
|
|
1470
1532
|
if (name === "list_tabs") return ok(handleListTabs(deps));
|
|
1471
1533
|
if (name === "open_session") return ok(handleOpenSession(deps, args));
|
|
1472
1534
|
if (name === "close_session") return ok(handleCloseSession(deps, args));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@attson/atwebpilot-mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "MCP server for the atwebpilot browser extension — let Claude Code drive your browser.",
|
|
6
6
|
"homepage": "https://github.com/attson/atwebpilot#readme",
|