Skip to content

Commit c615cc6

Browse files
committed
v1
1 parent 6cf3f14 commit c615cc6

19 files changed

+2434
-715
lines changed

.DS_Store

6 KB
Binary file not shown.

browser-tools-mcp/README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Browser Tools MCP Server
2+
3+
A Model Context Protocol (MCP) server that provides AI-powered browser tools integration. This server works in conjunction with the Browser Tools Server to provide AI capabilities for browser debugging and analysis.
4+
5+
## Features
6+
7+
- MCP protocol implementation
8+
- Browser console log access
9+
- Network request analysis
10+
- Screenshot capture capabilities
11+
- Element selection and inspection
12+
- Real-time browser state monitoring
13+
14+
## Installation
15+
16+
```bash
17+
npx @agentdeskai/browser-tools-mcp
18+
```
19+
20+
Or install globally:
21+
22+
```bash
23+
npm install -g @agentdeskai/browser-tools-mcp
24+
```
25+
26+
## Usage
27+
28+
1. First, make sure the Browser Tools Server is running:
29+
30+
```bash
31+
npx @agentdeskai/browser-tools-server
32+
```
33+
34+
2. Then start the MCP server:
35+
36+
```bash
37+
npx @agentdeskai/browser-tools-mcp
38+
```
39+
40+
3. The MCP server will connect to the Browser Tools Server and provide the following capabilities:
41+
42+
- Console log retrieval
43+
- Network request monitoring
44+
- Screenshot capture
45+
- Element selection
46+
- Browser state analysis
47+
48+
## MCP Functions
49+
50+
The server provides the following MCP functions:
51+
52+
- `mcp_getConsoleLogs` - Retrieve browser console logs
53+
- `mcp_getConsoleErrors` - Get browser console errors
54+
- `mcp_getNetworkErrors` - Get network error logs
55+
- `mcp_getNetworkSuccess` - Get successful network requests
56+
- `mcp_getNetworkLogs` - Get all network logs
57+
- `mcp_getSelectedElement` - Get the currently selected DOM element
58+
59+
## Integration
60+
61+
This server is designed to work with AI tools and platforms that support the Model Context Protocol (MCP). It provides a standardized interface for AI models to interact with browser state and debugging information.
62+
63+
## License
64+
65+
MIT

mcp-server/src/mcp-server.ts renamed to browser-tools-mcp/mcp-server.ts

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
#!/usr/bin/env node
2+
13
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
24
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
35
import path from "path";
4-
import { z } from "zod";
6+
// import { z } from "zod";
57
// import fs from "fs";
68

79
// Create the MCP server
810
const server = new McpServer({
9-
name: "AI Browser Connector",
10-
version: "1.0.0",
11+
name: "Browsert Tools MCP",
12+
version: "1.0.9",
1113
});
1214

1315
// Function to get the port from the .port file
@@ -71,19 +73,19 @@ server.tool("getNetworkErrors", "Check our network ERROR logs", async () => {
7173
};
7274
});
7375

74-
// Return all XHR/fetch requests
75-
server.tool("getNetworkSuccess", "Check our network SUCCESS logs", async () => {
76-
const response = await fetch(`http://127.0.0.1:${PORT}/all-xhr`);
77-
const json = await response.json();
78-
return {
79-
content: [
80-
{
81-
type: "text",
82-
text: JSON.stringify(json, null, 2),
83-
},
84-
],
85-
};
86-
});
76+
// // Return all XHR/fetch requests
77+
// server.tool("getNetworkSuccess", "Check our network SUCCESS logs", async () => {
78+
// const response = await fetch(`http://127.0.0.1:${PORT}/all-xhr`);
79+
// const json = await response.json();
80+
// return {
81+
// content: [
82+
// {
83+
// type: "text",
84+
// text: JSON.stringify(json, null, 2),
85+
// },
86+
// ],
87+
// };
88+
// });
8789

8890
// Return all XHR/fetch requests
8991
server.tool("getNetworkLogs", "Check ALL our network logs", async () => {
@@ -105,12 +107,12 @@ server.tool(
105107
"Take a screenshot of the current browser tab",
106108
async () => {
107109
try {
108-
const response = await fetch(`http://127.0.0.1:${PORT}/screenshot`, {
109-
method: "POST",
110-
headers: {
111-
"Content-Type": "application/json",
112-
},
113-
});
110+
const response = await fetch(
111+
`http://127.0.0.1:${PORT}/capture-screenshot`,
112+
{
113+
method: "POST",
114+
}
115+
);
114116

115117
const result = await response.json();
116118

@@ -168,6 +170,22 @@ server.tool(
168170
}
169171
);
170172

173+
// Add new tool for wiping logs
174+
server.tool("wipeLogs", "Wipe all browser logs from memory", async () => {
175+
const response = await fetch(`http://127.0.0.1:${PORT}/wipelogs`, {
176+
method: "POST",
177+
});
178+
const json = await response.json();
179+
return {
180+
content: [
181+
{
182+
type: "text",
183+
text: json.message,
184+
},
185+
],
186+
};
187+
});
188+
171189
// Start receiving messages on stdio
172190
(async () => {
173191
const transport = new StdioServerTransport();

mcp-server/package-lock.json renamed to browser-tools-mcp/package-lock.json

Lines changed: 54 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

browser-tools-mcp/package.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "@agentdeskai/browser-tools-mcp",
3+
"version": "1.0.9",
4+
"description": "MCP (Model Context Protocol) server for browser tools integration",
5+
"main": "dist/mcp-server.js",
6+
"bin": {
7+
"browser-tools-mcp": "dist/mcp-server.js"
8+
},
9+
"scripts": {
10+
"inspect": "tsc && npx @modelcontextprotocol/inspector node -- dist/mcp-server.js",
11+
"inspect-live": "npx @modelcontextprotocol/inspector npx -- @agentdeskai/browser-tools-mcp",
12+
"build": "tsc",
13+
"start": "tsc && node dist/mcp-server.js",
14+
"prepublishOnly": "npm run build"
15+
},
16+
"keywords": [
17+
"mcp",
18+
"model-context-protocol",
19+
"browser",
20+
"tools",
21+
"debugging",
22+
"ai",
23+
"chrome",
24+
"extension"
25+
],
26+
"author": "AgentDesk AI",
27+
"license": "MIT",
28+
"dependencies": {
29+
"@modelcontextprotocol/sdk": "^1.4.1",
30+
"body-parser": "^1.20.3",
31+
"cors": "^2.8.5",
32+
"express": "^4.21.2",
33+
"llm-cost": "^1.0.5",
34+
"ws": "^8.18.0"
35+
},
36+
"devDependencies": {
37+
"@types/ws": "^8.5.14",
38+
"@types/body-parser": "^1.19.5",
39+
"@types/cors": "^2.8.17",
40+
"@types/express": "^5.0.0",
41+
"@types/node": "^22.13.1",
42+
"typescript": "^5.7.3"
43+
}
44+
}

0 commit comments

Comments
 (0)