@attson/atwebpilot-mcp 0.0.27 → 0.0.29

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.
Files changed (2) hide show
  1. package/dist/index.js +77 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -636,6 +636,8 @@ function capabilityForTool(tool, opts) {
636
636
  return "upload:file";
637
637
  case "httpRequest":
638
638
  return opts?.httpCookied ? "httpRequest:cookied" : "httpRequest:no-cookie";
639
+ case "askUser":
640
+ return "read:dom";
639
641
  default: {
640
642
  const _exhaustive = tool;
641
643
  throw new Error(`capabilityForTool: unknown tool ${_exhaustive}`);
@@ -1336,6 +1338,35 @@ var TOOL_DEFS = [
1336
1338
  properties: { tabId: { type: "integer" } },
1337
1339
  required: ["tabId"]
1338
1340
  }
1341
+ },
1342
+ {
1343
+ name: "askUser",
1344
+ 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",
1345
+ input_schema: {
1346
+ type: "object",
1347
+ properties: {
1348
+ prompt: { type: "string", description: "\u5411\u7528\u6237\u5C55\u793A\u7684\u95EE\u9898\u6587\u672C" },
1349
+ kind: {
1350
+ type: "string",
1351
+ enum: ["select", "confirm", "text"],
1352
+ description: "select=\u7528\u6237\u4ECE options \u9009\u4E00\u9879\uFF1Bconfirm=\u662F/\u5426\uFF1Btext=\u81EA\u7531\u6587\u672C"
1353
+ },
1354
+ options: {
1355
+ type: "array",
1356
+ description: "kind=select \u65F6\u5FC5\u586B\uFF0C\u6BCF\u9879 {id, label, description?}",
1357
+ items: {
1358
+ type: "object",
1359
+ properties: {
1360
+ id: { type: "string" },
1361
+ label: { type: "string" },
1362
+ description: { type: "string" }
1363
+ },
1364
+ required: ["id", "label"]
1365
+ }
1366
+ }
1367
+ },
1368
+ required: ["prompt", "kind"]
1369
+ }
1339
1370
  }
1340
1371
  ];
1341
1372
 
@@ -1423,11 +1454,53 @@ async function handleBrowserTool(deps, gen, args) {
1423
1454
  return result.return ?? null;
1424
1455
  }
1425
1456
 
1457
+ // src/skill-bundle.ts
1458
+ import { readFileSync } from "fs";
1459
+ import { dirname, join } from "path";
1460
+ import { fileURLToPath } from "url";
1461
+ var SKILL_NAME = "atwebpilot-browser";
1462
+ var SKILL_DESCRIPTION = "Strategy + scenarios + safety rails for driving the AtWebPilot browser extension via MCP.";
1463
+ var cached = null;
1464
+ function locateSkillFile() {
1465
+ let here = dirname(fileURLToPath(import.meta.url));
1466
+ for (let i = 0; i < 6; i++) {
1467
+ const candidate = join(here, "skill", "SKILL.md");
1468
+ try {
1469
+ readFileSync(candidate, "utf-8");
1470
+ return candidate;
1471
+ } catch {
1472
+ }
1473
+ here = dirname(here);
1474
+ }
1475
+ return join(dirname(fileURLToPath(import.meta.url)), "../../../skill/SKILL.md");
1476
+ }
1477
+ function readSkillBundle() {
1478
+ if (cached == null) {
1479
+ try {
1480
+ cached = readFileSync(locateSkillFile(), "utf-8");
1481
+ } catch {
1482
+ cached = `# ${SKILL_NAME}
1483
+
1484
+ ${SKILL_DESCRIPTION}
1485
+
1486
+ (Skill bundle not found at build time; see https://github.com/attson/atwebpilot)
1487
+ `;
1488
+ }
1489
+ }
1490
+ return { name: SKILL_NAME, description: SKILL_DESCRIPTION, content: cached };
1491
+ }
1492
+ var SKILL_TOOL = {
1493
+ name: "atwebpilot_skill_read",
1494
+ description: "Return the `atwebpilot-browser` skill bundle \u2014 a recommended tool-usage flow, scenarios, and safety rails for driving AtWebPilot's browser tools.",
1495
+ inputSchema: { type: "object", properties: {}, required: [] }
1496
+ };
1497
+
1426
1498
  // src/mcp-server.ts
1427
1499
  var BROWSER_TOOLS = generateBrowserTools();
1428
1500
  var BROWSER_BY_NAME = new Map(BROWSER_TOOLS.map((t) => [t.name, t]));
1429
1501
  function buildToolList() {
1430
1502
  return [
1503
+ { name: SKILL_TOOL.name, description: SKILL_TOOL.description, inputSchema: SKILL_TOOL.inputSchema },
1431
1504
  ...CONTROL_TOOLS.map((t) => ({ name: t.name, description: t.description, inputSchema: t.inputSchema })),
1432
1505
  ...BROWSER_TOOLS.map((t) => ({ name: t.name, description: t.description, inputSchema: t.inputSchema }))
1433
1506
  ];
@@ -1436,6 +1509,10 @@ var ok = (data) => ({ content: [{ type: "text", text: JSON.stringify(data ?? nul
1436
1509
  var fail2 = (message) => ({ content: [{ type: "text", text: message }], isError: true });
1437
1510
  async function dispatchCall(deps, name, args) {
1438
1511
  try {
1512
+ if (name === SKILL_TOOL.name) {
1513
+ const bundle = readSkillBundle();
1514
+ return { content: [{ type: "text", text: bundle.content }] };
1515
+ }
1439
1516
  if (name === "list_tabs") return ok(handleListTabs(deps));
1440
1517
  if (name === "open_session") return ok(handleOpenSession(deps, args));
1441
1518
  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.27",
3
+ "version": "0.0.29",
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",