agentic-browser 0.1.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.
@@ -0,0 +1,76 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import readline from "node:readline/promises";
4
+
5
+ //#region src/cli/commands/setup.ts
6
+ const SERVER_ENTRY = {
7
+ command: "npx",
8
+ args: ["agentic-browser", "mcp"]
9
+ };
10
+ function detectTools(cwd = process.cwd()) {
11
+ const targets = [];
12
+ targets.push({
13
+ name: "Claude Code (project)",
14
+ configPath: path.join(cwd, ".mcp.json")
15
+ });
16
+ const cursorDir = path.join(cwd, ".cursor");
17
+ if (fs.existsSync(cursorDir)) targets.push({
18
+ name: "Cursor",
19
+ configPath: path.join(cursorDir, "mcp.json")
20
+ });
21
+ return targets;
22
+ }
23
+ function readJsonFile(filePath) {
24
+ if (!fs.existsSync(filePath)) return {};
25
+ try {
26
+ return JSON.parse(fs.readFileSync(filePath, "utf8"));
27
+ } catch {
28
+ return {};
29
+ }
30
+ }
31
+ function writeJsonFile(filePath, data) {
32
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
33
+ fs.writeFileSync(filePath, `${JSON.stringify(data, null, 2)}\n`);
34
+ }
35
+ function applyConfig(target) {
36
+ const config = readJsonFile(target.configPath);
37
+ config.mcpServers = config.mcpServers ?? {};
38
+ config.mcpServers["agentic-browser"] = SERVER_ENTRY;
39
+ writeJsonFile(target.configPath, config);
40
+ }
41
+ async function runSetup() {
42
+ const targets = detectTools();
43
+ console.log("agentic-browser — MCP server setup\n");
44
+ console.log("Detected targets:\n");
45
+ for (let i = 0; i < targets.length; i++) {
46
+ const exists = fs.existsSync(targets[i].configPath) ? "" : " (will create)";
47
+ console.log(` ${i + 1}. ${targets[i].name}${exists}`);
48
+ }
49
+ if (targets.length > 1) console.log(` ${targets.length + 1}. All of the above`);
50
+ console.log();
51
+ const rl = readline.createInterface({
52
+ input: process.stdin,
53
+ output: process.stdout
54
+ });
55
+ try {
56
+ const max = targets.length > 1 ? targets.length + 1 : targets.length;
57
+ const answer = await rl.question(`Select [1-${max}]: `);
58
+ const choice = Number.parseInt(answer, 10);
59
+ if (Number.isNaN(choice) || choice < 1 || choice > max) {
60
+ console.log("Invalid selection.");
61
+ return;
62
+ }
63
+ const selected = choice === targets.length + 1 ? targets : [targets[choice - 1]];
64
+ console.log();
65
+ for (const target of selected) {
66
+ applyConfig(target);
67
+ console.log(` Configured ${target.configPath}`);
68
+ }
69
+ console.log("\nDone. Restart your AI tool to pick up the new MCP server.");
70
+ } finally {
71
+ rl.close();
72
+ }
73
+ }
74
+
75
+ //#endregion
76
+ export { runSetup };
@@ -0,0 +1,3 @@
1
+ export function startBackgroundBridge(): void {
2
+ // Placeholder for extension-side bridge bootstrap.
3
+ }
@@ -0,0 +1,3 @@
1
+ export function startContentBridge(): void {
2
+ // Placeholder for content script bridge bootstrap.
3
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "manifest_version": 3,
3
+ "name": "Agentic Browser Control",
4
+ "version": "0.1.0",
5
+ "permissions": ["tabs", "scripting", "storage"],
6
+ "host_permissions": ["<all_urls>"],
7
+ "background": {
8
+ "service_worker": "background/index.js",
9
+ "type": "module"
10
+ },
11
+ "content_scripts": [
12
+ {
13
+ "matches": ["<all_urls>"],
14
+ "js": ["content/index.js"],
15
+ "run_at": "document_idle"
16
+ }
17
+ ]
18
+ }
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "agentic-browser",
3
+ "version": "0.1.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/ph1p/agentic-browser.git"
7
+ },
8
+ "type": "module",
9
+ "exports": {
10
+ ".": "./dist/index.mjs",
11
+ "./cli": "./dist/cli/index.mjs",
12
+ "./mcp": "./dist/mcp/index.mjs"
13
+ },
14
+ "main": "dist/index.mjs",
15
+ "bin": {
16
+ "agentic-browser": "dist/cli/index.mjs"
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "extension",
21
+ "AGENTS.md",
22
+ "README.md"
23
+ ],
24
+ "scripts": {
25
+ "build": "tsdown",
26
+ "docs:build": "vocs build",
27
+ "docs:dev": "vocs dev",
28
+ "docs:preview": "vocs preview",
29
+ "format": "oxfmt --write .",
30
+ "format:check": "oxfmt --check .",
31
+ "lint": "oxlint -c .oxlintrc.json --deny-warnings .",
32
+ "lint:fix": "oxlint -c .oxlintrc.json --fix .",
33
+ "prepublishOnly": "pnpm build && pnpm test",
34
+ "release": "semantic-release",
35
+ "release:dry": "semantic-release --dry-run",
36
+ "test": "vitest run",
37
+ "test:watch": "vitest",
38
+ "typecheck": "tsc"
39
+ },
40
+ "dependencies": {
41
+ "@modelcontextprotocol/sdk": "^1.26.0",
42
+ "commander": "^14.0.3",
43
+ "ws": "^8.19.0",
44
+ "zod": "^4.3.6"
45
+ },
46
+ "devDependencies": {
47
+ "@semantic-release/commit-analyzer": "^13.0.1",
48
+ "@semantic-release/github": "^11.0.6",
49
+ "@semantic-release/npm": "^12.0.2",
50
+ "@semantic-release/release-notes-generator": "^14.1.0",
51
+ "@types/node": "^25.3.0",
52
+ "@types/ws": "^8.18.1",
53
+ "oxfmt": "^0.34.0",
54
+ "oxlint": "^1.49.0",
55
+ "react": "^19.2.4",
56
+ "react-dom": "^19.2.4",
57
+ "semantic-release": "^24.2.9",
58
+ "tsdown": "^0.20.3",
59
+ "typescript": "^5.9.3",
60
+ "vitest": "^4.0.18",
61
+ "vocs": "1.4.1"
62
+ },
63
+ "packageManager": "pnpm@10.30.1",
64
+ "publishConfig": {
65
+ "access": "public",
66
+ "registry": "https://registry.npmjs.org/"
67
+ }
68
+ }