@democratize-quality/mcp-server 1.0.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.
- package/LICENSE +15 -0
- package/README.md +423 -0
- package/browserControl.js +113 -0
- package/cli.js +187 -0
- package/docs/api/tool-reference.md +317 -0
- package/docs/api_tools_usage.md +477 -0
- package/docs/development/adding-tools.md +274 -0
- package/docs/development/configuration.md +332 -0
- package/docs/examples/authentication.md +124 -0
- package/docs/examples/basic-automation.md +105 -0
- package/docs/getting-started.md +214 -0
- package/docs/index.md +61 -0
- package/mcpServer.js +280 -0
- package/package.json +83 -0
- package/run-server.js +140 -0
- package/src/config/environments/api-only.js +53 -0
- package/src/config/environments/development.js +54 -0
- package/src/config/environments/production.js +69 -0
- package/src/config/index.js +341 -0
- package/src/config/server.js +41 -0
- package/src/config/tools/api.js +67 -0
- package/src/config/tools/browser.js +90 -0
- package/src/config/tools/default.js +32 -0
- package/src/services/browserService.js +325 -0
- package/src/tools/api/api-request.js +641 -0
- package/src/tools/api/api-session-report.js +1262 -0
- package/src/tools/api/api-session-status.js +395 -0
- package/src/tools/base/ToolBase.js +230 -0
- package/src/tools/base/ToolRegistry.js +269 -0
- package/src/tools/browser/advanced/browser-console.js +384 -0
- package/src/tools/browser/advanced/browser-dialog.js +319 -0
- package/src/tools/browser/advanced/browser-evaluate.js +337 -0
- package/src/tools/browser/advanced/browser-file.js +480 -0
- package/src/tools/browser/advanced/browser-keyboard.js +343 -0
- package/src/tools/browser/advanced/browser-mouse.js +332 -0
- package/src/tools/browser/advanced/browser-network.js +421 -0
- package/src/tools/browser/advanced/browser-pdf.js +407 -0
- package/src/tools/browser/advanced/browser-tabs.js +497 -0
- package/src/tools/browser/advanced/browser-wait.js +378 -0
- package/src/tools/browser/click.js +168 -0
- package/src/tools/browser/close.js +60 -0
- package/src/tools/browser/dom.js +70 -0
- package/src/tools/browser/launch.js +67 -0
- package/src/tools/browser/navigate.js +270 -0
- package/src/tools/browser/screenshot.js +351 -0
- package/src/tools/browser/type.js +174 -0
- package/src/tools/index.js +95 -0
- package/src/utils/browserHelpers.js +83 -0
package/cli.js
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Democratize Quality MCP Server CLI
|
|
5
|
+
* Can be run via npx @democratize-quality/mcp-server
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { spawn } = require('child_process');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
const os = require('os');
|
|
12
|
+
|
|
13
|
+
// Handle CLI arguments
|
|
14
|
+
const args = process.argv.slice(2);
|
|
15
|
+
const isHelp = args.includes('--help') || args.includes('-h');
|
|
16
|
+
const isVersion = args.includes('--version') || args.includes('-v');
|
|
17
|
+
|
|
18
|
+
if (isVersion) {
|
|
19
|
+
const packageJson = require('./package.json');
|
|
20
|
+
console.log(`Democratize Quality MCP Server v${packageJson.version}`);
|
|
21
|
+
process.exit(0);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (isHelp) {
|
|
25
|
+
console.log(`
|
|
26
|
+
🎯 Democratize Quality MCP Server
|
|
27
|
+
|
|
28
|
+
A comprehensive MCP server for democratizing quality through browser automation and API testing.
|
|
29
|
+
|
|
30
|
+
Usage:
|
|
31
|
+
npx @democratize-quality/mcp-server [options]
|
|
32
|
+
democratize-quality-mcp [options]
|
|
33
|
+
dq-mcp-server [options]
|
|
34
|
+
|
|
35
|
+
Options:
|
|
36
|
+
--help, -h Show this help
|
|
37
|
+
--version, -v Show version
|
|
38
|
+
--debug Enable debug mode
|
|
39
|
+
--port <number> Set server port
|
|
40
|
+
--env <environment> Set environment (development|production|api-only)
|
|
41
|
+
|
|
42
|
+
Tool Category Options:
|
|
43
|
+
--api-only Enable only API tools (shortcut for api-only environment)
|
|
44
|
+
--browser-only Enable only browser tools
|
|
45
|
+
--no-api Disable API tools
|
|
46
|
+
--no-browser Disable browser tools
|
|
47
|
+
--no-advanced Disable advanced browser tools
|
|
48
|
+
--enable-all Enable all tool categories (default in development)
|
|
49
|
+
|
|
50
|
+
Environment Variables:
|
|
51
|
+
MCP_FEATURES_ENABLEAPITOOLS=true/false Enable/disable API tools
|
|
52
|
+
MCP_FEATURES_ENABLEBROWSERTOOLS=true/false Enable/disable browser tools
|
|
53
|
+
MCP_FEATURES_ENABLEADVANCEDTOOLS=true/false Enable/disable advanced tools
|
|
54
|
+
NODE_ENV=api-only Use API-only configuration
|
|
55
|
+
|
|
56
|
+
Integration with Claude Desktop:
|
|
57
|
+
Add this to ~/Library/Application Support/Claude/claude_desktop_config.json
|
|
58
|
+
|
|
59
|
+
{
|
|
60
|
+
"mcpServers": {
|
|
61
|
+
"democratize-quality": {
|
|
62
|
+
"command": "npx",
|
|
63
|
+
"args": ["@democratize-quality/mcp-server"]
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
Or if installed globally:
|
|
69
|
+
{
|
|
70
|
+
"mcpServers": {
|
|
71
|
+
"democratize-quality": {
|
|
72
|
+
"command": "democratize-quality-mcp"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
Available Tools: 20
|
|
78
|
+
• Browser Automation (17): launch, navigate, click, type, screenshot, pdf, etc.
|
|
79
|
+
• API Testing (3): request, session status, HTML reports
|
|
80
|
+
|
|
81
|
+
GitHub: https://github.com/democratize-quality/mcp-server
|
|
82
|
+
`);
|
|
83
|
+
process.exit(0);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Set up environment
|
|
87
|
+
const env = { ...process.env };
|
|
88
|
+
|
|
89
|
+
// Handle debug flag
|
|
90
|
+
if (args.includes('--debug')) {
|
|
91
|
+
env.MCP_FEATURES_ENABLEDEBUGMODE = 'true';
|
|
92
|
+
env.NODE_ENV = 'development';
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Handle environment flag
|
|
96
|
+
const envIndex = args.indexOf('--env');
|
|
97
|
+
if (envIndex !== -1 && args[envIndex + 1]) {
|
|
98
|
+
env.NODE_ENV = args[envIndex + 1];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Handle tool category flags
|
|
102
|
+
if (args.includes('--api-only')) {
|
|
103
|
+
env.NODE_ENV = 'api-only';
|
|
104
|
+
} else if (args.includes('--browser-only')) {
|
|
105
|
+
env.MCP_FEATURES_ENABLEAPITOOLS = 'false';
|
|
106
|
+
env.MCP_FEATURES_ENABLEBROWSERTOOLS = 'true';
|
|
107
|
+
env.MCP_FEATURES_ENABLEADVANCEDTOOLS = 'true';
|
|
108
|
+
env.MCP_FEATURES_ENABLEFILETOOLS = 'false';
|
|
109
|
+
env.MCP_FEATURES_ENABLENETWORKTOOLS = 'false';
|
|
110
|
+
env.MCP_FEATURES_ENABLEOTHERTOOLS = 'false';
|
|
111
|
+
} else if (args.includes('--enable-all')) {
|
|
112
|
+
env.MCP_FEATURES_ENABLEAPITOOLS = 'true';
|
|
113
|
+
env.MCP_FEATURES_ENABLEBROWSERTOOLS = 'true';
|
|
114
|
+
env.MCP_FEATURES_ENABLEADVANCEDTOOLS = 'true';
|
|
115
|
+
env.MCP_FEATURES_ENABLEFILETOOLS = 'true';
|
|
116
|
+
env.MCP_FEATURES_ENABLENETWORKTOOLS = 'true';
|
|
117
|
+
env.MCP_FEATURES_ENABLEOTHERTOOLS = 'true';
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Handle individual tool category disable flags
|
|
121
|
+
if (args.includes('--no-api')) {
|
|
122
|
+
env.MCP_FEATURES_ENABLEAPITOOLS = 'false';
|
|
123
|
+
}
|
|
124
|
+
if (args.includes('--no-browser')) {
|
|
125
|
+
env.MCP_FEATURES_ENABLEBROWSERTOOLS = 'false';
|
|
126
|
+
}
|
|
127
|
+
if (args.includes('--no-advanced')) {
|
|
128
|
+
env.MCP_FEATURES_ENABLEADVANCEDTOOLS = 'false';
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Handle port flag
|
|
132
|
+
const portIndex = args.indexOf('--port');
|
|
133
|
+
if (portIndex !== -1 && args[portIndex + 1]) {
|
|
134
|
+
env.PORT = args[portIndex + 1];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Ensure output directory exists
|
|
138
|
+
// When run via npx/Claude, process.cwd() might be root, so use home directory or temp
|
|
139
|
+
const defaultOutputDir = env.HOME
|
|
140
|
+
? path.join(env.HOME, '.mcp-browser-control')
|
|
141
|
+
: path.join(os.tmpdir(), 'mcp-browser-control');
|
|
142
|
+
|
|
143
|
+
const outputDir = env.OUTPUT_DIR || defaultOutputDir;
|
|
144
|
+
if (!fs.existsSync(outputDir)) {
|
|
145
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
146
|
+
}
|
|
147
|
+
env.OUTPUT_DIR = outputDir;
|
|
148
|
+
|
|
149
|
+
// Debug output (if enabled)
|
|
150
|
+
if (args.includes('--debug')) {
|
|
151
|
+
console.error(`📁 Output directory: ${outputDir}`);
|
|
152
|
+
console.error(`🏠 Working directory: ${process.cwd()}`);
|
|
153
|
+
console.error(`🌍 Environment: ${env.NODE_ENV || 'development'}`);
|
|
154
|
+
console.error(`🔧 Tool Categories:`);
|
|
155
|
+
console.error(` API Tools: ${env.MCP_FEATURES_ENABLEAPITOOLS || 'default'}`);
|
|
156
|
+
console.error(` Browser Tools: ${env.MCP_FEATURES_ENABLEBROWSERTOOLS || 'default'}`);
|
|
157
|
+
console.error(` Advanced Tools: ${env.MCP_FEATURES_ENABLEADVANCEDTOOLS || 'default'}`);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Start the MCP server
|
|
161
|
+
const serverPath = path.join(__dirname, 'mcpServer.js');
|
|
162
|
+
const serverProcess = spawn('node', [serverPath], {
|
|
163
|
+
env,
|
|
164
|
+
stdio: 'inherit'
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// Handle process cleanup
|
|
168
|
+
const cleanup = (signal) => {
|
|
169
|
+
console.error(`\nReceived ${signal}, shutting down gracefully...`);
|
|
170
|
+
serverProcess.kill(signal);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
process.on('SIGINT', () => cleanup('SIGINT'));
|
|
174
|
+
process.on('SIGTERM', () => cleanup('SIGTERM'));
|
|
175
|
+
|
|
176
|
+
serverProcess.on('error', (error) => {
|
|
177
|
+
console.error('Failed to start CDP Browser Control MCP Server:', error.message);
|
|
178
|
+
process.exit(1);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
serverProcess.on('exit', (code, signal) => {
|
|
182
|
+
if (signal) {
|
|
183
|
+
process.exit(0);
|
|
184
|
+
} else {
|
|
185
|
+
process.exit(code || 0);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
# Tool Reference
|
|
2
|
+
|
|
3
|
+
Complete reference for all available tools
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
- [Browser Tools](#browser-tools)
|
|
10
|
+
- [browser_click](#browser-click)
|
|
11
|
+
- [browser_close](#browser-close)
|
|
12
|
+
- [browser_dom](#browser-dom)
|
|
13
|
+
- [browser_launch](#browser-launch)
|
|
14
|
+
- [browser_navigate](#browser-navigate)
|
|
15
|
+
- [browser_screenshot](#browser-screenshot)
|
|
16
|
+
- [browser_type](#browser-type)
|
|
17
|
+
|
|
18
|
+
## Browser Tools
|
|
19
|
+
|
|
20
|
+
Tools for browser automation and control.
|
|
21
|
+
|
|
22
|
+
### browser_click
|
|
23
|
+
|
|
24
|
+
**Description:** Simulates a click on a specific element in the browser.
|
|
25
|
+
|
|
26
|
+
#### Input Parameters
|
|
27
|
+
|
|
28
|
+
| Parameter | Type | Required | Description |
|
|
29
|
+
|-----------|------|----------|-------------|
|
|
30
|
+
| `browserId` | string | ✅ | The ID of the browser instance. |
|
|
31
|
+
| `selector` | string | ✅ | The CSS selector of the element to click. |
|
|
32
|
+
|
|
33
|
+
#### Output
|
|
34
|
+
|
|
35
|
+
| Field | Type | Description |
|
|
36
|
+
|-------|------|-------------|
|
|
37
|
+
| `success` | boolean | Indicates if the click was successful. |
|
|
38
|
+
| `browserId` | string | The browser instance ID that was used. |
|
|
39
|
+
|
|
40
|
+
#### Example Usage
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"tool": "browser_click",
|
|
45
|
+
"parameters": {
|
|
46
|
+
"browserId": "browser-123",
|
|
47
|
+
"locator": {
|
|
48
|
+
"type": "css",
|
|
49
|
+
"value": "#submit-button"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
*Click a button using CSS selector*
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
### browser_close
|
|
61
|
+
|
|
62
|
+
**Description:** Closes a specific browser instance and cleans up its resources. Always call this when done with a browser.
|
|
63
|
+
|
|
64
|
+
#### Input Parameters
|
|
65
|
+
|
|
66
|
+
| Parameter | Type | Required | Description |
|
|
67
|
+
|-----------|------|----------|-------------|
|
|
68
|
+
| `browserId` | string | ✅ | The ID of the browser instance to close. |
|
|
69
|
+
|
|
70
|
+
#### Output
|
|
71
|
+
|
|
72
|
+
| Field | Type | Description |
|
|
73
|
+
|-------|------|-------------|
|
|
74
|
+
| `message` | string | Confirmation message of successful closure. |
|
|
75
|
+
| `browserId` | string | The browser instance ID that was closed. |
|
|
76
|
+
|
|
77
|
+
#### Example Usage
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"tool": "browser_close",
|
|
82
|
+
"parameters": {
|
|
83
|
+
"browserId": "example"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
*Basic usage example*
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
### browser_dom
|
|
94
|
+
|
|
95
|
+
**Description:** Interacts with the DOM of the current browser page.
|
|
96
|
+
|
|
97
|
+
#### Input Parameters
|
|
98
|
+
|
|
99
|
+
| Parameter | Type | Required | Description |
|
|
100
|
+
|-----------|------|----------|-------------|
|
|
101
|
+
| `browserId` | string | ✅ | The ID of the browser instance. |
|
|
102
|
+
| `action` | string | ✅ | The DOM action to perform (e.g., 'click', 'type'). |
|
|
103
|
+
| `selector` | string | ✅ | The CSS selector of the element to interact with. |
|
|
104
|
+
| `text` | string | ❌ | The text to type into the element (if applicable). |
|
|
105
|
+
|
|
106
|
+
#### Output
|
|
107
|
+
|
|
108
|
+
| Field | Type | Description |
|
|
109
|
+
|-------|------|-------------|
|
|
110
|
+
| `success` | boolean | Indicates if the DOM action was successful. |
|
|
111
|
+
| `browserId` | string | The browser instance ID that was used. |
|
|
112
|
+
|
|
113
|
+
#### Example Usage
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"tool": "browser_dom",
|
|
118
|
+
"parameters": {
|
|
119
|
+
"browserId": "example",
|
|
120
|
+
"action": "example",
|
|
121
|
+
"selector": "example"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
*Basic usage example*
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
### browser_launch
|
|
132
|
+
|
|
133
|
+
**Description:** Launches a new web browser instance. Returns a unique browserId. Use this before any other browser actions.
|
|
134
|
+
|
|
135
|
+
#### Input Parameters
|
|
136
|
+
|
|
137
|
+
| Parameter | Type | Required | Description |
|
|
138
|
+
|-----------|------|----------|-------------|
|
|
139
|
+
| `headless` | boolean | ❌ | Whether to launch the browser in headless mode (no UI). Defaults to true. Set to false for manual login. |
|
|
140
|
+
| `userDataDir` | string | ❌ | Optional. A path (relative to the server) to a directory to store persistent user data (e.g., login sessions, cookies). Use for authenticated sessions. If not provided, a temporary profile is used. |
|
|
141
|
+
| `port` | number | ❌ | Optional. The port for remote debugging. If not provided, Chrome will choose an available port. |
|
|
142
|
+
|
|
143
|
+
#### Output
|
|
144
|
+
|
|
145
|
+
| Field | Type | Description |
|
|
146
|
+
|-------|------|-------------|
|
|
147
|
+
| `browserId` | string | The unique ID of the launched browser instance. |
|
|
148
|
+
| `port` | number | The port the browser instance is running on for remote debugging. |
|
|
149
|
+
| `userDataDir` | string | The absolute path to the user data directory used. |
|
|
150
|
+
|
|
151
|
+
#### Example Usage
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"tool": "browser_launch",
|
|
156
|
+
"parameters": {
|
|
157
|
+
"headless": true
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
*Launch a headless browser instance*
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"tool": "browser_launch",
|
|
167
|
+
"parameters": {
|
|
168
|
+
"headless": false,
|
|
169
|
+
"userDataDir": "./my_profile"
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
*Launch browser with custom profile for authenticated sessions*
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
### browser_navigate
|
|
180
|
+
|
|
181
|
+
**Description:** Navigates a specific browser instance to a given URL.
|
|
182
|
+
|
|
183
|
+
#### Input Parameters
|
|
184
|
+
|
|
185
|
+
| Parameter | Type | Required | Description |
|
|
186
|
+
|-----------|------|----------|-------------|
|
|
187
|
+
| `browserId` | string | ✅ | The ID of the browser instance to navigate. |
|
|
188
|
+
| `url` | string | ✅ | The URL to navigate to. Must include protocol (http:// or https://). |
|
|
189
|
+
|
|
190
|
+
#### Output
|
|
191
|
+
|
|
192
|
+
| Field | Type | Description |
|
|
193
|
+
|-------|------|-------------|
|
|
194
|
+
| `message` | string | Confirmation message of successful navigation. |
|
|
195
|
+
| `url` | string | The URL that was navigated to. |
|
|
196
|
+
| `browserId` | string | The browser instance ID that was used. |
|
|
197
|
+
|
|
198
|
+
#### Example Usage
|
|
199
|
+
|
|
200
|
+
```json
|
|
201
|
+
{
|
|
202
|
+
"tool": "browser_navigate",
|
|
203
|
+
"parameters": {
|
|
204
|
+
"browserId": "browser-123",
|
|
205
|
+
"url": "https://example.com"
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
*Navigate to a website*
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
### browser_screenshot
|
|
216
|
+
|
|
217
|
+
**Description:** Captures a screenshot of the current browser page. Returns base64 encoded image data. Optionally saves to disk.
|
|
218
|
+
|
|
219
|
+
#### Input Parameters
|
|
220
|
+
|
|
221
|
+
| Parameter | Type | Required | Description |
|
|
222
|
+
|-----------|------|----------|-------------|
|
|
223
|
+
| `browserId` | string | ✅ | The ID of the browser instance. |
|
|
224
|
+
| `fileName` | string | ❌ | Optional. The name of the file to save the screenshot as (e.g., 'my_page.png'). Saved to the server's configured output directory. If not provided, a timestamped name is used. |
|
|
225
|
+
| `saveToDisk` | boolean | ❌ | Optional. Whether to save the screenshot to disk on the server. Defaults to true. Set to false to only receive base64 data. |
|
|
226
|
+
|
|
227
|
+
#### Output
|
|
228
|
+
|
|
229
|
+
| Field | Type | Description |
|
|
230
|
+
|-------|------|-------------|
|
|
231
|
+
| `imageData` | string | Base64 encoded PNG image data. |
|
|
232
|
+
| `format` | string | Image format (e.g., 'png'). |
|
|
233
|
+
| `fileName` | string | The file name if saved to disk. |
|
|
234
|
+
| `browserId` | string | The browser instance ID that was used. |
|
|
235
|
+
|
|
236
|
+
#### Example Usage
|
|
237
|
+
|
|
238
|
+
```json
|
|
239
|
+
{
|
|
240
|
+
"tool": "browser_screenshot",
|
|
241
|
+
"parameters": {
|
|
242
|
+
"browserId": "browser-123",
|
|
243
|
+
"fileName": "page-capture.png"
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
*Take a screenshot and save it*
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
### browser_type
|
|
254
|
+
|
|
255
|
+
**Description:** Types text into a specific input field in the browser.
|
|
256
|
+
|
|
257
|
+
#### Input Parameters
|
|
258
|
+
|
|
259
|
+
| Parameter | Type | Required | Description |
|
|
260
|
+
|-----------|------|----------|-------------|
|
|
261
|
+
| `browserId` | string | ✅ | The ID of the browser instance. |
|
|
262
|
+
| `selector` | string | ✅ | The CSS selector of the input field. |
|
|
263
|
+
| `text` | string | ✅ | The text to type into the input field. |
|
|
264
|
+
|
|
265
|
+
#### Output
|
|
266
|
+
|
|
267
|
+
| Field | Type | Description |
|
|
268
|
+
|-------|------|-------------|
|
|
269
|
+
| `success` | boolean | Indicates if the typing was successful. |
|
|
270
|
+
| `browserId` | string | The browser instance ID that was used. |
|
|
271
|
+
|
|
272
|
+
#### Example Usage
|
|
273
|
+
|
|
274
|
+
```json
|
|
275
|
+
{
|
|
276
|
+
"tool": "browser_type",
|
|
277
|
+
"parameters": {
|
|
278
|
+
"browserId": "browser-123",
|
|
279
|
+
"locator": {
|
|
280
|
+
"type": "css",
|
|
281
|
+
"value": "#email-input"
|
|
282
|
+
},
|
|
283
|
+
"text": "user@example.com"
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
*Type text into an input field*
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
## Feature Flags
|
|
295
|
+
|
|
296
|
+
Tools can be enabled or disabled using feature flags:
|
|
297
|
+
|
|
298
|
+
| Feature Flag | Environment Variable | Description |
|
|
299
|
+
|--------------|---------------------|-------------|
|
|
300
|
+
| `enableBrowserTools` | `MCP_FEATURES_ENABLEBROWSERTOOLS` | Enable/disable all browser automation tools |
|
|
301
|
+
| `enableFileTools` | `MCP_FEATURES_ENABLEFILETOOLS` | Enable/disable file system tools |
|
|
302
|
+
| `enableNetworkTools` | `MCP_FEATURES_ENABLENETWORKTOOLS` | Enable/disable network tools |
|
|
303
|
+
| `enableDebugMode` | `MCP_FEATURES_ENABLEDEBUGMODE` | Enable/disable debug mode |
|
|
304
|
+
|
|
305
|
+
### Usage Examples
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# Disable browser tools
|
|
309
|
+
MCP_FEATURES_ENABLEBROWSERTOOLS=false node mcpServer.js
|
|
310
|
+
|
|
311
|
+
# Run in production mode
|
|
312
|
+
NODE_ENV=production node mcpServer.js
|
|
313
|
+
|
|
314
|
+
# Enable debug mode
|
|
315
|
+
MCP_FEATURES_ENABLEDEBUGMODE=true node mcpServer.js
|
|
316
|
+
```
|
|
317
|
+
|