@vibebrowser/mcp 0.1.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 +190 -0
- package/README.md +289 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +37 -0
- package/dist/cli.js.map +1 -0
- package/dist/connection.d.ts +71 -0
- package/dist/connection.d.ts.map +1 -0
- package/dist/connection.js +227 -0
- package/dist/connection.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +42 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +139 -0
- package/dist/server.js.map +1 -0
- package/dist/types.d.ts +97 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +17 -0
- package/dist/types.js.map +1 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2024 Vibe Technologies
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
# Vibe MCP
|
|
2
|
+
|
|
3
|
+
MCP server for [Vibe AI Browser](https://vibebrowser.app) - allows AI agents to control your browser.
|
|
4
|
+
|
|
5
|
+
## What is this?
|
|
6
|
+
|
|
7
|
+
Vibe MCP connects AI applications like Claude Desktop, Cursor, VS Code, and others to your Chrome browser through the Vibe extension. This enables AI to:
|
|
8
|
+
|
|
9
|
+
- Navigate to websites
|
|
10
|
+
- Click buttons and links
|
|
11
|
+
- Fill out forms
|
|
12
|
+
- Take screenshots
|
|
13
|
+
- Extract page content
|
|
14
|
+
- And much more
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- **Fast** - Automation happens locally on your machine
|
|
19
|
+
- **Private** - Your browser activity stays on your device
|
|
20
|
+
- **Logged In** - Uses your existing browser profile with all your sessions
|
|
21
|
+
- **Stable** - Uses content scripts instead of CDP, avoiding common disconnection issues
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
### 1. Install the Vibe Extension
|
|
26
|
+
|
|
27
|
+
Install the Vibe AI Browser extension from [vibebrowser.app](https://vibebrowser.app) or the [Chrome Web Store](https://chrome.google.com/webstore).
|
|
28
|
+
|
|
29
|
+
### 2. Configure Your AI Application
|
|
30
|
+
|
|
31
|
+
Add the Vibe MCP server to your AI application's configuration:
|
|
32
|
+
|
|
33
|
+
<details>
|
|
34
|
+
<summary><strong>Claude Desktop</strong></summary>
|
|
35
|
+
|
|
36
|
+
Edit your Claude Desktop config file:
|
|
37
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
38
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"mcpServers": {
|
|
43
|
+
"vibe": {
|
|
44
|
+
"command": "npx",
|
|
45
|
+
"args": ["-y", "@vibebrowser/mcp"]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Restart Claude Desktop after saving.
|
|
52
|
+
|
|
53
|
+
</details>
|
|
54
|
+
|
|
55
|
+
<details>
|
|
56
|
+
<summary><strong>Cursor</strong></summary>
|
|
57
|
+
|
|
58
|
+
1. Open Cursor Settings (Cmd/Ctrl + ,)
|
|
59
|
+
2. Go to "Features" → "MCP Servers"
|
|
60
|
+
3. Click "Add Server" and add:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"vibe": {
|
|
65
|
+
"command": "npx",
|
|
66
|
+
"args": ["-y", "@vibebrowser/mcp"]
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Or edit `~/.cursor/mcp.json` directly.
|
|
72
|
+
|
|
73
|
+
</details>
|
|
74
|
+
|
|
75
|
+
<details>
|
|
76
|
+
<summary><strong>VS Code (GitHub Copilot)</strong></summary>
|
|
77
|
+
|
|
78
|
+
Add to your VS Code settings.json:
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"github.copilot.chat.mcpServers": {
|
|
83
|
+
"vibe": {
|
|
84
|
+
"command": "npx",
|
|
85
|
+
"args": ["-y", "@vibebrowser/mcp"]
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Or use the MCP extension settings UI.
|
|
92
|
+
|
|
93
|
+
</details>
|
|
94
|
+
|
|
95
|
+
<details>
|
|
96
|
+
<summary><strong>Windsurf</strong></summary>
|
|
97
|
+
|
|
98
|
+
Edit `~/.codeium/windsurf/mcp_config.json`:
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"mcpServers": {
|
|
103
|
+
"vibe": {
|
|
104
|
+
"command": "npx",
|
|
105
|
+
"args": ["-y", "@vibebrowser/mcp"]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
</details>
|
|
112
|
+
|
|
113
|
+
<details>
|
|
114
|
+
<summary><strong>OpenCode</strong></summary>
|
|
115
|
+
|
|
116
|
+
Add to your `.opencode/config.json`:
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"mcp": {
|
|
121
|
+
"servers": {
|
|
122
|
+
"vibe": {
|
|
123
|
+
"command": "npx",
|
|
124
|
+
"args": ["-y", "@vibebrowser/mcp"]
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
</details>
|
|
132
|
+
|
|
133
|
+
<details>
|
|
134
|
+
<summary><strong>Gemini CLI</strong></summary>
|
|
135
|
+
|
|
136
|
+
Add to `~/.gemini/settings.json`:
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"mcpServers": {
|
|
141
|
+
"vibe": {
|
|
142
|
+
"command": "npx",
|
|
143
|
+
"args": ["-y", "@vibebrowser/mcp"]
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
</details>
|
|
150
|
+
|
|
151
|
+
<details>
|
|
152
|
+
<summary><strong>OpenAI Codex CLI</strong></summary>
|
|
153
|
+
|
|
154
|
+
Add to your Codex configuration:
|
|
155
|
+
|
|
156
|
+
```json
|
|
157
|
+
{
|
|
158
|
+
"mcp": {
|
|
159
|
+
"vibe": {
|
|
160
|
+
"command": "npx",
|
|
161
|
+
"args": ["-y", "@vibebrowser/mcp"]
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
</details>
|
|
168
|
+
|
|
169
|
+
### 3. Connect the Extension
|
|
170
|
+
|
|
171
|
+
1. Open Chrome with the Vibe extension installed
|
|
172
|
+
2. Click the Vibe extension icon in the toolbar
|
|
173
|
+
3. Click "Connect to MCP" to enable external control
|
|
174
|
+
4. The status should show "Connected"
|
|
175
|
+
|
|
176
|
+
## Available Tools
|
|
177
|
+
|
|
178
|
+
The MCP server exposes all Vibe browser tools:
|
|
179
|
+
|
|
180
|
+
| Tool | Description |
|
|
181
|
+
|------|-------------|
|
|
182
|
+
| `navigate_to_url` | Navigate to a URL |
|
|
183
|
+
| `go_back` | Go back in history |
|
|
184
|
+
| `go_forward` | Go forward in history |
|
|
185
|
+
| `click` | Click an element |
|
|
186
|
+
| `type` | Type text into an element |
|
|
187
|
+
| `fill` | Fill a form field |
|
|
188
|
+
| `scroll` | Scroll the page |
|
|
189
|
+
| `take_screenshot` | Capture a screenshot |
|
|
190
|
+
| `get_page_content` | Get page text content |
|
|
191
|
+
| `list_tabs` | List open browser tabs |
|
|
192
|
+
| `create_new_tab` | Open a new tab |
|
|
193
|
+
| `switch_to_tab` | Switch to a tab |
|
|
194
|
+
| `close_tab` | Close a tab |
|
|
195
|
+
| `keyboard_shortcut` | Press keyboard shortcuts |
|
|
196
|
+
| `web_search` | Search the web |
|
|
197
|
+
|
|
198
|
+
## CLI Options
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
npx @anthropic/vibe-mcp --help
|
|
202
|
+
|
|
203
|
+
Options:
|
|
204
|
+
-p, --port <number> WebSocket port for extension connection (default: 19989)
|
|
205
|
+
-d, --debug Enable debug logging
|
|
206
|
+
-h, --help Show help
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Architecture
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
|
213
|
+
│ AI Application │────►│ Vibe MCP Server │────►│ Vibe Extension │
|
|
214
|
+
│ (Claude/Cursor) │stdio│ (this package) │ WS │ (Chrome) │
|
|
215
|
+
└─────────────────┘ └─────────────────┘ └─────────────────┘
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
The MCP server:
|
|
219
|
+
1. Receives tool calls from AI applications via stdio (MCP protocol)
|
|
220
|
+
2. Forwards them to the Vibe extension via WebSocket
|
|
221
|
+
3. Returns results back to the AI application
|
|
222
|
+
|
|
223
|
+
## Troubleshooting
|
|
224
|
+
|
|
225
|
+
### "No connection to Vibe extension"
|
|
226
|
+
|
|
227
|
+
1. Make sure the Vibe extension is installed in Chrome
|
|
228
|
+
2. Click the extension icon and ensure "Connect to MCP" is enabled
|
|
229
|
+
3. Check that no other application is using port 19989
|
|
230
|
+
|
|
231
|
+
### Port already in use
|
|
232
|
+
|
|
233
|
+
Use a different port:
|
|
234
|
+
|
|
235
|
+
```json
|
|
236
|
+
{
|
|
237
|
+
"mcpServers": {
|
|
238
|
+
"vibe": {
|
|
239
|
+
"command": "npx",
|
|
240
|
+
"args": ["-y", "@anthropic/vibe-mcp", "--port", "19990"]
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Make sure to also update the port in the extension settings.
|
|
247
|
+
|
|
248
|
+
### Debug mode
|
|
249
|
+
|
|
250
|
+
Enable debug logging to see what's happening:
|
|
251
|
+
|
|
252
|
+
```json
|
|
253
|
+
{
|
|
254
|
+
"mcpServers": {
|
|
255
|
+
"vibe": {
|
|
256
|
+
"command": "npx",
|
|
257
|
+
"args": ["-y", "@anthropic/vibe-mcp", "--debug"]
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Development
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# Clone the repository
|
|
267
|
+
git clone https://github.com/VibeTechnologies/vibe-mcp.git
|
|
268
|
+
cd vibe-mcp
|
|
269
|
+
|
|
270
|
+
# Install dependencies
|
|
271
|
+
npm install
|
|
272
|
+
|
|
273
|
+
# Build
|
|
274
|
+
npm run build
|
|
275
|
+
|
|
276
|
+
# Run locally
|
|
277
|
+
node dist/cli.js --debug
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## License
|
|
281
|
+
|
|
282
|
+
Apache-2.0
|
|
283
|
+
|
|
284
|
+
## Links
|
|
285
|
+
|
|
286
|
+
- [Vibe AI Browser](https://vibebrowser.app)
|
|
287
|
+
- [Documentation](https://docs.vibebrowser.app)
|
|
288
|
+
- [GitHub](https://github.com/VibeTechnologies/vibe-mcp)
|
|
289
|
+
- [Report Issues](https://github.com/VibeTechnologies/vibe-mcp/issues)
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;GAIG"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* Vibe MCP Server - CLI Entry Point
|
|
5
|
+
*
|
|
6
|
+
* Command-line interface for starting the MCP server.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const commander_1 = require("commander");
|
|
10
|
+
const server_js_1 = require("./server.js");
|
|
11
|
+
const types_js_1 = require("./types.js");
|
|
12
|
+
commander_1.program
|
|
13
|
+
.name('vibe-mcp')
|
|
14
|
+
.description('MCP server for Vibe AI Browser - allows AI agents to control your browser')
|
|
15
|
+
.version('0.1.0')
|
|
16
|
+
.option('-p, --port <number>', 'WebSocket port for extension connection', String(types_js_1.DEFAULT_WS_PORT))
|
|
17
|
+
.option('-d, --debug', 'Enable debug logging', false)
|
|
18
|
+
.action(async (options) => {
|
|
19
|
+
const port = parseInt(options.port, 10);
|
|
20
|
+
if (isNaN(port) || port < 1024 || port > 65535) {
|
|
21
|
+
console.error('Error: Port must be a number between 1024 and 65535');
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
await (0, server_js_1.createServer)({
|
|
26
|
+
port,
|
|
27
|
+
debug: options.debug,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
32
|
+
console.error(`Failed to start server: ${message}`);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
commander_1.program.parse();
|
|
37
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AACA;;;;GAIG;;AAEH,yCAAoC;AACpC,2CAA2C;AAC3C,yCAA6C;AAE7C,mBAAO;KACJ,IAAI,CAAC,UAAU,CAAC;KAChB,WAAW,CAAC,2EAA2E,CAAC;KACxF,OAAO,CAAC,OAAO,CAAC;KAChB,MAAM,CAAC,qBAAqB,EAAE,yCAAyC,EAAE,MAAM,CAAC,0BAAe,CAAC,CAAC;KACjG,MAAM,CAAC,aAAa,EAAE,sBAAsB,EAAE,KAAK,CAAC;KACpD,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACxB,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAExC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC;QAC/C,OAAO,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,IAAA,wBAAY,EAAC;YACjB,IAAI;YACJ,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO,CAAC,KAAK,CAAC,2BAA2B,OAAO,EAAE,CAAC,CAAC;QACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,mBAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vibe MCP Server - Extension Connection
|
|
3
|
+
*
|
|
4
|
+
* Manages WebSocket connection to the Vibe browser extension.
|
|
5
|
+
*/
|
|
6
|
+
import { EventEmitter } from 'events';
|
|
7
|
+
import { ConnectionStatus, ToolDefinition, ToolResult, SnapshotResult } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Extension connection manager
|
|
10
|
+
*/
|
|
11
|
+
export declare class ExtensionConnection extends EventEmitter {
|
|
12
|
+
private wss;
|
|
13
|
+
private ws;
|
|
14
|
+
private status;
|
|
15
|
+
private pendingRequests;
|
|
16
|
+
private requestIdCounter;
|
|
17
|
+
private port;
|
|
18
|
+
private debug;
|
|
19
|
+
private tools;
|
|
20
|
+
private reconnectTimer;
|
|
21
|
+
constructor(port?: number, debug?: boolean);
|
|
22
|
+
/**
|
|
23
|
+
* Start the WebSocket server and wait for extension connection
|
|
24
|
+
*/
|
|
25
|
+
start(): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Stop the WebSocket server
|
|
28
|
+
*/
|
|
29
|
+
stop(): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Handle new WebSocket connection from extension
|
|
32
|
+
*/
|
|
33
|
+
private handleConnection;
|
|
34
|
+
/**
|
|
35
|
+
* Handle message from extension
|
|
36
|
+
*/
|
|
37
|
+
private handleMessage;
|
|
38
|
+
/**
|
|
39
|
+
* Send a message to the extension and wait for response
|
|
40
|
+
*/
|
|
41
|
+
private sendRequest;
|
|
42
|
+
/**
|
|
43
|
+
* Refresh available tools from extension
|
|
44
|
+
*/
|
|
45
|
+
refreshTools(): Promise<ToolDefinition[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Get cached list of available tools
|
|
48
|
+
*/
|
|
49
|
+
getTools(): ToolDefinition[];
|
|
50
|
+
/**
|
|
51
|
+
* Call a tool on the extension
|
|
52
|
+
*/
|
|
53
|
+
callTool(name: string, args: Record<string, unknown>): Promise<ToolResult>;
|
|
54
|
+
/**
|
|
55
|
+
* Get accessibility snapshot of current page
|
|
56
|
+
*/
|
|
57
|
+
getSnapshot(): Promise<SnapshotResult>;
|
|
58
|
+
/**
|
|
59
|
+
* Check if extension is connected
|
|
60
|
+
*/
|
|
61
|
+
isConnected(): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Get connection status
|
|
64
|
+
*/
|
|
65
|
+
getStatus(): ConnectionStatus;
|
|
66
|
+
/**
|
|
67
|
+
* Log message if debug is enabled
|
|
68
|
+
*/
|
|
69
|
+
private log;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=connection.d.ts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;;OAEG;IACH,OAAO,CAAC,GAAG;CAKZ"}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Vibe MCP Server - Extension Connection
|
|
4
|
+
*
|
|
5
|
+
* Manages WebSocket connection to the Vibe browser extension.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.ExtensionConnection = void 0;
|
|
9
|
+
const ws_1 = require("ws");
|
|
10
|
+
const events_1 = require("events");
|
|
11
|
+
const types_js_1 = require("./types.js");
|
|
12
|
+
const NO_CONNECTION_MESSAGE = `No connection to Vibe extension. Please:
|
|
13
|
+
1. Install the Vibe AI Browser extension from https://vibebrowser.app
|
|
14
|
+
2. Click the Vibe extension icon in Chrome
|
|
15
|
+
3. Click "Connect to MCP" to enable external control`;
|
|
16
|
+
/**
|
|
17
|
+
* Extension connection manager
|
|
18
|
+
*/
|
|
19
|
+
class ExtensionConnection extends events_1.EventEmitter {
|
|
20
|
+
wss = null;
|
|
21
|
+
ws = null;
|
|
22
|
+
status = 'disconnected';
|
|
23
|
+
pendingRequests = new Map();
|
|
24
|
+
requestIdCounter = 0;
|
|
25
|
+
port;
|
|
26
|
+
debug;
|
|
27
|
+
tools = [];
|
|
28
|
+
reconnectTimer = null;
|
|
29
|
+
constructor(port = types_js_1.DEFAULT_WS_PORT, debug = false) {
|
|
30
|
+
super();
|
|
31
|
+
this.port = port;
|
|
32
|
+
this.debug = debug;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Start the WebSocket server and wait for extension connection
|
|
36
|
+
*/
|
|
37
|
+
async start() {
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
try {
|
|
40
|
+
this.wss = new ws_1.WebSocketServer({ port: this.port, host: '127.0.0.1' });
|
|
41
|
+
this.wss.on('listening', () => {
|
|
42
|
+
this.log(`WebSocket server listening on ws://127.0.0.1:${this.port}`);
|
|
43
|
+
resolve();
|
|
44
|
+
});
|
|
45
|
+
this.wss.on('connection', (ws) => {
|
|
46
|
+
this.handleConnection(ws);
|
|
47
|
+
});
|
|
48
|
+
this.wss.on('error', (error) => {
|
|
49
|
+
this.log(`WebSocket server error: ${error.message}`);
|
|
50
|
+
reject(error);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
reject(error);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Stop the WebSocket server
|
|
60
|
+
*/
|
|
61
|
+
async stop() {
|
|
62
|
+
if (this.reconnectTimer) {
|
|
63
|
+
clearTimeout(this.reconnectTimer);
|
|
64
|
+
this.reconnectTimer = null;
|
|
65
|
+
}
|
|
66
|
+
// Reject all pending requests
|
|
67
|
+
for (const [id, request] of this.pendingRequests) {
|
|
68
|
+
clearTimeout(request.timeout);
|
|
69
|
+
request.reject(new Error('Server shutting down'));
|
|
70
|
+
}
|
|
71
|
+
this.pendingRequests.clear();
|
|
72
|
+
if (this.ws) {
|
|
73
|
+
this.ws.close();
|
|
74
|
+
this.ws = null;
|
|
75
|
+
}
|
|
76
|
+
if (this.wss) {
|
|
77
|
+
return new Promise((resolve) => {
|
|
78
|
+
this.wss.close(() => {
|
|
79
|
+
this.wss = null;
|
|
80
|
+
this.status = 'disconnected';
|
|
81
|
+
resolve();
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Handle new WebSocket connection from extension
|
|
88
|
+
*/
|
|
89
|
+
handleConnection(ws) {
|
|
90
|
+
this.log('Extension connected');
|
|
91
|
+
// Close previous connection if any
|
|
92
|
+
if (this.ws) {
|
|
93
|
+
this.ws.close();
|
|
94
|
+
}
|
|
95
|
+
this.ws = ws;
|
|
96
|
+
this.status = 'connected';
|
|
97
|
+
this.emit('connected');
|
|
98
|
+
ws.on('message', (data) => {
|
|
99
|
+
try {
|
|
100
|
+
const message = JSON.parse(data.toString());
|
|
101
|
+
this.handleMessage(message);
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
this.log(`Failed to parse message: ${error}`);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
ws.on('close', () => {
|
|
108
|
+
this.log('Extension disconnected');
|
|
109
|
+
this.ws = null;
|
|
110
|
+
this.status = 'disconnected';
|
|
111
|
+
this.tools = [];
|
|
112
|
+
this.emit('disconnected');
|
|
113
|
+
});
|
|
114
|
+
ws.on('error', (error) => {
|
|
115
|
+
this.log(`WebSocket error: ${error.message}`);
|
|
116
|
+
});
|
|
117
|
+
// Request available tools
|
|
118
|
+
this.refreshTools().catch((error) => {
|
|
119
|
+
this.log(`Failed to get tools: ${error.message}`);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Handle message from extension
|
|
124
|
+
*/
|
|
125
|
+
handleMessage(message) {
|
|
126
|
+
this.log(`Received: ${message.type}`);
|
|
127
|
+
// Handle responses to pending requests
|
|
128
|
+
if (message.requestId) {
|
|
129
|
+
const pending = this.pendingRequests.get(message.requestId);
|
|
130
|
+
if (pending) {
|
|
131
|
+
clearTimeout(pending.timeout);
|
|
132
|
+
this.pendingRequests.delete(message.requestId);
|
|
133
|
+
if (message.type === 'error') {
|
|
134
|
+
pending.reject(new Error(message.error || 'Unknown error'));
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
pending.resolve(message.data);
|
|
138
|
+
}
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// Handle unsolicited messages
|
|
143
|
+
switch (message.type) {
|
|
144
|
+
case 'tools_list':
|
|
145
|
+
this.tools = message.data;
|
|
146
|
+
this.emit('tools_updated', this.tools);
|
|
147
|
+
break;
|
|
148
|
+
case 'snapshot':
|
|
149
|
+
this.emit('snapshot', message.data);
|
|
150
|
+
break;
|
|
151
|
+
case 'error':
|
|
152
|
+
this.log(`Extension error: ${message.error}`);
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Send a message to the extension and wait for response
|
|
158
|
+
*/
|
|
159
|
+
async sendRequest(type, data, timeoutMs = 30000) {
|
|
160
|
+
if (!this.ws || this.status !== 'connected') {
|
|
161
|
+
throw new Error(NO_CONNECTION_MESSAGE);
|
|
162
|
+
}
|
|
163
|
+
const requestId = `req_${++this.requestIdCounter}`;
|
|
164
|
+
return new Promise((resolve, reject) => {
|
|
165
|
+
const timeout = setTimeout(() => {
|
|
166
|
+
this.pendingRequests.delete(requestId);
|
|
167
|
+
reject(new Error(`Request timed out after ${timeoutMs}ms`));
|
|
168
|
+
}, timeoutMs);
|
|
169
|
+
this.pendingRequests.set(requestId, {
|
|
170
|
+
resolve: resolve,
|
|
171
|
+
reject,
|
|
172
|
+
timeout,
|
|
173
|
+
});
|
|
174
|
+
const message = { type, requestId, data };
|
|
175
|
+
this.ws.send(JSON.stringify(message));
|
|
176
|
+
this.log(`Sent: ${type} (${requestId})`);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Refresh available tools from extension
|
|
181
|
+
*/
|
|
182
|
+
async refreshTools() {
|
|
183
|
+
const tools = await this.sendRequest('list_tools');
|
|
184
|
+
this.tools = tools;
|
|
185
|
+
return tools;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Get cached list of available tools
|
|
189
|
+
*/
|
|
190
|
+
getTools() {
|
|
191
|
+
return this.tools;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Call a tool on the extension
|
|
195
|
+
*/
|
|
196
|
+
async callTool(name, args) {
|
|
197
|
+
return this.sendRequest('call_tool', { name, arguments: args });
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Get accessibility snapshot of current page
|
|
201
|
+
*/
|
|
202
|
+
async getSnapshot() {
|
|
203
|
+
return this.sendRequest('get_snapshot');
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Check if extension is connected
|
|
207
|
+
*/
|
|
208
|
+
isConnected() {
|
|
209
|
+
return this.status === 'connected';
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Get connection status
|
|
213
|
+
*/
|
|
214
|
+
getStatus() {
|
|
215
|
+
return this.status;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Log message if debug is enabled
|
|
219
|
+
*/
|
|
220
|
+
log(message) {
|
|
221
|
+
if (this.debug) {
|
|
222
|
+
console.error(`[vibe-mcp] ${message}`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
exports.ExtensionConnection = ExtensionConnection;
|
|
227
|
+
//# sourceMappingURL=connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,2BAAgD;AAChD,mCAAsC;AACtC,yCAQoB;AAEpB,MAAM,qBAAqB,GAAG;;;qDAGuB,CAAC;AAWtD;;GAEG;AACH,MAAa,mBAAoB,SAAQ,qBAAY;IAC3C,GAAG,GAA2B,IAAI,CAAC;IACnC,EAAE,GAAqB,IAAI,CAAC;IAC5B,MAAM,GAAqB,cAAc,CAAC;IAC1C,eAAe,GAAgC,IAAI,GAAG,EAAE,CAAC;IACzD,gBAAgB,GAAG,CAAC,CAAC;IACrB,IAAI,CAAS;IACb,KAAK,CAAU;IACf,KAAK,GAAqB,EAAE,CAAC;IAC7B,cAAc,GAA0B,IAAI,CAAC;IAErD,YAAY,OAAe,0BAAe,EAAE,QAAiB,KAAK;QAChE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,OAAO,IAAI,OAAO,CAAC,CA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CAAC;CACF;AAjPD,kDAiPC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,cAAc,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Vibe MCP Server - Main Exports
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.ExtensionConnection = exports.createServer = exports.VibeMcpServer = void 0;
|
|
21
|
+
var server_js_1 = require("./server.js");
|
|
22
|
+
Object.defineProperty(exports, "VibeMcpServer", { enumerable: true, get: function () { return server_js_1.VibeMcpServer; } });
|
|
23
|
+
Object.defineProperty(exports, "createServer", { enumerable: true, get: function () { return server_js_1.createServer; } });
|
|
24
|
+
var connection_js_1 = require("./connection.js");
|
|
25
|
+
Object.defineProperty(exports, "ExtensionConnection", { enumerable: true, get: function () { return connection_js_1.ExtensionConnection; } });
|
|
26
|
+
__exportStar(require("./types.js"), exports);
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;AAEH,yCAA0D;AAAjD,0GAAA,aAAa,OAAA;AAAE,yGAAA,YAAY,OAAA;AACpC,iDAAsD;AAA7C,oHAAA,mBAAmB,OAAA;AAC5B,6CAA2B"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vibe MCP Server - Main Server
|
|
3
|
+
*
|
|
4
|
+
* MCP server that bridges AI clients with the Vibe browser extension.
|
|
5
|
+
*/
|
|
6
|
+
import { ServerConfig } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Vibe MCP Server
|
|
9
|
+
*
|
|
10
|
+
* Exposes Vibe browser tools to MCP clients via stdio transport.
|
|
11
|
+
*/
|
|
12
|
+
export declare class VibeMcpServer {
|
|
13
|
+
private server;
|
|
14
|
+
private connection;
|
|
15
|
+
private config;
|
|
16
|
+
constructor(config?: Partial<ServerConfig>);
|
|
17
|
+
/**
|
|
18
|
+
* Set up MCP request handlers
|
|
19
|
+
*/
|
|
20
|
+
private setupHandlers;
|
|
21
|
+
/**
|
|
22
|
+
* Set up extension connection events
|
|
23
|
+
*/
|
|
24
|
+
private setupConnectionEvents;
|
|
25
|
+
/**
|
|
26
|
+
* Start the MCP server
|
|
27
|
+
*/
|
|
28
|
+
start(): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Shutdown the server
|
|
31
|
+
*/
|
|
32
|
+
private shutdown;
|
|
33
|
+
/**
|
|
34
|
+
* Log message if debug is enabled
|
|
35
|
+
*/
|
|
36
|
+
private log;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Create and start the MCP server
|
|
40
|
+
*/
|
|
41
|
+
export declare function createServer(config?: Partial<ServerConfig>): Promise<VibeMcpServer>;
|
|
42
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,EAAwB,YAAY,EAAkB,MAAM,YAAY,CAAC;AAKhF;;;;GAIG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,UAAU,CAAsB;IACxC,OAAO,CAAC,MAAM,CAAe;gBAEjB,MAAM,GAAE,OAAO,CAAC,YAAY,CAAM;IAyB9C;;OAEG;IACH,OAAO,CAAC,aAAa;IAmCrB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAc7B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB5B;;OAEG;YACW,QAAQ;IAatB;;OAEG;IACH,OAAO,CAAC,GAAG;CAKZ;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAIzF"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Vibe MCP Server - Main Server
|
|
4
|
+
*
|
|
5
|
+
* MCP server that bridges AI clients with the Vibe browser extension.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.VibeMcpServer = void 0;
|
|
9
|
+
exports.createServer = createServer;
|
|
10
|
+
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
|
|
11
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
12
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
13
|
+
const connection_js_1 = require("./connection.js");
|
|
14
|
+
const SERVER_NAME = 'vibe-mcp';
|
|
15
|
+
const SERVER_VERSION = '0.1.0';
|
|
16
|
+
/**
|
|
17
|
+
* Vibe MCP Server
|
|
18
|
+
*
|
|
19
|
+
* Exposes Vibe browser tools to MCP clients via stdio transport.
|
|
20
|
+
*/
|
|
21
|
+
class VibeMcpServer {
|
|
22
|
+
server;
|
|
23
|
+
connection;
|
|
24
|
+
config;
|
|
25
|
+
constructor(config = {}) {
|
|
26
|
+
this.config = {
|
|
27
|
+
port: config.port ?? 19989,
|
|
28
|
+
host: config.host ?? '127.0.0.1',
|
|
29
|
+
debug: config.debug ?? false,
|
|
30
|
+
};
|
|
31
|
+
this.connection = new connection_js_1.ExtensionConnection(this.config.port, this.config.debug);
|
|
32
|
+
this.server = new index_js_1.Server({
|
|
33
|
+
name: SERVER_NAME,
|
|
34
|
+
version: SERVER_VERSION,
|
|
35
|
+
}, {
|
|
36
|
+
capabilities: {
|
|
37
|
+
tools: {},
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
this.setupHandlers();
|
|
41
|
+
this.setupConnectionEvents();
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Set up MCP request handlers
|
|
45
|
+
*/
|
|
46
|
+
setupHandlers() {
|
|
47
|
+
// List available tools
|
|
48
|
+
this.server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
|
|
49
|
+
const tools = this.connection.getTools();
|
|
50
|
+
return {
|
|
51
|
+
tools: tools.map((tool) => ({
|
|
52
|
+
name: tool.name,
|
|
53
|
+
description: tool.description,
|
|
54
|
+
inputSchema: tool.inputSchema,
|
|
55
|
+
})),
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
// Call a tool
|
|
59
|
+
this.server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
60
|
+
const { name, arguments: args } = request.params;
|
|
61
|
+
try {
|
|
62
|
+
const result = await this.connection.callTool(name, args ?? {});
|
|
63
|
+
return {
|
|
64
|
+
content: result.content,
|
|
65
|
+
isError: result.isError,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
70
|
+
return {
|
|
71
|
+
content: [{ type: 'text', text: `Error: ${message}` }],
|
|
72
|
+
isError: true,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Set up extension connection events
|
|
79
|
+
*/
|
|
80
|
+
setupConnectionEvents() {
|
|
81
|
+
this.connection.on('connected', () => {
|
|
82
|
+
this.log('Extension connected');
|
|
83
|
+
});
|
|
84
|
+
this.connection.on('disconnected', () => {
|
|
85
|
+
this.log('Extension disconnected');
|
|
86
|
+
});
|
|
87
|
+
this.connection.on('tools_updated', (tools) => {
|
|
88
|
+
this.log(`Received ${tools.length} tools from extension`);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Start the MCP server
|
|
93
|
+
*/
|
|
94
|
+
async start() {
|
|
95
|
+
// Start WebSocket server for extension connection
|
|
96
|
+
await this.connection.start();
|
|
97
|
+
this.log(`Waiting for Vibe extension connection on port ${this.config.port}...`);
|
|
98
|
+
// Connect MCP server to stdio transport
|
|
99
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
100
|
+
await this.server.connect(transport);
|
|
101
|
+
this.log('MCP server started on stdio');
|
|
102
|
+
// Handle process termination
|
|
103
|
+
process.on('SIGINT', () => this.shutdown());
|
|
104
|
+
process.on('SIGTERM', () => this.shutdown());
|
|
105
|
+
process.stdin.on('close', () => this.shutdown());
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Shutdown the server
|
|
109
|
+
*/
|
|
110
|
+
async shutdown() {
|
|
111
|
+
this.log('Shutting down...');
|
|
112
|
+
try {
|
|
113
|
+
await this.connection.stop();
|
|
114
|
+
await this.server.close();
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
// Ignore errors during shutdown
|
|
118
|
+
}
|
|
119
|
+
process.exit(0);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Log message if debug is enabled
|
|
123
|
+
*/
|
|
124
|
+
log(message) {
|
|
125
|
+
if (this.config.debug) {
|
|
126
|
+
console.error(`[${SERVER_NAME}] ${message}`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.VibeMcpServer = VibeMcpServer;
|
|
131
|
+
/**
|
|
132
|
+
* Create and start the MCP server
|
|
133
|
+
*/
|
|
134
|
+
async function createServer(config) {
|
|
135
|
+
const server = new VibeMcpServer(config);
|
|
136
|
+
await server.start();
|
|
137
|
+
return server;
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAyJH,oCAIC;AA3JD,wEAAmE;AACnE,wEAAiF;AACjF,iEAI4C;AAC5C,mDAAsD;AAGtD,MAAM,WAAW,GAAG,UAAU,CAAC;AAC/B,MAAM,cAAc,GAAG,OAAO,CAAC;AAE/B;;;;GAIG;AACH,MAAa,aAAa;IAChB,MAAM,CAAS;IACf,UAAU,CAAsB;IAChC,MAAM,CAAe;IAE7B,YAAY,SAAgC,EAAE;QAC5C,IAAI,CAAC,MAAM,GAAG;YACZ,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,KAAK;YAC1B,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,WAAW;YAChC,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,KAAK;SAC7B,CAAC;QAEF,IAAI,CAAC,UAAU,GAAG,IAAI,mCAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,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,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC5C,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC7C,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,QAAQ;QACpB,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAE7B,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;YAC7B,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAC5B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,gCAAgC;QAClC,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED;;OAEG;IACK,GAAG,CAAC,OAAe;QACzB,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,IAAI,WAAW,KAAK,OAAO,EAAE,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;CACF;AAhID,sCAgIC;AAED;;GAEG;AACI,KAAK,UAAU,YAAY,CAAC,MAA8B;IAC/D,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACrB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vibe MCP Server - Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for the MCP server protocol and extension communication.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* MCP Protocol version supported
|
|
8
|
+
*/
|
|
9
|
+
export declare const MCP_PROTOCOL_VERSION = "2024-11-05";
|
|
10
|
+
/**
|
|
11
|
+
* Default WebSocket port for extension connection
|
|
12
|
+
*/
|
|
13
|
+
export declare const DEFAULT_WS_PORT = 19989;
|
|
14
|
+
/**
|
|
15
|
+
* Connection status
|
|
16
|
+
*/
|
|
17
|
+
export type ConnectionStatus = 'disconnected' | 'connecting' | 'connected';
|
|
18
|
+
/**
|
|
19
|
+
* Message from extension to MCP server
|
|
20
|
+
*/
|
|
21
|
+
export interface ExtensionMessage {
|
|
22
|
+
type: 'connected' | 'disconnected' | 'tool_result' | 'tools_list' | 'error' | 'snapshot';
|
|
23
|
+
requestId?: string;
|
|
24
|
+
data?: unknown;
|
|
25
|
+
error?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Message from MCP server to extension
|
|
29
|
+
*/
|
|
30
|
+
export interface ServerMessage {
|
|
31
|
+
type: 'list_tools' | 'call_tool' | 'get_snapshot' | 'ping';
|
|
32
|
+
requestId: string;
|
|
33
|
+
data?: {
|
|
34
|
+
name?: string;
|
|
35
|
+
arguments?: Record<string, unknown>;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Tool definition from extension
|
|
40
|
+
*/
|
|
41
|
+
export interface ToolDefinition {
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
inputSchema: {
|
|
45
|
+
type: 'object';
|
|
46
|
+
properties?: Record<string, JsonSchemaProperty>;
|
|
47
|
+
required?: string[];
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* JSON Schema property
|
|
52
|
+
*/
|
|
53
|
+
export interface JsonSchemaProperty {
|
|
54
|
+
type?: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
enum?: string[];
|
|
57
|
+
items?: JsonSchemaProperty;
|
|
58
|
+
properties?: Record<string, JsonSchemaProperty>;
|
|
59
|
+
required?: string[];
|
|
60
|
+
default?: unknown;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Tool execution result
|
|
64
|
+
*/
|
|
65
|
+
export interface ToolResult {
|
|
66
|
+
success: boolean;
|
|
67
|
+
content: ToolResultContent[];
|
|
68
|
+
isError?: boolean;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Tool result content types
|
|
72
|
+
*/
|
|
73
|
+
export type ToolResultContent = {
|
|
74
|
+
type: 'text';
|
|
75
|
+
text: string;
|
|
76
|
+
} | {
|
|
77
|
+
type: 'image';
|
|
78
|
+
data: string;
|
|
79
|
+
mimeType: string;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Accessibility snapshot result
|
|
83
|
+
*/
|
|
84
|
+
export interface SnapshotResult {
|
|
85
|
+
url: string;
|
|
86
|
+
title: string;
|
|
87
|
+
snapshot: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Server configuration
|
|
91
|
+
*/
|
|
92
|
+
export interface ServerConfig {
|
|
93
|
+
port: number;
|
|
94
|
+
host: string;
|
|
95
|
+
debug: boolean;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB,eAAe,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,eAAe,QAAQ,CAAC;AAErC;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG,YAAY,GAAG,WAAW,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,WAAW,GAAG,cAAc,GAAG,aAAa,GAAG,YAAY,GAAG,OAAO,GAAG,UAAU,CAAC;IACzF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,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AAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Vibe MCP Server - Types
|
|
4
|
+
*
|
|
5
|
+
* Type definitions for the MCP server protocol and extension communication.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.DEFAULT_WS_PORT = exports.MCP_PROTOCOL_VERSION = void 0;
|
|
9
|
+
/**
|
|
10
|
+
* MCP Protocol version supported
|
|
11
|
+
*/
|
|
12
|
+
exports.MCP_PROTOCOL_VERSION = '2024-11-05';
|
|
13
|
+
/**
|
|
14
|
+
* Default WebSocket port for extension connection
|
|
15
|
+
*/
|
|
16
|
+
exports.DEFAULT_WS_PORT = 19989;
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;GAEG;AACU,QAAA,oBAAoB,GAAG,YAAY,CAAC;AAEjD;;GAEG;AACU,QAAA,eAAe,GAAG,KAAK,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vibebrowser/mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for Vibe AI Browser - allows AI agents to control your browser",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"vibe-mcp": "./dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"dev": "tsc --watch",
|
|
16
|
+
"start": "node dist/cli.js",
|
|
17
|
+
"prepublishOnly": "npm run build"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"mcp",
|
|
21
|
+
"browser",
|
|
22
|
+
"automation",
|
|
23
|
+
"ai",
|
|
24
|
+
"vibe",
|
|
25
|
+
"claude",
|
|
26
|
+
"cursor",
|
|
27
|
+
"windsurf"
|
|
28
|
+
],
|
|
29
|
+
"author": "Vibe Technologies",
|
|
30
|
+
"license": "Apache-2.0",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/VibeTechnologies/vibe-mcp.git"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://vibebrowser.app",
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/VibeTechnologies/vibe-mcp/issues"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=18.0.0"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
44
|
+
"commander": "^12.0.0",
|
|
45
|
+
"ws": "^8.18.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^20.0.0",
|
|
49
|
+
"@types/ws": "^8.5.0",
|
|
50
|
+
"typescript": "^5.0.0"
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"dist",
|
|
54
|
+
"README.md",
|
|
55
|
+
"LICENSE"
|
|
56
|
+
]
|
|
57
|
+
}
|