opencode-browser 1.0.0 → 1.0.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/README.md +7 -22
- package/index.ts +4 -13
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -26,28 +26,9 @@ Before using this plugin, you need:
|
|
|
26
26
|
2. Install the Browser MCP extension for your browser (Chrome or Edge)
|
|
27
27
|
3. Follow the extension setup instructions
|
|
28
28
|
|
|
29
|
-
### Step 2: Configure
|
|
29
|
+
### Step 2: Configure OpenCode
|
|
30
30
|
|
|
31
|
-
Add
|
|
32
|
-
|
|
33
|
-
```json
|
|
34
|
-
{
|
|
35
|
-
"$schema": "https://opencode.ai/config.json",
|
|
36
|
-
"mcp": {
|
|
37
|
-
"browsermcp": {
|
|
38
|
-
"type": "local",
|
|
39
|
-
"command": ["npx", "-y", "@browsermcp/mcp@latest"],
|
|
40
|
-
"enabled": true
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Step 3: Install the Plugin
|
|
47
|
-
|
|
48
|
-
#### Recommended: Install from npm
|
|
49
|
-
|
|
50
|
-
Simply add the plugin to your `opencode.json`:
|
|
31
|
+
Add this configuration to your `opencode.json`:
|
|
51
32
|
|
|
52
33
|
```json
|
|
53
34
|
{
|
|
@@ -63,7 +44,11 @@ Simply add the plugin to your `opencode.json`:
|
|
|
63
44
|
}
|
|
64
45
|
```
|
|
65
46
|
|
|
66
|
-
|
|
47
|
+
This configuration does two things:
|
|
48
|
+
1. **Installs the plugin** - OpenCode automatically downloads `opencode-browser` from npm
|
|
49
|
+
2. **Configures Browser MCP** - Sets up the MCP server that actually controls the browser
|
|
50
|
+
|
|
51
|
+
That's it! No manual file copying required. OpenCode handles everything automatically.
|
|
67
52
|
|
|
68
53
|
#### Alternative: Install Locally (for development/testing)
|
|
69
54
|
|
package/index.ts
CHANGED
|
@@ -18,8 +18,6 @@ import type { Plugin } from "@opencode-ai/plugin"
|
|
|
18
18
|
export const BrowserMCPPlugin: Plugin = async (ctx) => {
|
|
19
19
|
const { client, project } = ctx
|
|
20
20
|
|
|
21
|
-
console.log("Browser MCP Plugin initialized!")
|
|
22
|
-
|
|
23
21
|
// Track if we've informed the user about browser automation capabilities
|
|
24
22
|
let browserCapabilitiesShown = false
|
|
25
23
|
|
|
@@ -28,7 +26,7 @@ export const BrowserMCPPlugin: Plugin = async (ctx) => {
|
|
|
28
26
|
* Hook into session creation to inject browser automation context
|
|
29
27
|
*/
|
|
30
28
|
"session.created": async ({ session }) => {
|
|
31
|
-
|
|
29
|
+
// Session created - ready for browser automation
|
|
32
30
|
},
|
|
33
31
|
|
|
34
32
|
/**
|
|
@@ -37,12 +35,7 @@ export const BrowserMCPPlugin: Plugin = async (ctx) => {
|
|
|
37
35
|
"tool.execute.before": async (input, output) => {
|
|
38
36
|
// Detect if a browser-related MCP tool is being called
|
|
39
37
|
if (input.tool.startsWith("browsermcp_")) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// Log the tool execution for debugging
|
|
43
|
-
if (output.args) {
|
|
44
|
-
console.log(`Browser MCP Plugin: Tool arguments:`, JSON.stringify(output.args, null, 2))
|
|
45
|
-
}
|
|
38
|
+
// Browser tool execution starting
|
|
46
39
|
}
|
|
47
40
|
},
|
|
48
41
|
|
|
@@ -51,8 +44,6 @@ export const BrowserMCPPlugin: Plugin = async (ctx) => {
|
|
|
51
44
|
*/
|
|
52
45
|
"tool.execute.after": async (input, output) => {
|
|
53
46
|
if (input.tool.startsWith("browsermcp_")) {
|
|
54
|
-
console.log(`Browser MCP Plugin: Completed browser tool: ${input.tool}`)
|
|
55
|
-
|
|
56
47
|
// You can add custom post-processing here, such as:
|
|
57
48
|
// - Logging results to a file
|
|
58
49
|
// - Sending notifications
|
|
@@ -96,12 +87,12 @@ The Browser MCP integration has been used in this session. When resuming:
|
|
|
96
87
|
event: async ({ event }) => {
|
|
97
88
|
// Handle session idle - could be used to close browser tabs
|
|
98
89
|
if (event.type === "session.idle") {
|
|
99
|
-
|
|
90
|
+
// Session is idle
|
|
100
91
|
}
|
|
101
92
|
|
|
102
93
|
// Handle session errors - could help debug browser automation issues
|
|
103
94
|
if (event.type === "session.error") {
|
|
104
|
-
|
|
95
|
+
// Session error occurred
|
|
105
96
|
}
|
|
106
97
|
}
|
|
107
98
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-browser",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "OpenCode plugin that integrates Browser MCP for browser automation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
27
|
-
"url": "git+https://github.com/
|
|
27
|
+
"url": "git+https://github.com/michaljach/opencode-browser.git"
|
|
28
28
|
},
|
|
29
|
-
"homepage": "https://github.com/
|
|
29
|
+
"homepage": "https://github.com/michaljach/opencode-browser#readme",
|
|
30
30
|
"bugs": {
|
|
31
|
-
"url": "https://github.com/
|
|
31
|
+
"url": "https://github.com/michaljach/opencode-browser/issues"
|
|
32
32
|
},
|
|
33
33
|
"files": [
|
|
34
34
|
"index.ts",
|