@solvvn/mcp-simple-browser 1.0.5 → 1.0.7
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/README.md +0 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +33 -37
- package/dist/tools.js.map +1 -1
- package/package.json +2 -1
- package/screenshot_getip_pro.png +0 -0
- package/src/tools.ts +33 -37
package/README.md
CHANGED
|
@@ -63,7 +63,6 @@ Add to your Claude Desktop config:
|
|
|
63
63
|
| Tool | Description |
|
|
64
64
|
|------|-------------|
|
|
65
65
|
| `browser_navigate` | Navigate to a URL and wait for it to load |
|
|
66
|
-
| `browser_screenshot` | Take a screenshot (returns base64) |
|
|
67
66
|
| `browser_save_screenshot` | Take a screenshot and save to file |
|
|
68
67
|
| `browser_click` | Click an element by CSS selector |
|
|
69
68
|
| `browser_type` | Type text into an input field |
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA0LzE,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAiBrD"}
|
package/dist/tools.js
CHANGED
|
@@ -15,12 +15,13 @@ const SearchEngines = {
|
|
|
15
15
|
const tools = [
|
|
16
16
|
createTool({
|
|
17
17
|
name: "browser_navigate",
|
|
18
|
-
description: "
|
|
18
|
+
description: "Go to a URL. Use this first to load a webpage before taking actions. Supports any HTTP/HTTPS URL.",
|
|
19
19
|
schema: {
|
|
20
|
-
url: z.string().describe("
|
|
20
|
+
url: z.string().describe("Full URL including https:// (e.g., https://example.com)"),
|
|
21
21
|
waitUntil: z
|
|
22
22
|
.enum(["load", "domcontentloaded", "networkidle", "commit"])
|
|
23
|
-
.default("networkidle")
|
|
23
|
+
.default("networkidle")
|
|
24
|
+
.describe("When to consider navigation complete: networkidle (recommended) waits for all requests to finish"),
|
|
24
25
|
},
|
|
25
26
|
handler: async ({ url, waitUntil }) => {
|
|
26
27
|
const page = await getPage();
|
|
@@ -29,20 +30,11 @@ const tools = [
|
|
|
29
30
|
},
|
|
30
31
|
}),
|
|
31
32
|
createTool({
|
|
32
|
-
name: "
|
|
33
|
-
description: "
|
|
33
|
+
name: "browser_click",
|
|
34
|
+
description: "Click a button, link, or any element. Use after navigating to a page. Requires knowing the element's CSS selector.",
|
|
34
35
|
schema: {
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
handler: async ({ fullPage }) => {
|
|
38
|
-
const buffer = await (await getPage()).screenshot({ fullPage });
|
|
39
|
-
return success({ format: "png", data: buffer.toString("base64") });
|
|
36
|
+
selector: z.string().describe("CSS selector of the element to click (e.g., button, a, #id, .class)"),
|
|
40
37
|
},
|
|
41
|
-
}),
|
|
42
|
-
createTool({
|
|
43
|
-
name: "browser_click",
|
|
44
|
-
description: "Click an element by CSS selector.",
|
|
45
|
-
schema: { selector: z.string().describe("CSS selector") },
|
|
46
38
|
handler: async ({ selector }) => {
|
|
47
39
|
await (await getPage()).click(selector);
|
|
48
40
|
return success({});
|
|
@@ -50,11 +42,11 @@ const tools = [
|
|
|
50
42
|
}),
|
|
51
43
|
createTool({
|
|
52
44
|
name: "browser_type",
|
|
53
|
-
description: "Type text into an input field.",
|
|
45
|
+
description: "Type text into an input field or text area. Use for filling forms, search boxes, or any text input.",
|
|
54
46
|
schema: {
|
|
55
|
-
selector: z.string(),
|
|
56
|
-
text: z.string(),
|
|
57
|
-
delay: z.number().default(50).describe("Delay between keystrokes (
|
|
47
|
+
selector: z.string().describe("CSS selector of the input field (e.g., input, textarea, #search)"),
|
|
48
|
+
text: z.string().describe("Text to type"),
|
|
49
|
+
delay: z.number().default(50).describe("Delay between keystrokes in milliseconds (default: 50)"),
|
|
58
50
|
},
|
|
59
51
|
handler: async ({ selector, text, delay }) => {
|
|
60
52
|
await (await getPage()).type(selector, text, { delay });
|
|
@@ -63,15 +55,15 @@ const tools = [
|
|
|
63
55
|
}),
|
|
64
56
|
createTool({
|
|
65
57
|
name: "browser_get_content",
|
|
66
|
-
description: "Get the HTML
|
|
58
|
+
description: "Get the raw HTML source of the current page. Use when you need the full HTML structure for scraping or analysis.",
|
|
67
59
|
schema: {},
|
|
68
60
|
handler: async () => ({ html: await (await getPage()).content() }),
|
|
69
61
|
}),
|
|
70
62
|
createTool({
|
|
71
63
|
name: "browser_get_text",
|
|
72
|
-
description: "
|
|
64
|
+
description: "Extract visible text from the page or a specific element. Use for reading content like article text, prices, or descriptions.",
|
|
73
65
|
schema: {
|
|
74
|
-
selector: z.string().optional().describe("CSS selector
|
|
66
|
+
selector: z.string().optional().describe("CSS selector to extract text from specific element. Defaults to entire page."),
|
|
75
67
|
},
|
|
76
68
|
handler: async ({ selector }) => {
|
|
77
69
|
const el = selector || "body";
|
|
@@ -81,16 +73,18 @@ const tools = [
|
|
|
81
73
|
}),
|
|
82
74
|
createTool({
|
|
83
75
|
name: "browser_evaluate",
|
|
84
|
-
description: "
|
|
85
|
-
schema: {
|
|
76
|
+
description: "Run custom JavaScript in the page context. Use for complex interactions, data extraction, or DOM manipulation that other tools can't handle.",
|
|
77
|
+
schema: {
|
|
78
|
+
script: z.string().describe("JavaScript code to execute. Can return values. Runs in browser context (window, document available)."),
|
|
79
|
+
},
|
|
86
80
|
handler: async ({ script }) => ({ result: await (await getPage()).evaluate(script) }),
|
|
87
81
|
}),
|
|
88
82
|
createTool({
|
|
89
83
|
name: "browser_search",
|
|
90
|
-
description: "Search the web
|
|
84
|
+
description: "Search the web and get ranked results with titles, URLs, and snippets. Good for research, finding pages, or checking information.",
|
|
91
85
|
schema: {
|
|
92
|
-
query: z.string(),
|
|
93
|
-
engine: z.enum(["google", "duckduckgo", "bing"]).default("duckduckgo"),
|
|
86
|
+
query: z.string().describe("Search query/keywords"),
|
|
87
|
+
engine: z.enum(["google", "duckduckgo", "bing"]).default("duckduckgo").describe("Search engine to use: duckduckgo (default, no tracking), google (more results), bing (alternative)"),
|
|
94
88
|
},
|
|
95
89
|
handler: async ({ query, engine }) => {
|
|
96
90
|
const page = await getPage();
|
|
@@ -120,8 +114,10 @@ const tools = [
|
|
|
120
114
|
}),
|
|
121
115
|
createTool({
|
|
122
116
|
name: "browser_wait",
|
|
123
|
-
description: "
|
|
124
|
-
schema: {
|
|
117
|
+
description: "Pause execution for a specified time. Use when you need to wait for page animations, lazy loading, or after clicking something that triggers async updates.",
|
|
118
|
+
schema: {
|
|
119
|
+
milliseconds: z.number().describe("Time to wait in milliseconds (e.g., 1000 = 1 second)"),
|
|
120
|
+
},
|
|
125
121
|
handler: async ({ milliseconds }) => {
|
|
126
122
|
await new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
127
123
|
return success({ waited: milliseconds });
|
|
@@ -129,7 +125,7 @@ const tools = [
|
|
|
129
125
|
}),
|
|
130
126
|
createTool({
|
|
131
127
|
name: "browser_close",
|
|
132
|
-
description: "Close the browser and
|
|
128
|
+
description: "Close the browser and free up resources. Call this when you're done with browser operations to clean up.",
|
|
133
129
|
schema: {},
|
|
134
130
|
handler: async () => {
|
|
135
131
|
await closeBrowser();
|
|
@@ -138,10 +134,10 @@ const tools = [
|
|
|
138
134
|
}),
|
|
139
135
|
createTool({
|
|
140
136
|
name: "browser_save_screenshot",
|
|
141
|
-
description: "Take a screenshot and save
|
|
137
|
+
description: "Take a screenshot of the current page and save to a file. Use to capture visual state, verify page content, or create records.",
|
|
142
138
|
schema: {
|
|
143
|
-
filepath: z.string().describe("
|
|
144
|
-
fullPage: z.boolean().default(false).describe("
|
|
139
|
+
filepath: z.string().describe("Full path where to save the image (e.g., /tmp/screenshot.png)"),
|
|
140
|
+
fullPage: z.boolean().default(false).describe("true = capture entire scrollable page, false = only visible viewport"),
|
|
145
141
|
},
|
|
146
142
|
handler: async ({ filepath, fullPage }) => {
|
|
147
143
|
const buffer = await (await getPage()).screenshot({ fullPage });
|
|
@@ -151,11 +147,11 @@ const tools = [
|
|
|
151
147
|
}),
|
|
152
148
|
createTool({
|
|
153
149
|
name: "browser_print_to_pdf",
|
|
154
|
-
description: "
|
|
150
|
+
description: "Save the current page as a PDF document. Useful for archiving pages, generating reports, or preserving content in printable format.",
|
|
155
151
|
schema: {
|
|
156
|
-
filepath: z.string().describe("
|
|
157
|
-
landscape: z.boolean().default(false).describe("
|
|
158
|
-
printBackground: z.boolean().default(true).describe("
|
|
152
|
+
filepath: z.string().describe("Full path where to save the PDF (e.g., /tmp/page.pdf)"),
|
|
153
|
+
landscape: z.boolean().default(false).describe("true = landscape orientation, false = portrait"),
|
|
154
|
+
printBackground: z.boolean().default(true).describe("true = include background colors/images, false = white background only"),
|
|
159
155
|
},
|
|
160
156
|
handler: async ({ filepath, landscape, printBackground }) => {
|
|
161
157
|
const pdf = await (await getPage()).pdf({
|
package/dist/tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAWrD,SAAS,UAAU,CAA0B,GAAsB;IACjE,OAAO,GAA+C,CAAC;AACzD,CAAC;AAED,SAAS,OAAO,CAAoC,KAAQ;IAC1D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,CAAC;AACrC,CAAC;AAED,MAAM,aAAa,GAAG;IACpB,MAAM,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,mCAAmC,CAAC,EAAE;IAC7D,UAAU,EAA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24
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
25
25
|
"cloakbrowser": "^0.3.30",
|
|
26
26
|
"dotenv": "^17.4.2",
|
|
27
|
+
"playwright-core": "^1.53.2",
|
|
27
28
|
"zod": "^4.4.3"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
Binary file
|
package/src/tools.ts
CHANGED
|
@@ -30,12 +30,13 @@ const SearchEngines = {
|
|
|
30
30
|
const tools = [
|
|
31
31
|
createTool({
|
|
32
32
|
name: "browser_navigate",
|
|
33
|
-
description: "
|
|
33
|
+
description: "Go to a URL. Use this first to load a webpage before taking actions. Supports any HTTP/HTTPS URL.",
|
|
34
34
|
schema: {
|
|
35
|
-
url: z.string().describe("
|
|
35
|
+
url: z.string().describe("Full URL including https:// (e.g., https://example.com)"),
|
|
36
36
|
waitUntil: z
|
|
37
37
|
.enum(["load", "domcontentloaded", "networkidle", "commit"])
|
|
38
|
-
.default("networkidle")
|
|
38
|
+
.default("networkidle")
|
|
39
|
+
.describe("When to consider navigation complete: networkidle (recommended) waits for all requests to finish"),
|
|
39
40
|
},
|
|
40
41
|
handler: async ({ url, waitUntil }) => {
|
|
41
42
|
const page = await getPage();
|
|
@@ -44,20 +45,11 @@ const tools = [
|
|
|
44
45
|
},
|
|
45
46
|
}),
|
|
46
47
|
createTool({
|
|
47
|
-
name: "
|
|
48
|
-
description: "
|
|
48
|
+
name: "browser_click",
|
|
49
|
+
description: "Click a button, link, or any element. Use after navigating to a page. Requires knowing the element's CSS selector.",
|
|
49
50
|
schema: {
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
handler: async ({ fullPage }) => {
|
|
53
|
-
const buffer = await (await getPage()).screenshot({ fullPage });
|
|
54
|
-
return success({ format: "png", data: buffer.toString("base64") });
|
|
51
|
+
selector: z.string().describe("CSS selector of the element to click (e.g., button, a, #id, .class)"),
|
|
55
52
|
},
|
|
56
|
-
}),
|
|
57
|
-
createTool({
|
|
58
|
-
name: "browser_click",
|
|
59
|
-
description: "Click an element by CSS selector.",
|
|
60
|
-
schema: { selector: z.string().describe("CSS selector") },
|
|
61
53
|
handler: async ({ selector }) => {
|
|
62
54
|
await (await getPage()).click(selector);
|
|
63
55
|
return success({});
|
|
@@ -65,11 +57,11 @@ const tools = [
|
|
|
65
57
|
}),
|
|
66
58
|
createTool({
|
|
67
59
|
name: "browser_type",
|
|
68
|
-
description: "Type text into an input field.",
|
|
60
|
+
description: "Type text into an input field or text area. Use for filling forms, search boxes, or any text input.",
|
|
69
61
|
schema: {
|
|
70
|
-
selector: z.string(),
|
|
71
|
-
text: z.string(),
|
|
72
|
-
delay: z.number().default(50).describe("Delay between keystrokes (
|
|
62
|
+
selector: z.string().describe("CSS selector of the input field (e.g., input, textarea, #search)"),
|
|
63
|
+
text: z.string().describe("Text to type"),
|
|
64
|
+
delay: z.number().default(50).describe("Delay between keystrokes in milliseconds (default: 50)"),
|
|
73
65
|
},
|
|
74
66
|
handler: async ({ selector, text, delay }) => {
|
|
75
67
|
await (await getPage()).type(selector, text, { delay });
|
|
@@ -78,15 +70,15 @@ const tools = [
|
|
|
78
70
|
}),
|
|
79
71
|
createTool({
|
|
80
72
|
name: "browser_get_content",
|
|
81
|
-
description: "Get the HTML
|
|
73
|
+
description: "Get the raw HTML source of the current page. Use when you need the full HTML structure for scraping or analysis.",
|
|
82
74
|
schema: {},
|
|
83
75
|
handler: async () => ({ html: await (await getPage()).content() }),
|
|
84
76
|
}),
|
|
85
77
|
createTool({
|
|
86
78
|
name: "browser_get_text",
|
|
87
|
-
description: "
|
|
79
|
+
description: "Extract visible text from the page or a specific element. Use for reading content like article text, prices, or descriptions.",
|
|
88
80
|
schema: {
|
|
89
|
-
selector: z.string().optional().describe("CSS selector
|
|
81
|
+
selector: z.string().optional().describe("CSS selector to extract text from specific element. Defaults to entire page."),
|
|
90
82
|
},
|
|
91
83
|
handler: async ({ selector }) => {
|
|
92
84
|
const el = selector || "body";
|
|
@@ -96,16 +88,18 @@ const tools = [
|
|
|
96
88
|
}),
|
|
97
89
|
createTool({
|
|
98
90
|
name: "browser_evaluate",
|
|
99
|
-
description: "
|
|
100
|
-
schema: {
|
|
91
|
+
description: "Run custom JavaScript in the page context. Use for complex interactions, data extraction, or DOM manipulation that other tools can't handle.",
|
|
92
|
+
schema: {
|
|
93
|
+
script: z.string().describe("JavaScript code to execute. Can return values. Runs in browser context (window, document available)."),
|
|
94
|
+
},
|
|
101
95
|
handler: async ({ script }) => ({ result: await (await getPage()).evaluate(script) }),
|
|
102
96
|
}),
|
|
103
97
|
createTool({
|
|
104
98
|
name: "browser_search",
|
|
105
|
-
description: "Search the web
|
|
99
|
+
description: "Search the web and get ranked results with titles, URLs, and snippets. Good for research, finding pages, or checking information.",
|
|
106
100
|
schema: {
|
|
107
|
-
query: z.string(),
|
|
108
|
-
engine: z.enum(["google", "duckduckgo", "bing"]).default("duckduckgo"),
|
|
101
|
+
query: z.string().describe("Search query/keywords"),
|
|
102
|
+
engine: z.enum(["google", "duckduckgo", "bing"]).default("duckduckgo").describe("Search engine to use: duckduckgo (default, no tracking), google (more results), bing (alternative)"),
|
|
109
103
|
},
|
|
110
104
|
handler: async ({ query, engine }) => {
|
|
111
105
|
const page = await getPage();
|
|
@@ -136,8 +130,10 @@ const tools = [
|
|
|
136
130
|
}),
|
|
137
131
|
createTool({
|
|
138
132
|
name: "browser_wait",
|
|
139
|
-
description: "
|
|
140
|
-
schema: {
|
|
133
|
+
description: "Pause execution for a specified time. Use when you need to wait for page animations, lazy loading, or after clicking something that triggers async updates.",
|
|
134
|
+
schema: {
|
|
135
|
+
milliseconds: z.number().describe("Time to wait in milliseconds (e.g., 1000 = 1 second)"),
|
|
136
|
+
},
|
|
141
137
|
handler: async ({ milliseconds }) => {
|
|
142
138
|
await new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
143
139
|
return success({ waited: milliseconds });
|
|
@@ -145,7 +141,7 @@ const tools = [
|
|
|
145
141
|
}),
|
|
146
142
|
createTool({
|
|
147
143
|
name: "browser_close",
|
|
148
|
-
description: "Close the browser and
|
|
144
|
+
description: "Close the browser and free up resources. Call this when you're done with browser operations to clean up.",
|
|
149
145
|
schema: {},
|
|
150
146
|
handler: async () => {
|
|
151
147
|
await closeBrowser();
|
|
@@ -154,10 +150,10 @@ const tools = [
|
|
|
154
150
|
}),
|
|
155
151
|
createTool({
|
|
156
152
|
name: "browser_save_screenshot",
|
|
157
|
-
description: "Take a screenshot and save
|
|
153
|
+
description: "Take a screenshot of the current page and save to a file. Use to capture visual state, verify page content, or create records.",
|
|
158
154
|
schema: {
|
|
159
|
-
filepath: z.string().describe("
|
|
160
|
-
fullPage: z.boolean().default(false).describe("
|
|
155
|
+
filepath: z.string().describe("Full path where to save the image (e.g., /tmp/screenshot.png)"),
|
|
156
|
+
fullPage: z.boolean().default(false).describe("true = capture entire scrollable page, false = only visible viewport"),
|
|
161
157
|
},
|
|
162
158
|
handler: async ({ filepath, fullPage }) => {
|
|
163
159
|
const buffer = await (await getPage()).screenshot({ fullPage });
|
|
@@ -167,11 +163,11 @@ const tools = [
|
|
|
167
163
|
}),
|
|
168
164
|
createTool({
|
|
169
165
|
name: "browser_print_to_pdf",
|
|
170
|
-
description: "
|
|
166
|
+
description: "Save the current page as a PDF document. Useful for archiving pages, generating reports, or preserving content in printable format.",
|
|
171
167
|
schema: {
|
|
172
|
-
filepath: z.string().describe("
|
|
173
|
-
landscape: z.boolean().default(false).describe("
|
|
174
|
-
printBackground: z.boolean().default(true).describe("
|
|
168
|
+
filepath: z.string().describe("Full path where to save the PDF (e.g., /tmp/page.pdf)"),
|
|
169
|
+
landscape: z.boolean().default(false).describe("true = landscape orientation, false = portrait"),
|
|
170
|
+
printBackground: z.boolean().default(true).describe("true = include background colors/images, false = white background only"),
|
|
175
171
|
},
|
|
176
172
|
handler: async ({ filepath, landscape, printBackground }) => {
|
|
177
173
|
const pdf = await (await getPage()).pdf({
|