@democratize-quality/mcp-server 1.1.9 → 1.2.1
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.
- package/cli.js +21 -1
- package/dist/server.d.ts +41 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +225 -0
- package/dist/server.js.map +1 -0
- package/package.json +24 -23
- package/src/config/environments/api-only.js +19 -0
- package/src/config/environments/development.js +19 -0
- package/src/config/environments/production.js +19 -0
- package/src/config/index.js +19 -0
- package/src/config/server.js +19 -0
- package/src/config/tools/api.js +19 -0
- package/src/config/tools/browser.js +19 -0
- package/src/config/tools/default.js +19 -0
- package/src/server.ts +234 -0
- package/src/services/browserService.js +19 -0
- package/src/tools/api/api-generator.js +19 -0
- package/src/tools/api/api-healer.js +19 -0
- package/src/tools/api/api-planner.js +19 -0
- package/src/tools/api/api-project-setup.js +19 -0
- package/src/tools/api/api-request.js +19 -0
- package/src/tools/api/api-session-report.js +19 -0
- package/src/tools/api/api-session-status.js +19 -0
- package/src/tools/api/prompts/generation-prompts.js +19 -0
- package/src/tools/api/prompts/healing-prompts.js +19 -0
- package/src/tools/api/prompts/index.js +19 -0
- package/src/tools/api/prompts/orchestrator.js +19 -0
- package/src/tools/api/prompts/validation-rules.js +19 -0
- package/src/tools/base/ToolBase.js +19 -0
- package/src/tools/base/ToolRegistry.js +19 -0
- package/src/tools/browser/advanced/browser-console.js +19 -0
- package/src/tools/browser/advanced/browser-dialog.js +19 -0
- package/src/tools/browser/advanced/browser-evaluate.js +19 -0
- package/src/tools/browser/advanced/browser-file.js +19 -0
- package/src/tools/browser/advanced/browser-keyboard.js +19 -0
- package/src/tools/browser/advanced/browser-mouse.js +19 -0
- package/src/tools/browser/advanced/browser-network.js +19 -0
- package/src/tools/browser/advanced/browser-pdf.js +19 -0
- package/src/tools/browser/advanced/browser-tabs.js +19 -0
- package/src/tools/browser/advanced/browser-wait.js +19 -0
- package/src/tools/browser/click.js +19 -0
- package/src/tools/browser/close.js +19 -0
- package/src/tools/browser/dom.js +19 -0
- package/src/tools/browser/launch.js +19 -0
- package/src/tools/browser/navigate.js +19 -0
- package/src/tools/browser/screenshot.js +19 -0
- package/src/tools/browser/type.js +19 -0
- package/src/tools/index.js +19 -0
- package/src/utils/agentInstaller.js +19 -0
- package/src/utils/browserHelpers.js +19 -0
- package/browserControl.js +0 -113
- package/mcpServer.js +0 -335
- package/run-server.js +0 -140
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 Democratize Quality
|
|
3
|
+
*
|
|
4
|
+
* This file is part of Democratize Quality MCP Server.
|
|
5
|
+
*
|
|
6
|
+
* Democratize Quality MCP Server is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Democratize Quality MCP Server is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Affero General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
* along with Democratize Quality MCP Server. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
const ToolBase = require('../../base/ToolBase');
|
|
2
21
|
const browserService = require('../../../services/browserService');
|
|
3
22
|
const fs = require('fs').promises;
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 Democratize Quality
|
|
3
|
+
*
|
|
4
|
+
* This file is part of Democratize Quality MCP Server.
|
|
5
|
+
*
|
|
6
|
+
* Democratize Quality MCP Server is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Democratize Quality MCP Server is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Affero General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
* along with Democratize Quality MCP Server. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
const ToolBase = require('../../base/ToolBase');
|
|
2
21
|
const browserService = require('../../../services/browserService');
|
|
3
22
|
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 Democratize Quality
|
|
3
|
+
*
|
|
4
|
+
* This file is part of Democratize Quality MCP Server.
|
|
5
|
+
*
|
|
6
|
+
* Democratize Quality MCP Server is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Democratize Quality MCP Server is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Affero General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
* along with Democratize Quality MCP Server. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
const ToolBase = require('../../base/ToolBase');
|
|
2
21
|
const browserService = require('../../../services/browserService');
|
|
3
22
|
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 Democratize Quality
|
|
3
|
+
*
|
|
4
|
+
* This file is part of Democratize Quality MCP Server.
|
|
5
|
+
*
|
|
6
|
+
* Democratize Quality MCP Server is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Democratize Quality MCP Server is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Affero General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
* along with Democratize Quality MCP Server. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
const ToolBase = require('../../base/ToolBase');
|
|
2
21
|
const browserService = require('../../../services/browserService');
|
|
3
22
|
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 Democratize Quality
|
|
3
|
+
*
|
|
4
|
+
* This file is part of Democratize Quality MCP Server.
|
|
5
|
+
*
|
|
6
|
+
* Democratize Quality MCP Server is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Democratize Quality MCP Server is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Affero General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
* along with Democratize Quality MCP Server. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
const ToolBase = require('../../base/ToolBase');
|
|
2
21
|
const browserService = require('../../../services/browserService');
|
|
3
22
|
const fs = require('fs').promises;
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 Democratize Quality
|
|
3
|
+
*
|
|
4
|
+
* This file is part of Democratize Quality MCP Server.
|
|
5
|
+
*
|
|
6
|
+
* Democratize Quality MCP Server is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Democratize Quality MCP Server is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Affero General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
* along with Democratize Quality MCP Server. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
const ToolBase = require('../../base/ToolBase');
|
|
2
21
|
const browserService = require('../../../services/browserService');
|
|
3
22
|
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 Democratize Quality
|
|
3
|
+
*
|
|
4
|
+
* This file is part of Democratize Quality MCP Server.
|
|
5
|
+
*
|
|
6
|
+
* Democratize Quality MCP Server is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Democratize Quality MCP Server is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Affero General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
* along with Democratize Quality MCP Server. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
const ToolBase = require('../../base/ToolBase');
|
|
2
21
|
const browserService = require('../../../services/browserService');
|
|
3
22
|
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 Democratize Quality
|
|
3
|
+
*
|
|
4
|
+
* This file is part of Democratize Quality MCP Server.
|
|
5
|
+
*
|
|
6
|
+
* Democratize Quality MCP Server is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Democratize Quality MCP Server is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Affero General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
* along with Democratize Quality MCP Server. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
const ToolBase = require('../base/ToolBase');
|
|
2
21
|
const browserService = require('../../services/browserService');
|
|
3
22
|
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 Democratize Quality
|
|
3
|
+
*
|
|
4
|
+
* This file is part of Democratize Quality MCP Server.
|
|
5
|
+
*
|
|
6
|
+
* Democratize Quality MCP Server is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Democratize Quality MCP Server is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Affero General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
* along with Democratize Quality MCP Server. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
const ToolBase = require('../base/ToolBase');
|
|
2
21
|
const browserService = require('../../services/browserService');
|
|
3
22
|
|
package/src/tools/browser/dom.js
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 Democratize Quality
|
|
3
|
+
*
|
|
4
|
+
* This file is part of Democratize Quality MCP Server.
|
|
5
|
+
*
|
|
6
|
+
* Democratize Quality MCP Server is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Democratize Quality MCP Server is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Affero General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
* along with Democratize Quality MCP Server. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
const ToolBase = require('../base/ToolBase');
|
|
2
21
|
const browserService = require('../../services/browserService');
|
|
3
22
|
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 Democratize Quality
|
|
3
|
+
*
|
|
4
|
+
* This file is part of Democratize Quality MCP Server.
|
|
5
|
+
*
|
|
6
|
+
* Democratize Quality MCP Server is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Democratize Quality MCP Server is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Affero General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
* along with Democratize Quality MCP Server. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
const ToolBase = require('../base/ToolBase');
|
|
2
21
|
const browserService = require('../../services/browserService');
|
|
3
22
|
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 Democratize Quality
|
|
3
|
+
*
|
|
4
|
+
* This file is part of Democratize Quality MCP Server.
|
|
5
|
+
*
|
|
6
|
+
* Democratize Quality MCP Server is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Democratize Quality MCP Server is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Affero General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
* along with Democratize Quality MCP Server. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
const ToolBase = require('../base/ToolBase');
|
|
2
21
|
const browserService = require('../../services/browserService');
|
|
3
22
|
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 Democratize Quality
|
|
3
|
+
*
|
|
4
|
+
* This file is part of Democratize Quality MCP Server.
|
|
5
|
+
*
|
|
6
|
+
* Democratize Quality MCP Server is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Democratize Quality MCP Server is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Affero General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
* along with Democratize Quality MCP Server. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
const ToolBase = require('../base/ToolBase');
|
|
2
21
|
const browserService = require('../../services/browserService');
|
|
3
22
|
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 Democratize Quality
|
|
3
|
+
*
|
|
4
|
+
* This file is part of Democratize Quality MCP Server.
|
|
5
|
+
*
|
|
6
|
+
* Democratize Quality MCP Server is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Democratize Quality MCP Server is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Affero General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
* along with Democratize Quality MCP Server. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
const ToolBase = require('../base/ToolBase');
|
|
2
21
|
const browserService = require('../../services/browserService');
|
|
3
22
|
|
package/src/tools/index.js
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 Democratize Quality
|
|
3
|
+
*
|
|
4
|
+
* This file is part of Democratize Quality MCP Server.
|
|
5
|
+
*
|
|
6
|
+
* Democratize Quality MCP Server is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Democratize Quality MCP Server is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Affero General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
* along with Democratize Quality MCP Server. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
const ToolRegistry = require('./base/ToolRegistry');
|
|
2
21
|
const path = require('path');
|
|
3
22
|
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 Democratize Quality
|
|
3
|
+
*
|
|
4
|
+
* This file is part of Democratize Quality MCP Server.
|
|
5
|
+
*
|
|
6
|
+
* Democratize Quality MCP Server is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Democratize Quality MCP Server is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Affero General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
* along with Democratize Quality MCP Server. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
const fs = require('fs');
|
|
2
21
|
const path = require('path');
|
|
3
22
|
const { promisify } = require('util');
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 Democratize Quality
|
|
3
|
+
*
|
|
4
|
+
* This file is part of Democratize Quality MCP Server.
|
|
5
|
+
*
|
|
6
|
+
* Democratize Quality MCP Server is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Democratize Quality MCP Server is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Affero General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
* along with Democratize Quality MCP Server. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
const path = require('path'); // Ensure path is imported if needed for other helpers
|
|
2
21
|
|
|
3
22
|
/**
|
package/browserControl.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
// browserControl.js
|
|
2
|
-
const CDP = require('chrome-remote-interface');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path'); // We need path for resolving userDataDir
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
async function automateBrowser() {
|
|
8
|
-
let chrome;
|
|
9
|
-
let client;
|
|
10
|
-
const { launch: launchChrome } = await import('chrome-launcher');
|
|
11
|
-
// Define your user data directory path
|
|
12
|
-
// IMPORTANT: Create this directory if it doesn't exist before running the script
|
|
13
|
-
const myUserDataDir = path.resolve(__dirname, './my_test_profile'); // This will create it in your project folder
|
|
14
|
-
|
|
15
|
-
try {
|
|
16
|
-
// Ensure the directory exists
|
|
17
|
-
if (!fs.existsSync(myUserDataDir)) {
|
|
18
|
-
fs.mkdirSync(myUserDataDir, { recursive: true });
|
|
19
|
-
console.log(`Created user data directory: ${myUserDataDir}`);
|
|
20
|
-
} else {
|
|
21
|
-
console.log(`Using existing user data directory: ${myUserDataDir}`);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
console.log('Launching Chrome with remote debugging...');
|
|
25
|
-
chrome = await launchChrome({
|
|
26
|
-
port: 9222,
|
|
27
|
-
userDataDir: myUserDataDir, // <--- THE KEY CHANGE HERE
|
|
28
|
-
chromeFlags: [
|
|
29
|
-
// Set to false to see the browser UI
|
|
30
|
-
// For initial login, it's highly recommended to use false so you can interact
|
|
31
|
-
//'--headless=false', // Set this to 'new' or '' for headless mode once logged in
|
|
32
|
-
'--disable-gpu',
|
|
33
|
-
'--disable-setuid-sandbox',
|
|
34
|
-
'--no-sandbox'
|
|
35
|
-
]
|
|
36
|
-
});
|
|
37
|
-
console.log(`Chrome launched on port ${chrome.port} using profile: ${myUserDataDir}`);
|
|
38
|
-
|
|
39
|
-
client = await CDP({ port: chrome.port });
|
|
40
|
-
console.log('Connected to Chrome DevTools Protocol.');
|
|
41
|
-
|
|
42
|
-
const { Page, Runtime, DOM, Network } = client; // Also enable Network for potential cookie inspection later
|
|
43
|
-
|
|
44
|
-
await Page.enable();
|
|
45
|
-
await Runtime.enable();
|
|
46
|
-
await DOM.enable();
|
|
47
|
-
await Network.enable(); // Enable Network domain
|
|
48
|
-
|
|
49
|
-
console.log('Page, Runtime, DOM, and Network domains enabled.');
|
|
50
|
-
|
|
51
|
-
const url = 'https://www.saucedemo.com'; // You can change this to your company login page
|
|
52
|
-
console.log(`Navigating to: ${url}`);
|
|
53
|
-
await Page.navigate({ url: url });
|
|
54
|
-
await Page.loadEventFired();
|
|
55
|
-
console.log('Page loaded.');
|
|
56
|
-
|
|
57
|
-
// --- Authentication Step ---
|
|
58
|
-
// FIRST RUN:
|
|
59
|
-
// When you run this for the first time with `--headless=false`,
|
|
60
|
-
// a Chrome window will open. Manually navigate to your company's login page
|
|
61
|
-
// and sign in. Complete all login steps (username, password, MFA, SSO etc.).
|
|
62
|
-
// Once logged in, DO NOT close the browser manually.
|
|
63
|
-
// Let the script finish, or press Ctrl+C to trigger the finally block.
|
|
64
|
-
// The script will then close Chrome, and the session state will be saved
|
|
65
|
-
// in 'my_test_profile' directory.
|
|
66
|
-
|
|
67
|
-
// SUBSEQUENT RUNS:
|
|
68
|
-
// For subsequent runs, you can change `--headless=false` to `--headless=new`
|
|
69
|
-
// (or just remove it if you prefer `chrome-launcher`'s default headless behavior).
|
|
70
|
-
// Chrome will launch, load the saved profile, and you should be logged in automatically.
|
|
71
|
-
// You can then add your actual UI automation steps here, e.g., navigating to
|
|
72
|
-
// internal dashboards, filling forms, etc.
|
|
73
|
-
|
|
74
|
-
// Example: Wait for a few seconds so you can see the login happen
|
|
75
|
-
console.log('Waiting for 10 seconds (for manual login/observation)...');
|
|
76
|
-
await new Promise(resolve => setTimeout(resolve, 10000));
|
|
77
|
-
|
|
78
|
-
// After the wait, take a screenshot to verify login state
|
|
79
|
-
console.log('Taking screenshot after wait...');
|
|
80
|
-
const screenshot = await Page.captureScreenshot({ format: 'png', quality: 80 });
|
|
81
|
-
const screenshotBuffer = Buffer.from(screenshot.data, 'base64');
|
|
82
|
-
fs.writeFileSync('example_screenshot_after_login.png', screenshotBuffer);
|
|
83
|
-
console.log('Screenshot saved as example_screenshot_after_login.png');
|
|
84
|
-
|
|
85
|
-
console.log('Getting page title...');
|
|
86
|
-
const result = await Runtime.evaluate({ expression: 'document.title' });
|
|
87
|
-
const pageTitle = result.result.value;
|
|
88
|
-
console.log(`Page Title: "${pageTitle}"`);
|
|
89
|
-
|
|
90
|
-
console.log('Getting outer HTML...');
|
|
91
|
-
const documentNode = await DOM.getDocument({ depth: -1 });
|
|
92
|
-
const outerHTML = await DOM.getOuterHTML({ nodeId: documentNode.root.nodeId });
|
|
93
|
-
fs.writeFileSync('example_dom_after_login.html', outerHTML.outerHTML);
|
|
94
|
-
console.log('DOM saved as example_dom_after_login.html');
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
} catch (err) {
|
|
98
|
-
console.error('CRITICAL ERROR during browser automation:', err.message);
|
|
99
|
-
console.error('Details:', err);
|
|
100
|
-
} finally {
|
|
101
|
-
if (client) {
|
|
102
|
-
console.log('Disconnecting CDP client...');
|
|
103
|
-
client.close();
|
|
104
|
-
}
|
|
105
|
-
if (chrome) {
|
|
106
|
-
console.log('Closing launched Chrome instance...');
|
|
107
|
-
await chrome.kill();
|
|
108
|
-
console.log('Chrome instance closed.');
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
automateBrowser();
|