Major refactor: Multi-user Chrome MCP extension with remote server architecture

This commit is contained in:
nasir@endelospay.com
2025-08-21 20:09:57 +05:00
parent d97cad1736
commit 5d869f6a7c
125 changed files with 16249 additions and 11906 deletions

View File

@@ -0,0 +1,62 @@
/**
* Test Chrome extension connection to remote server
*/
import WebSocket from 'ws';
const CHROME_ENDPOINT = 'ws://localhost:3001/chrome';
async function testChromeConnection() {
console.log('🔌 Testing Chrome extension connection...');
return new Promise((resolve, reject) => {
const ws = new WebSocket(CHROME_ENDPOINT);
ws.on('open', () => {
console.log('✅ Connected to Chrome extension endpoint');
// Send a test message to see if any Chrome extensions are connected
const testMessage = {
id: 'test-' + Date.now(),
action: 'callTool',
params: {
name: 'chrome_navigate',
arguments: {
url: 'https://www.google.com',
newWindow: false
}
}
};
console.log('📤 Sending test message:', JSON.stringify(testMessage, null, 2));
ws.send(JSON.stringify(testMessage));
// Set a timeout to close the connection
setTimeout(() => {
console.log('⏰ Test timeout - closing connection');
ws.close();
resolve('Test completed');
}, 5000);
});
ws.on('message', (data) => {
try {
const response = JSON.parse(data.toString());
console.log('📨 Received response:', JSON.stringify(response, null, 2));
} catch (error) {
console.error('❌ Error parsing response:', error);
}
});
ws.on('error', (error) => {
console.error('❌ WebSocket error:', error);
reject(error);
});
ws.on('close', () => {
console.log('🔌 Chrome extension connection closed');
});
});
}
testChromeConnection().catch(console.error);