@mehmoodqureshi/chrome-mcp 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.
Files changed (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +129 -0
  3. package/dist/shared/download.d.ts +15 -0
  4. package/dist/shared/download.js +0 -0
  5. package/dist/shared/protocol.d.ts +114 -0
  6. package/dist/shared/protocol.js +55 -0
  7. package/dist/src/bridge/auth.d.ts +32 -0
  8. package/dist/src/bridge/auth.js +76 -0
  9. package/dist/src/bridge/connection.d.ts +48 -0
  10. package/dist/src/bridge/connection.js +192 -0
  11. package/dist/src/bridge/datadir.d.ts +8 -0
  12. package/dist/src/bridge/datadir.js +22 -0
  13. package/dist/src/bridge/server.d.ts +58 -0
  14. package/dist/src/bridge/server.js +178 -0
  15. package/dist/src/cli.d.ts +11 -0
  16. package/dist/src/cli.js +93 -0
  17. package/dist/src/config.d.ts +42 -0
  18. package/dist/src/config.js +188 -0
  19. package/dist/src/executor/cdp-executor.d.ts +131 -0
  20. package/dist/src/executor/cdp-executor.js +422 -0
  21. package/dist/src/executor/extension-executor.d.ts +102 -0
  22. package/dist/src/executor/extension-executor.js +124 -0
  23. package/dist/src/executor/manager.d.ts +43 -0
  24. package/dist/src/executor/manager.js +94 -0
  25. package/dist/src/executor/select.d.ts +23 -0
  26. package/dist/src/executor/select.js +53 -0
  27. package/dist/src/executor/stub-executor.d.ts +60 -0
  28. package/dist/src/executor/stub-executor.js +118 -0
  29. package/dist/src/executor/types.d.ts +192 -0
  30. package/dist/src/executor/types.js +24 -0
  31. package/dist/src/mcp/envelopes.d.ts +13 -0
  32. package/dist/src/mcp/envelopes.js +30 -0
  33. package/dist/src/mcp/helpers.d.ts +37 -0
  34. package/dist/src/mcp/helpers.js +71 -0
  35. package/dist/src/mcp/markdown-extract.d.ts +9 -0
  36. package/dist/src/mcp/markdown-extract.js +61 -0
  37. package/dist/src/mcp/server.d.ts +18 -0
  38. package/dist/src/mcp/server.js +82 -0
  39. package/dist/src/mcp/tools.d.ts +32 -0
  40. package/dist/src/mcp/tools.js +267 -0
  41. package/dist/src/mcp/validators.d.ts +32 -0
  42. package/dist/src/mcp/validators.js +104 -0
  43. package/dist/src/security/policy.d.ts +48 -0
  44. package/dist/src/security/policy.js +155 -0
  45. package/docs/BLUEPRINT.md +596 -0
  46. package/extension-dist/background.js +567 -0
  47. package/extension-dist/manifest.json +12 -0
  48. package/extension-dist/options.html +32 -0
  49. package/extension-dist/options.js +37 -0
  50. package/package.json +69 -0
  51. package/scripts/postinstall.js +50 -0
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@mehmoodqureshi/chrome-mcp",
3
+ "version": "0.1.0",
4
+ "description": "Drive a real Chrome browser over MCP. A stdio MCP server (CLI) plus an MV3 extension, behind one pluggable Executor (extension via chrome.scripting, or a Playwright CDP fallback).",
5
+ "author": "Mehmood Ur Rehman Qureshi",
6
+ "license": "MIT",
7
+ "homepage": "https://github.com/Mehmoodqureshi/chrome-mcp#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Mehmoodqureshi/chrome-mcp.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/Mehmoodqureshi/chrome-mcp/issues"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "bin": {
19
+ "chrome-mcp": "dist/src/cli.js"
20
+ },
21
+ "files": [
22
+ "dist/src/**/*.js",
23
+ "dist/src/**/*.d.ts",
24
+ "dist/shared/**/*.js",
25
+ "dist/shared/**/*.d.ts",
26
+ "extension-dist",
27
+ "scripts/postinstall.js",
28
+ "README.md",
29
+ "LICENSE",
30
+ "docs/BLUEPRINT.md"
31
+ ],
32
+ "keywords": [
33
+ "mcp",
34
+ "model-context-protocol",
35
+ "chrome",
36
+ "chrome-extension",
37
+ "browser-automation",
38
+ "cdp",
39
+ "playwright",
40
+ "claude"
41
+ ],
42
+ "scripts": {
43
+ "build": "tsc -p tsconfig.json",
44
+ "build:ext": "node extension/scripts/build-ext.mjs",
45
+ "typecheck": "tsc -p tsconfig.json --noEmit",
46
+ "typecheck:ext": "tsc -p tsconfig.ext.json",
47
+ "clean": "rimraf dist extension-dist",
48
+ "test": "npm run clean && npm run build && npm run build:ext && node --test dist/test",
49
+ "test:hitl": "npm run build && node dist/hitl/index.js",
50
+ "prepack": "npm run clean && npm run build && npm run build:ext",
51
+ "postinstall": "node scripts/postinstall.js"
52
+ },
53
+ "dependencies": {
54
+ "@modelcontextprotocol/sdk": "^1.0.4",
55
+ "playwright": "^1.49.1",
56
+ "ws": "^8.18.0"
57
+ },
58
+ "devDependencies": {
59
+ "@types/chrome": "^0.0.287",
60
+ "@types/node": "^20.17.10",
61
+ "@types/ws": "^8.5.13",
62
+ "esbuild": "^0.24.0",
63
+ "rimraf": "^5.0.10",
64
+ "typescript": "^5.7.2"
65
+ },
66
+ "engines": {
67
+ "node": ">=20.0.0"
68
+ }
69
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * postinstall — install the Chromium that the CDP fallback needs.
3
+ *
4
+ * Skip-guarded and never fatal: a failure here must not break `npm install`
5
+ * (the extension path needs no browser, and CI rarely wants the download).
6
+ * Skips when:
7
+ * - CHROME_MCP_SKIP_BROWSER_DOWNLOAD / PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD is set,
8
+ * - CI is set,
9
+ * - playwright is not installed yet (it is added in phase 3).
10
+ */
11
+ 'use strict';
12
+
13
+ function shouldSkip() {
14
+ return (
15
+ process.env.CHROME_MCP_SKIP_BROWSER_DOWNLOAD === '1' ||
16
+ process.env.PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD === '1' ||
17
+ process.env.CI === 'true' ||
18
+ process.env.CI === '1'
19
+ );
20
+ }
21
+
22
+ function hasPlaywright() {
23
+ try {
24
+ require.resolve('playwright');
25
+ return true;
26
+ } catch {
27
+ return false;
28
+ }
29
+ }
30
+
31
+ function main() {
32
+ if (shouldSkip()) {
33
+ process.stdout.write('[postinstall] skipping Chromium download (guard set).\n');
34
+ return;
35
+ }
36
+ if (!hasPlaywright()) {
37
+ process.stdout.write('[postinstall] playwright not installed; CDP fallback unavailable until phase 3.\n');
38
+ return;
39
+ }
40
+ try {
41
+ const { execFileSync } = require('node:child_process');
42
+ execFileSync('npx', ['playwright', 'install', 'chromium'], { stdio: 'inherit' });
43
+ } catch (err) {
44
+ process.stdout.write(
45
+ `[postinstall] Chromium install skipped (non-fatal): ${err && err.message ? err.message : err}\n`,
46
+ );
47
+ }
48
+ }
49
+
50
+ main();