real-browser-mcp-server 2.0.0 → 2.0.4

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 (55) hide show
  1. package/README.md +2 -2
  2. package/dist/lib/cjs/index.d.ts +2 -13
  3. package/dist/lib/cjs/index.d.ts.map +1 -1
  4. package/dist/lib/cjs/index.js.map +1 -1
  5. package/dist/lib/esm/index.d.mjs +2 -9
  6. package/dist/src/mcp/handlers/browser.d.ts +1 -1
  7. package/dist/src/mcp/handlers/browser.d.ts.map +1 -1
  8. package/dist/src/mcp/handlers/browser.js +62 -109
  9. package/dist/src/mcp/handlers/browser.js.map +1 -1
  10. package/dist/src/mcp/handlers/dom.d.ts +1 -1
  11. package/dist/src/mcp/handlers/dom.d.ts.map +1 -1
  12. package/dist/src/mcp/handlers/dom.js +90 -11
  13. package/dist/src/mcp/handlers/dom.js.map +1 -1
  14. package/dist/src/mcp/handlers/index.d.ts +2 -2
  15. package/dist/src/mcp/handlers/index.d.ts.map +1 -1
  16. package/dist/src/mcp/handlers/index.js +1 -14
  17. package/dist/src/mcp/handlers/index.js.map +1 -1
  18. package/dist/src/mcp/handlers/network.d.ts.map +1 -1
  19. package/dist/src/mcp/handlers/network.js +16 -3
  20. package/dist/src/mcp/handlers/network.js.map +1 -1
  21. package/dist/src/mcp/handlers/state.d.ts +0 -2
  22. package/dist/src/mcp/handlers/state.d.ts.map +1 -1
  23. package/dist/src/mcp/handlers/state.js +1 -8
  24. package/dist/src/mcp/handlers/state.js.map +1 -1
  25. package/dist/src/mcp/handlers/utility-handlers.d.ts +1 -4
  26. package/dist/src/mcp/handlers/utility-handlers.d.ts.map +1 -1
  27. package/dist/src/mcp/handlers/utility-handlers.js +12 -2
  28. package/dist/src/mcp/handlers/utility-handlers.js.map +1 -1
  29. package/dist/src/shared/activity-logger.d.ts +1 -2
  30. package/dist/src/shared/activity-logger.d.ts.map +1 -1
  31. package/dist/src/shared/activity-logger.js +1 -2
  32. package/dist/src/shared/activity-logger.js.map +1 -1
  33. package/dist/src/shared/lib-core.d.ts +18 -11
  34. package/dist/src/shared/lib-core.d.ts.map +1 -1
  35. package/dist/src/shared/lib-core.js +14 -34
  36. package/dist/src/shared/lib-core.js.map +1 -1
  37. package/dist/src/types.d.ts +8 -89
  38. package/dist/src/types.d.ts.map +1 -1
  39. package/package.json +5 -7
  40. package/dist/src/shared/cache-manager.d.ts +0 -78
  41. package/dist/src/shared/cache-manager.d.ts.map +0 -1
  42. package/dist/src/shared/cache-manager.js +0 -219
  43. package/dist/src/shared/cache-manager.js.map +0 -1
  44. package/dist/test/cjs/test.d.ts +0 -11
  45. package/dist/test/cjs/test.d.ts.map +0 -1
  46. package/dist/test/cjs/test.js +0 -242
  47. package/dist/test/cjs/test.js.map +0 -1
  48. package/dist/test/mcp/smoke-test.d.ts +0 -29
  49. package/dist/test/mcp/smoke-test.d.ts.map +0 -1
  50. package/dist/test/mcp/smoke-test.js +0 -144
  51. package/dist/test/mcp/smoke-test.js.map +0 -1
  52. package/dist/test/unit/handler-test.d.ts +0 -3
  53. package/dist/test/unit/handler-test.d.ts.map +0 -1
  54. package/dist/test/unit/handler-test.js +0 -133
  55. package/dist/test/unit/handler-test.js.map +0 -1
@@ -1,219 +0,0 @@
1
- "use strict";
2
- /**
3
- * Cache Manager — JSON-based persistent storage
4
- *
5
- * Provides a centralized cache that persists to disk as JSON.
6
- * Survives server restarts. Used by AI Core and browser state.
7
- */
8
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- var desc = Object.getOwnPropertyDescriptor(m, k);
11
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
- desc = { enumerable: true, get: function() { return m[k]; } };
13
- }
14
- Object.defineProperty(o, k2, desc);
15
- }) : (function(o, m, k, k2) {
16
- if (k2 === undefined) k2 = k;
17
- o[k2] = m[k];
18
- }));
19
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
- Object.defineProperty(o, "default", { enumerable: true, value: v });
21
- }) : function(o, v) {
22
- o["default"] = v;
23
- });
24
- var __importStar = (this && this.__importStar) || (function () {
25
- var ownKeys = function(o) {
26
- ownKeys = Object.getOwnPropertyNames || function (o) {
27
- var ar = [];
28
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
- return ar;
30
- };
31
- return ownKeys(o);
32
- };
33
- return function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- })();
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.CacheManager = void 0;
43
- const fs = __importStar(require("fs"));
44
- const path = __importStar(require("path"));
45
- const DEFAULT_CONFIG = {
46
- cacheDir: path.join(process.cwd(), '.cache'),
47
- autoSaveInterval: 30000, // 30 seconds
48
- maxEntries: 1000,
49
- defaultTTL: null,
50
- };
51
- class CacheManager {
52
- cache;
53
- cacheFile;
54
- config;
55
- saveTimer = null;
56
- dirty = false;
57
- constructor(config = {}) {
58
- this.config = { ...DEFAULT_CONFIG, ...config };
59
- this.cacheFile = path.join(this.config.cacheDir, 'browser_state.json');
60
- this.cache = new Map();
61
- this.loadFromDisk();
62
- // Auto-save periodically
63
- if (this.config.autoSaveInterval > 0) {
64
- this.saveTimer = setInterval(() => {
65
- if (this.dirty) {
66
- this.saveToDisk();
67
- }
68
- }, this.config.autoSaveInterval);
69
- // Prevent timer from keeping Node alive
70
- if (this.saveTimer && typeof this.saveTimer.unref === 'function') {
71
- this.saveTimer.unref();
72
- }
73
- }
74
- }
75
- /**
76
- * Get a value from cache. Returns undefined if not found or expired.
77
- */
78
- get(key) {
79
- const entry = this.cache.get(key);
80
- if (!entry)
81
- return undefined;
82
- // Check TTL
83
- if (entry.ttl !== null && Date.now() - entry.createdAt > entry.ttl) {
84
- this.cache.delete(key);
85
- this.dirty = true;
86
- return undefined;
87
- }
88
- return entry.value;
89
- }
90
- /**
91
- * Set a value in cache with optional TTL.
92
- */
93
- set(key, value, ttl) {
94
- // Prune if at capacity
95
- if (this.cache.size >= this.config.maxEntries && !this.cache.has(key)) {
96
- this.prune();
97
- }
98
- this.cache.set(key, {
99
- value,
100
- createdAt: Date.now(),
101
- ttl: ttl !== undefined ? ttl : this.config.defaultTTL,
102
- });
103
- this.dirty = true;
104
- }
105
- /**
106
- * Check if a key exists and is not expired.
107
- */
108
- has(key) {
109
- return this.get(key) !== undefined;
110
- }
111
- /**
112
- * Delete a specific key from cache.
113
- */
114
- delete(key) {
115
- const existed = this.cache.delete(key);
116
- if (existed)
117
- this.dirty = true;
118
- return existed;
119
- }
120
- /**
121
- * Clear all cache entries.
122
- */
123
- clear() {
124
- this.cache.clear();
125
- this.dirty = true;
126
- }
127
- /**
128
- * Get all keys in cache.
129
- */
130
- keys() {
131
- return [...this.cache.keys()];
132
- }
133
- /**
134
- * Get cache statistics.
135
- */
136
- stats() {
137
- return {
138
- size: this.cache.size,
139
- maxEntries: this.config.maxEntries,
140
- cacheFile: this.cacheFile,
141
- };
142
- }
143
- /**
144
- * Load cache from JSON file on disk.
145
- */
146
- loadFromDisk() {
147
- try {
148
- if (fs.existsSync(this.cacheFile)) {
149
- const raw = fs.readFileSync(this.cacheFile, 'utf-8');
150
- const data = JSON.parse(raw);
151
- for (const [key, entry] of Object.entries(data)) {
152
- // Skip expired entries while loading
153
- if (entry.ttl !== null && Date.now() - entry.createdAt > entry.ttl) {
154
- continue;
155
- }
156
- this.cache.set(key, entry);
157
- }
158
- console.error(`📦 [CacheManager] Loaded ${this.cache.size} entries from disk`);
159
- }
160
- }
161
- catch (e) {
162
- const msg = e instanceof Error ? e.message : String(e);
163
- console.error(`⚠️ [CacheManager] Failed to load cache: ${msg}`);
164
- }
165
- }
166
- /**
167
- * Save cache to JSON file on disk.
168
- */
169
- saveToDisk() {
170
- try {
171
- const dir = path.dirname(this.cacheFile);
172
- if (!fs.existsSync(dir)) {
173
- fs.mkdirSync(dir, { recursive: true });
174
- }
175
- const data = Object.fromEntries(this.cache);
176
- fs.writeFileSync(this.cacheFile, JSON.stringify(data, null, 2), 'utf-8');
177
- this.dirty = false;
178
- }
179
- catch (e) {
180
- const msg = e instanceof Error ? e.message : String(e);
181
- console.error(`⚠️ [CacheManager] Failed to save cache: ${msg}`);
182
- }
183
- }
184
- /**
185
- * Remove expired entries and oldest entries if over capacity.
186
- */
187
- prune() {
188
- const now = Date.now();
189
- // Remove expired entries first
190
- for (const [key, entry] of this.cache) {
191
- if (entry.ttl !== null && now - entry.createdAt > entry.ttl) {
192
- this.cache.delete(key);
193
- }
194
- }
195
- // If still over capacity, remove oldest entries
196
- if (this.cache.size >= this.config.maxEntries) {
197
- const entries = [...this.cache.entries()].sort((a, b) => a[1].createdAt - b[1].createdAt);
198
- const toRemove = entries.slice(0, Math.floor(this.config.maxEntries * 0.2)); // Remove oldest 20%
199
- for (const [key] of toRemove) {
200
- this.cache.delete(key);
201
- }
202
- }
203
- this.dirty = true;
204
- }
205
- /**
206
- * Cleanup: stop timer and save final state.
207
- */
208
- destroy() {
209
- if (this.saveTimer) {
210
- clearInterval(this.saveTimer);
211
- this.saveTimer = null;
212
- }
213
- if (this.dirty) {
214
- this.saveToDisk();
215
- }
216
- }
217
- }
218
- exports.CacheManager = CacheManager;
219
- //# sourceMappingURL=cache-manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cache-manager.js","sourceRoot":"","sources":["../../../src/shared/cache-manager.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,2CAA6B;AAmB7B,MAAM,cAAc,GAAgB;IAClC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC;IAC5C,gB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CAAC,GAAG,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;QAED,gDAAgD;QAChD,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YAC9C,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAC1F,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,oBAAoB;YACjG,KAAK,MAAM,CAAC,GAAG,CAAC,IAAI,QAAQ,EAAE,CAAC;gBAC7B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC9B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACxB,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,CAAC;IACH,CAAC;CACF;AAzLD,oCAyLC"}
@@ -1,11 +0,0 @@
1
- declare const test: any;
2
- declare const assert: any;
3
- declare const connect: any;
4
- declare const realBrowserOption: {
5
- turnstile: boolean;
6
- headless: boolean;
7
- customConfig: {};
8
- };
9
- declare let browser: null;
10
- declare let page: null;
11
- //# sourceMappingURL=test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../test/cjs/test.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,IAAI,KAAuB,CAAC;AAClC,QAAA,MAAM,MAAM,KAAyB,CAAC;AACtC,QAAA,MAAQ,OAAO,KAAsC,CAAC;AAEtD,QAAA,MAAM,iBAAiB;;;;CAItB,CAAA;AAGD,QAAA,IAAI,OAAO,MAAO,CAAC;AACnB,QAAA,IAAI,IAAI,MAAO,CAAC"}
@@ -1,242 +0,0 @@
1
- "use strict";
2
- // @ts-nocheck
3
- const test = require('node:test');
4
- const assert = require('node:assert');
5
- const { connect } = require('../../lib/cjs/index.js');
6
- const realBrowserOption = {
7
- turnstile: true,
8
- headless: false,
9
- customConfig: {}
10
- };
11
- // Shared browser instance for all tests
12
- let browser = null;
13
- let page = null;
14
- // Setup - Run once before all tests
15
- test.before(async () => {
16
- console.log('🚀 Starting browser for all tests...');
17
- const result = await connect(realBrowserOption);
18
- browser = result.browser;
19
- page = result.page;
20
- console.log('✅ Browser started successfully');
21
- });
22
- // Teardown - Run once after all tests
23
- test.after(async () => {
24
- console.log('🏁 Closing browser after all tests...');
25
- if (browser) {
26
- await browser.close();
27
- console.log('✅ Browser closed successfully');
28
- }
29
- });
30
- test('Headless Detection Test', async () => {
31
- await page.waitForLoadState('load', { timeout: 10000 }).catch(() => { });
32
- await page.goto('about:blank', { timeout: 5000 }).catch(() => { });
33
- await page.waitForLoadState('load', { timeout: 5000 }).catch(() => { });
34
- await page.goto("https://arh.antoinevastel.com/bots/areyouheadless", { timeout: 70000 });
35
- await new Promise(r => setTimeout(r, 3000));
36
- let result = await page.evaluate(() => {
37
- const el = document.querySelector('#res');
38
- return el && el.textContent.toLowerCase().includes('not') ? true : false;
39
- });
40
- assert.strictEqual(result, true, "Headless Detection test failed! Browser detected as headless.");
41
- });
42
- test('Rebrowser Bot Detector', async () => {
43
- await page.waitForLoadState('load', { timeout: 10000 }).catch(() => { });
44
- await page.goto('about:blank', { timeout: 5000 }).catch(() => { });
45
- await page.waitForLoadState('load', { timeout: 5000 }).catch(() => { });
46
- await page.goto("https://bot-detector.rebrowser.net/", { waitUntil: 'domcontentloaded', timeout: 70000 });
47
- await new Promise(r => setTimeout(r, 100)); // Very short delay to ensure page scripts initialized
48
- // Use CDP to trigger tests in the main world (Patchright's page.evaluate runs in isolated world)
49
- const client = await page.context().newCDPSession(page);
50
- // dummyFn: call in main world to prove we can access main world objects
51
- await client.send('Runtime.evaluate', { expression: 'window.dummyFn()' }).catch(() => { });
52
- // exposeFunctionLeak: create a normal function (not via page.exposeFunction which leaks Playwright bindings)
53
- await client.send('Runtime.evaluate', { expression: "window.exposedFn = () => { console.log('exposedFn call') }" }).catch(() => { });
54
- // sourceUrlLeak: test if evaluate leaks sourceUrl via getElementById
55
- await client.send('Runtime.evaluate', { expression: "document.getElementById('detections-json')" }).catch(() => { });
56
- // mainWorldExecution: test if evaluate runs in isolated world (safe) vs main world (detectable)
57
- await page.evaluate(() => document.getElementsByClassName('div')).catch(() => { });
58
- await new Promise(r => setTimeout(r, 5000));
59
- const detections = await page.evaluate(() => {
60
- const el = document.querySelector('#detections-json');
61
- try {
62
- return JSON.parse(el?.value || '');
63
- }
64
- catch {
65
- return null;
66
- }
67
- });
68
- // console.log('🔍 Rebrowser Detections:', JSON.stringify(detections, null, 2));
69
- assert.ok(detections !== null, "Rebrowser Bot Detector: Could not read detection JSON from page");
70
- const detected = detections.filter((d) => d.rating === 1);
71
- if (detected.length > 0) {
72
- console.log('⚠️ Detected as bot for:', detected.map((d) => d.type).join(', '));
73
- }
74
- assert.strictEqual(detected.length, 0, `Rebrowser Bot Detector failed! Detected: ${detected.map((d) => d.type).join(', ')}`);
75
- });
76
- test('Sannysoft WebDriver Detector', async () => {
77
- await page.waitForLoadState('load', { timeout: 10000 }).catch(() => { });
78
- await page.goto('about:blank', { timeout: 5000 }).catch(() => { });
79
- await page.waitForLoadState('load', { timeout: 5000 }).catch(() => { });
80
- await page.goto("https://bot.sannysoft.com/", { timeout: 70000 });
81
- await new Promise(r => setTimeout(r, 3000));
82
- let result = await page.evaluate(() => {
83
- const webdriverEl = document.getElementById('webdriver-result');
84
- return webdriverEl && webdriverEl.classList.contains('passed');
85
- });
86
- assert.strictEqual(result, true, "Sannysoft WebDriver Detector test failed! Browser detected as bot.");
87
- });
88
- test('Cloudflare WAF', async () => {
89
- await page.waitForLoadState('load', { timeout: 10000 }).catch(() => { });
90
- await page.goto('about:blank', { timeout: 5000 }).catch(() => { });
91
- await page.waitForLoadState('load', { timeout: 5000 }).catch(() => { });
92
- await page.goto("https://nopecha.com/demo/cloudflare", { timeout: 70000 });
93
- let verify = null;
94
- let startDate = Date.now();
95
- // Increased timeout to 60 seconds to allow turnstile to be solved
96
- while (!verify && (Date.now() - startDate) < 50000) {
97
- verify = await page.evaluate(() => {
98
- // Check if we passed the challenge - look for main content
99
- return document.querySelector('.link_row') || document.querySelector('a[href*="nopecha"]') ? true : null;
100
- }).catch(() => null);
101
- await new Promise(r => setTimeout(r, 2000));
102
- }
103
- assert.strictEqual(verify === true, true, "Cloudflare WAF test failed! (Site may be blocking automated access)");
104
- });
105
- test('Cloudflare Turnstile', async () => {
106
- await page.waitForLoadState('load', { timeout: 10000 }).catch(() => { });
107
- await page.goto('about:blank', { timeout: 5000 }).catch(() => { });
108
- await page.waitForLoadState('load', { timeout: 5000 }).catch(() => { });
109
- await page.goto("https://2captcha.com/demo/cloudflare-turnstile", { timeout: 70000 });
110
- await page.waitForSelector('.cf-turnstile');
111
- let token = null;
112
- let startDate = Date.now();
113
- while (!token && (Date.now() - startDate) < 30000) {
114
- token = await page.evaluate(() => {
115
- try {
116
- let item = document.querySelector('[name="cf-turnstile-response"]')?.value;
117
- return item && item.length > 20 ? item : null;
118
- }
119
- catch (e) {
120
- return null;
121
- }
122
- });
123
- await new Promise(r => setTimeout(r, 1000));
124
- }
125
- assert.strictEqual(token !== null, true, "Cloudflare turnstile test failed!");
126
- });
127
- test('Fingerprint JS Bot Detector', async () => {
128
- await page.waitForLoadState('load', { timeout: 10000 }).catch(() => { });
129
- await page.goto('about:blank', { timeout: 5000 }).catch(() => { });
130
- await page.waitForLoadState('load', { timeout: 5000 }).catch(() => { });
131
- // Use domcontentloaded + higher timeout to avoid timeout on heavy pages
132
- await page.goto("https://fingerprint.com/products/bot-detection/", { waitUntil: 'domcontentloaded', timeout: 70000 });
133
- await new Promise(r => setTimeout(r, 5000));
134
- const detect = await page.evaluate(() => {
135
- // Check for bot detection result in page content
136
- const pageText = document.body.innerText.toLowerCase();
137
- // If page loaded successfully without bot block, test passes
138
- // Fingerprint.com shows their product page, not a block page
139
- const isProductPage = pageText.includes('bot detection') ||
140
- pageText.includes('fingerprint') ||
141
- document.querySelector('h1') !== null;
142
- // Check if we're NOT blocked (no captcha, no access denied)
143
- const isNotBlocked = !pageText.includes('access denied') &&
144
- !pageText.includes('blocked') &&
145
- !pageText.includes('captcha');
146
- // Check in pre/code blocks for notDetected result or in page text
147
- const preElements = document.querySelectorAll('pre, code');
148
- for (const el of preElements) {
149
- if (el.textContent.includes('notDetected') || el.textContent.includes('"result": "notDetected"')) {
150
- return true;
151
- }
152
- }
153
- // Fallback: check any element with partial class match
154
- const allElements = document.querySelectorAll('*');
155
- for (const el of allElements) {
156
- for (const cls of el.classList) {
157
- if (cls.includes('botSubTitle') && el.textContent.toLowerCase().includes('not')) {
158
- return true;
159
- }
160
- }
161
- }
162
- // If product page loaded and not blocked, we passed
163
- return isProductPage && isNotBlocked;
164
- });
165
- assert.strictEqual(detect, true, "Fingerprint JS Bot Detector test failed!");
166
- });
167
- // If this test fails, please first check if you can access https://antcpt.com/score_detector/
168
- // Note: ReCAPTCHA V3 score depends heavily on IP reputation, browser history, and Google's algorithms.
169
- // A score >= 0.3 indicates the browser is not detected as an obvious bot.
170
- test('Recaptcha V3 Score', async () => {
171
- await page.waitForLoadState('load', { timeout: 10000 }).catch(() => { });
172
- await page.goto('about:blank', { timeout: 5000 }).catch(() => { });
173
- await page.waitForLoadState('load', { timeout: 5000 }).catch(() => { });
174
- await page.goto("https://antcpt.com/score_detector/", { timeout: 70000 });
175
- // Human-like warm-up interactions before clicking
176
- // 1. Random mouse movements using realCursor (Bézier curves via ghost-cursor)
177
- await page.realCursor.move('body', { paddingPercentage: 20 });
178
- await new Promise(r => setTimeout(r, 500 + Math.random() * 500));
179
- // 2. Scroll down a bit to simulate reading
180
- await page.mouse.wheel(0, 100 + Math.random() * 100);
181
- await new Promise(r => setTimeout(r, 800 + Math.random() * 400));
182
- // 3. Move mouse towards button area naturally
183
- await page.realCursor.move('button', { paddingPercentage: 10 });
184
- await new Promise(r => setTimeout(r, 300 + Math.random() * 300));
185
- // 4. Now click the button
186
- await page.realClick("button");
187
- await new Promise(r => setTimeout(r, 5000));
188
- const score = await page.evaluate(() => {
189
- return document.querySelector('big').textContent.replace(/[^0-9.]/g, '');
190
- });
191
- // 0.3+ means browser is not obviously a bot. Higher scores depend on IP reputation.
192
- assert.strictEqual(Number(score) >= 0.3, true, "(please first check if you can access https://antcpt.com/score_detector/.) Recaptcha V3 Score should be >=0.3 (not obviously a bot). Score Result: " + score);
193
- });
194
- // Pixelscan Fingerprint Consistency Check
195
- // Checks browser fingerprint consistency, automation detection, and proxy detection
196
- test('Pixelscan Fingerprint Check', async () => {
197
- let result = false;
198
- for (let attempt = 1; attempt <= 2 && !result; attempt++) {
199
- await page.waitForLoadState('load', { timeout: 10000 }).catch(() => { });
200
- await page.goto('about:blank', { timeout: 5000 }).catch(() => { });
201
- await page.waitForLoadState('load', { timeout: 5000 }).catch(() => { });
202
- await page.goto("https://pixelscan.net/fingerprint-check", { waitUntil: 'domcontentloaded', timeout: 70000 });
203
- const startTime = Date.now();
204
- while (!result && (Date.now() - startTime) < 30000) {
205
- result = await page.evaluate(() => {
206
- const statusBar = document.querySelector('.status-content');
207
- if (!statusBar)
208
- return false;
209
- const statusText = statusBar.innerText.toLowerCase();
210
- const isConsistent = statusText.includes('consistent') && !statusText.includes('inconsistent');
211
- const cards = Array.from(document.querySelectorAll('.checker-card'));
212
- if (cards.length === 0)
213
- return false;
214
- const isScanning = cards.some(c => c.innerText.toLowerCase().includes('scanning') || c.innerText.toLowerCase().includes('collecting'));
215
- if (isScanning)
216
- return false;
217
- const fingerprintCard = cards.find(c => c.innerText.toLowerCase().includes('fingerprint'));
218
- if (!fingerprintCard)
219
- return false;
220
- const hasMasking = fingerprintCard.innerText.toLowerCase().includes('masking detected') && !fingerprintCard.innerText.toLowerCase().includes('no masking');
221
- return isConsistent && !hasMasking;
222
- }).catch(() => false);
223
- if (!result)
224
- await new Promise(r => setTimeout(r, 1000));
225
- }
226
- }
227
- const debugInfo = await page.evaluate(() => {
228
- const statusBar = document.querySelector('.status-content');
229
- const cards = Array.from(document.querySelectorAll('.checker-card'));
230
- return {
231
- statusBarExists: !!statusBar,
232
- statusText: statusBar ? statusBar.innerText : 'NOT FOUND',
233
- cardCount: cards.length,
234
- cardTexts: cards.map(c => c.innerText.substring(0, 200)),
235
- pageTitle: document.title,
236
- bodySnippet: document.body.innerText.substring(0, 500)
237
- };
238
- }).catch(e => ({ error: e.message }));
239
- await new Promise(r => setTimeout(r, 10000));
240
- assert.strictEqual(result, true, "Pixelscan Fingerprint Check failed after 2 attempts! Browser fingerprint is inconsistent or masking was detected.");
241
- });
242
- //# sourceMappingURL=test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test.js","sourceRoot":"","sources":["../../../test/cjs/test.ts"],"names":[],"mappings":";AAAA,cAAc;AACd,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAClC,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACtC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAEtD,MAAM,iBAAiB,GAAG;IACtB,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,KAAK;IACf,YAAY,EAAE,EAAE;CACnB,CAAA;AAED,wCAAwC;AACxC,IAAI,O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,CAAC,SAAS;YAC5B,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW;YACzD,SAAS,EAAE,KAAK,CAAC,MAAM;YACvB,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YACxD,SAAS,EAAE,QAAQ,CAAC,KAAK;YACzB,WAAW,EAAE,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC;SACzD,CAAC;IACN,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAEtC,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;IAE7C,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,mHAAmH,CAAC,CAAC;AAC1J,CAAC,CAAC,CAAA"}
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * MCP Smoke Test — network-independent, fast.
4
- *
5
- * Spawns the MCP server over STDIO exactly like a real client (Cline/Claude),
6
- * performs the JSON-RPC handshake, and verifies:
7
- * 1. STDOUT carries ONLY clean JSON-RPC (no banner/log contamination)
8
- * 2. `initialize` returns valid serverInfo (name + version from package.json)
9
- * 3. `tools/list` returns all expected tools with valid schemas
10
- * 4. Tool definitions match src/shared/tools.js (count + names)
11
- * 5. Every tool in the registry has a handler implementation
12
- *
13
- * This does NOT launch a browser, so it runs in milliseconds and in CI.
14
- * Exit code 0 = all pass, 1 = failure.
15
- */
16
- declare const spawn: any;
17
- declare const path: any;
18
- declare const assert: any;
19
- declare const ROOT: any;
20
- declare const SERVER: any;
21
- declare const TOOLS: any;
22
- declare const handlers: any;
23
- declare let PKG: any;
24
- declare let passed: number;
25
- declare let failed: number;
26
- declare function check(name: string, fn: any): void;
27
- declare function rpc(child: any, obj: any): void;
28
- declare function main(): Promise<void>;
29
- //# sourceMappingURL=smoke-test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"smoke-test.d.ts","sourceRoot":"","sources":["../../../test/mcp/smoke-test.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;GAaG;AAEH,QAAA,MAAQ,KAAK,KAA6B,CAAC;AAC3C,QAAA,MAAM,IAAI,KAAkB,CAAC;AAC7B,QAAA,MAAM,MAAM,KAAoB,CAAC;AAEjC,QAAA,MAAM,IAAI,KAAmC,CAAC;AAC9C,QAAA,MAAM,MAAM,KAE0B,CAAC;AACvC,QAAA,MAAQ,KAAK,KAEoC,CAAC;AAClD,QAAA,MAAQ,QAAQ,KAE0C,CAAC;AAC3D,QAAA,IAAI,GAAG,KAAA,CAAC;AAOR,QAAA,IAAI,MAAM,QAAI,CAAC;AACf,QAAA,IAAI,MAAM,QAAI,CAAC;AACf,iBAAS,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,QASnC;AAED,iBAAS,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,QAEhC;AAED,iBAAe,IAAI,kBA4FlB"}