cocos-web-inspector-mcp 0.1.1 → 0.1.6
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 +226 -186
- package/dist/src/bridge.d.ts +69 -0
- package/dist/src/bridge.js +384 -62
- package/dist/src/browser.d.ts +6 -0
- package/dist/src/browser.js +34 -7
- package/dist/src/index.js +22 -13
- package/dist/src/server.d.ts +3 -1
- package/dist/src/server.js +157 -12
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1,186 +1,226 @@
|
|
|
1
|
-
# cocos-web-inspector-mcp
|
|
2
|
-
|
|
3
|
-
Read-only MCP server for inspecting Cocos Creator 3.x games running in a local Chromium browser.
|
|
4
|
-
|
|
5
|
-
## Scope
|
|
6
|
-
|
|
7
|
-
The current MVP supports:
|
|
8
|
-
|
|
9
|
-
- Chromium connected through a loopback Chrome DevTools Protocol (CDP) endpoint
|
|
10
|
-
- Cocos Creator 3.x web builds served from loopback
|
|
11
|
-
- stdio MCP transport
|
|
12
|
-
- Scene, node, component, and public-property inspection
|
|
13
|
-
- Temporary DOM-only node highlighting
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## Requirements
|
|
18
|
-
|
|
19
|
-
- Node.js 20+
|
|
20
|
-
- A Chromium browser started with remote debugging bound to loopback
|
|
21
|
-
- A Cocos Creator 3.x web build served from loopback
|
|
22
|
-
|
|
23
|
-
Start Chrome on Windows with a disposable profile:
|
|
24
|
-
|
|
25
|
-
```powershell
|
|
26
|
-
chrome.exe --remote-debugging-address=127.0.0.1 --remote-debugging-port=9222 --user-data-dir="$env:TEMP\cocos-mcp-profile"
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Keep this browser profile separate from normal browsing. CDP provides code-execution-level access to attached pages.
|
|
30
|
-
|
|
31
|
-
## Install and run
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
```powershell
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
"--
|
|
74
|
-
"
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
The endpoint may instead be provided through the MCP process environment:
|
|
84
|
-
|
|
85
|
-
```json
|
|
86
|
-
{
|
|
87
|
-
"mcpServers": {
|
|
88
|
-
"cocos-web-inspector": {
|
|
89
|
-
"command": "
|
|
90
|
-
"args": ["
|
|
91
|
-
"env": {
|
|
92
|
-
"COCOS_CDP_ENDPOINT": "http://127.0.0.1:9222"
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
## Tools
|
|
100
|
-
|
|
101
|
-
All tool input objects are strict. Unknown fields are rejected. Inspection tools are annotated as read-only, idempotent, non-destructive, and closed-world. The highlight tool is annotated as a non-destructive, non-idempotent, closed-world temporary mutation because repeated calls reset its removal timer.
|
|
102
|
-
|
|
103
|
-
| Tool | Purpose | Inputs |
|
|
104
|
-
| --- | --- | --- |
|
|
105
|
-
| `
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
108
|
-
| `
|
|
109
|
-
| `
|
|
110
|
-
|
|
111
|
-
`
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
-
|
|
140
|
-
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
-
|
|
150
|
-
-
|
|
151
|
-
-
|
|
152
|
-
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
-
|
|
164
|
-
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
1
|
+
# cocos-web-inspector-mcp
|
|
2
|
+
|
|
3
|
+
Read-only MCP server for inspecting Cocos Creator 3.x games running in a local Chromium browser.
|
|
4
|
+
|
|
5
|
+
## Scope
|
|
6
|
+
|
|
7
|
+
The current MVP supports:
|
|
8
|
+
|
|
9
|
+
- Chromium connected through a loopback Chrome DevTools Protocol (CDP) endpoint
|
|
10
|
+
- Cocos Creator 3.x web builds served from loopback
|
|
11
|
+
- stdio MCP transport
|
|
12
|
+
- Scene, node, component, and public-property inspection
|
|
13
|
+
- Temporary DOM-only node highlighting
|
|
14
|
+
|
|
15
|
+
By default it does not edit Cocos game state, launch browsers, expose browser network/storage data, or support Firefox/WebKit. Runtime mutations require the explicit `--allow-runtime-mutation` startup flag and affect the attached web build only.
|
|
16
|
+
|
|
17
|
+
## Requirements
|
|
18
|
+
|
|
19
|
+
- Node.js 20+
|
|
20
|
+
- A Chromium browser started with remote debugging bound to loopback
|
|
21
|
+
- A Cocos Creator 3.x web build served from loopback
|
|
22
|
+
|
|
23
|
+
Start Chrome on Windows with a disposable profile:
|
|
24
|
+
|
|
25
|
+
```powershell
|
|
26
|
+
chrome.exe --remote-debugging-address=127.0.0.1 --remote-debugging-port=9222 --user-data-dir="$env:TEMP\cocos-mcp-profile"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Keep this browser profile separate from normal browsing. CDP provides code-execution-level access to attached pages.
|
|
30
|
+
|
|
31
|
+
## Install and run
|
|
32
|
+
|
|
33
|
+
Run the published npm package with the default CDP endpoint, `http://127.0.0.1:9222`:
|
|
34
|
+
|
|
35
|
+
```powershell
|
|
36
|
+
npx --yes cocos-web-inspector-mcp
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Run with an explicit endpoint:
|
|
40
|
+
|
|
41
|
+
```powershell
|
|
42
|
+
npx --yes cocos-web-inspector-mcp --cdp-endpoint http://127.0.0.1:9222
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Enable the bounded runtime debugger explicitly:
|
|
46
|
+
|
|
47
|
+
```powershell
|
|
48
|
+
npx --yes cocos-web-inspector-mcp --allow-runtime-mutation
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
This flag registers runtime mutation tools for that server process only. Changes affect the current web build, may trigger Cocos callbacks, and disappear after reload; they do not edit Cocos project files.
|
|
52
|
+
|
|
53
|
+
Endpoint precedence is:
|
|
54
|
+
|
|
55
|
+
1. `--cdp-endpoint`
|
|
56
|
+
2. `COCOS_CDP_ENDPOINT`
|
|
57
|
+
3. `http://127.0.0.1:9222`
|
|
58
|
+
|
|
59
|
+
`--cdp-endpoint` is the only supported CLI option. It identifies the browser CDP endpoint, not a game page URL.
|
|
60
|
+
|
|
61
|
+
The server uses stdio for MCP. Standard output is reserved for protocol traffic; startup diagnostics are written to standard error.
|
|
62
|
+
|
|
63
|
+
## MCP configuration
|
|
64
|
+
|
|
65
|
+
Use the published npm package directly:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"mcpServers": {
|
|
70
|
+
"cocos-web-inspector": {
|
|
71
|
+
"command": "npx",
|
|
72
|
+
"args": [
|
|
73
|
+
"--yes",
|
|
74
|
+
"cocos-web-inspector-mcp",
|
|
75
|
+
"--cdp-endpoint",
|
|
76
|
+
"http://127.0.0.1:9222"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The endpoint may instead be provided through the MCP process environment:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"mcpServers": {
|
|
88
|
+
"cocos-web-inspector": {
|
|
89
|
+
"command": "npx",
|
|
90
|
+
"args": ["--yes", "cocos-web-inspector-mcp"],
|
|
91
|
+
"env": {
|
|
92
|
+
"COCOS_CDP_ENDPOINT": "http://127.0.0.1:9222"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Tools
|
|
100
|
+
|
|
101
|
+
All tool input objects are strict. Unknown fields are rejected. Inspection tools are annotated as read-only, idempotent, non-destructive, and closed-world. The highlight tool is annotated as a non-destructive, non-idempotent, closed-world temporary mutation because repeated calls reset its removal timer.
|
|
102
|
+
|
|
103
|
+
| Tool | Purpose | Inputs |
|
|
104
|
+
| --- | --- | --- |
|
|
105
|
+
| `cocos_list_pages` | List bounded summaries of eligible localhost pages, including sanitized URL, title, Cocos detection, version, and scene name. | None |
|
|
106
|
+
| `cocos_runtime_info` | Return bounded engine, scene, canvas, view, director, and node-count information. | `pageUrl?` |
|
|
107
|
+
| `cocos_runtime_diagnostics` | Return passive bounded hierarchy counts, depth, and duplicate names. Render metrics remain explicitly unsupported. | `pageUrl?` |
|
|
108
|
+
| `cocos_set_node_active` | Set one node's active state. Registered only with `--allow-runtime-mutation`; returns before/after state. | `pageUrl?`; `uuid`; `active` boolean |
|
|
109
|
+
| `cocos_set_transform` | Update supplied position, rotation, and/or scale fields for one node. | `pageUrl?`; `uuid`; `position?`, `rotation?`, `scale?` finite vectors |
|
|
110
|
+
| `cocos_set_property` | Update one bounded public component data property. | `pageUrl?`; node `uuid`; `componentUuid`; `key`; primitive/vector/size/color `value` matching current shape |
|
|
111
|
+
| `cocos_click_node` | Dispatch a real mouse click at the visible center of one UI node so Button/touch handlers run. Registered only with `--allow-runtime-mutation`. | `pageUrl?`; `uuid` |
|
|
112
|
+
| `cocos_pause` | Pause the Cocos director when its public API supports it. | `pageUrl?` |
|
|
113
|
+
| `cocos_resume` | Resume the Cocos director when its public API supports it. | `pageUrl?` |
|
|
114
|
+
| `cocos_scene_tree` | Return a bounded scene tree with node and component summaries. | `pageUrl?`; `maxDepth?` integer `0..20`, default `6`; `maxNodes?` integer `1..5000`, default `500` |
|
|
115
|
+
| `cocos_find_node` | Find nodes with exact or combined bounded filters. | `pageUrl?`; at least one of `uuid`, `name`, `path`, `nameContains`, `componentType`, `active`, `pathPrefix`; `limit?` integer `1..100`, default `20` |
|
|
116
|
+
| `cocos_get_components` | Return bounded component summaries for a node. | `pageUrl?`; `uuid` |
|
|
117
|
+
| `cocos_get_node` | Return one node's path, parent, bounded direct children, and components. | `pageUrl?`; `uuid` |
|
|
118
|
+
| `cocos_snapshot_subtree` | Return a bounded stateless hierarchy snapshot; clients compare snapshots. | `pageUrl?`; `uuid`; `maxDepth?`; `maxNodes?` |
|
|
119
|
+
| `cocos_get_node_bounds` | Return bounded canvas/viewport bounds, anchor, world position, and visibility for one UI node. | `pageUrl?`; `uuid` |
|
|
120
|
+
| `cocos_capture_node` | Return an in-memory viewport-clipped image for one visible UI node: PNG, falling back to JPEG when PNG exceeds the response limit; no file is written. | `pageUrl?`; `uuid` |
|
|
121
|
+
| `cocos_get_properties` | Serialize public properties for a node or one component selected by type or UUID. | `pageUrl?`; `uuid`; `componentType?` or `componentUuid?`; `maxDepth?` integer `0..6`, default `3`; `0` returns top-level primitives |
|
|
122
|
+
| `cocos_wait_for_property` | Poll one top-level property until it strictly equals a primitive value or the timeout passes. | `pageUrl?`; `uuid`; `componentType?` or `componentUuid?`; `key`; `equals`; `timeoutMs?` `100..30000`, default `5000`; `intervalMs?` `50..5000`, default `200` |
|
|
123
|
+
| `cocos_highlight_node` | Draw a temporary pointer-transparent overlay around a UI node. | `pageUrl?`; `uuid`; `durationMs?` integer `100..10000`, default `2000` |
|
|
124
|
+
|
|
125
|
+
`cocos_runtime_diagnostics` does not enable profiler/statistics systems. FPS, frame time, draw calls, triangles, and generic invalid-reference checks return `UNSUPPORTED_PUBLIC_API` until stable passive public Cocos APIs are verified. `cocos_highlight_node` temporarily mutates the page DOM only. It does not mutate the Cocos node/component graph or game state. `cocos_capture_node` clips only to the visible browser viewport, never falls back to full-page capture, limits captures to 1,024 × 1,024 CSS pixels / 1,048,576 total pixels, returns PNG (or JPEG fallback) base64 in-memory, and rejects responses still oversized after JPEG quality steps. Mutation results provide `before` values for manual inverse calls, but restoration cannot undo lifecycle callbacks or other runtime side effects. Frame stepping is unsupported pending a verified public Cocos API compatibility matrix.
|
|
126
|
+
|
|
127
|
+
### Page selection
|
|
128
|
+
|
|
129
|
+
Eligible game pages must use HTTP or HTTPS on a loopback host.
|
|
130
|
+
|
|
131
|
+
- With one eligible page, `pageUrl` may be omitted.
|
|
132
|
+
- With multiple eligible pages, `pageUrl` is required.
|
|
133
|
+
- `pageUrl` must exactly match the full URL reported by the browser, including path, query, and fragment.
|
|
134
|
+
- Tabs with identical URLs cannot be told apart; close duplicates before inspecting.
|
|
135
|
+
|
|
136
|
+
Every MCP client pointed at the same CDP endpoint sees every loopback tab in that browser. When several projects run at once, give each project its own Chromium, port, and profile, then configure the server at project scope:
|
|
137
|
+
|
|
138
|
+
```sh
|
|
139
|
+
chrome --remote-debugging-address=127.0.0.1 --remote-debugging-port=9223 --user-data-dir="$HOME/.cocos-mcp/project-a"
|
|
140
|
+
claude mcp add cocos-web-inspector npx -- -y cocos-web-inspector-mcp@latest --cdp-endpoint http://127.0.0.1:9223
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Tool validation, connection, selection, and inspection failures are returned as MCP tool errors. Operational errors include JSON `structuredContent` and text content with stable `code` and `message` fields. Current codes include `CDP_UNAVAILABLE`, `NO_LOCAL_PAGE`, `MULTIPLE_PAGES`, `PAGE_NOT_FOUND`, `COCOS_NOT_FOUND`, `SCENE_NOT_READY`, `NODE_NOT_FOUND`, and `COMPONENT_NOT_FOUND`.
|
|
144
|
+
|
|
145
|
+
### Output bounds
|
|
146
|
+
|
|
147
|
+
Responses are intentionally bounded:
|
|
148
|
+
|
|
149
|
+
- Total encoded JSON response: 200,000 UTF-8 bytes
|
|
150
|
+
- Scene traversal: caller-selected depth and node limits within the schema ranges above
|
|
151
|
+
- Property serialization: maximum depth `6`, maximum `1,000` properties
|
|
152
|
+
- Serialized strings: maximum `2,000` characters
|
|
153
|
+
- Node names: maximum `500` characters
|
|
154
|
+
- Page discovery: maximum `50` eligible pages
|
|
155
|
+
- Runtime node count: maximum `5,000` traversed nodes
|
|
156
|
+
|
|
157
|
+
Truncation is reported instead of silently returning an unbounded object.
|
|
158
|
+
|
|
159
|
+
## Security and threat model
|
|
160
|
+
|
|
161
|
+
CDP endpoints may use HTTP, HTTPS, WS, or WSS only on these loopback hosts:
|
|
162
|
+
|
|
163
|
+
- `localhost`
|
|
164
|
+
- Any `*.localhost` hostname
|
|
165
|
+
- IPv4 `127.0.0.0/8`
|
|
166
|
+
- IPv6 `::1`
|
|
167
|
+
|
|
168
|
+
CDP endpoint credentials, query strings, and fragments are rejected. Page targets must use HTTP or HTTPS on loopback.
|
|
169
|
+
|
|
170
|
+
The server intentionally exposes no tools for:
|
|
171
|
+
|
|
172
|
+
- Arbitrary JavaScript evaluation
|
|
173
|
+
- Cookies or storage state
|
|
174
|
+
- Request/response bodies or headers
|
|
175
|
+
- Authorization headers
|
|
176
|
+
- Network or console logs
|
|
177
|
+
|
|
178
|
+
Inspection still executes fixed bridge code inside the attached page. Treat all page content as untrusted data, including text that resembles instructions or prompt injection.
|
|
179
|
+
|
|
180
|
+
Property serialization skips accessors, private-prefixed keys, functions, symbols, cycles, and secret-like key names such as tokens, cookies, passwords, credentials, authorization data, and storage.
|
|
181
|
+
|
|
182
|
+
An allowlist of display fields is read directly from their backing data fields, still without invoking getters: `Label.string`, `RichText.string`, `Button.interactable`, `Toggle.isChecked`, and `Sprite.spriteFrame` (name and UUID only).
|
|
183
|
+
|
|
184
|
+
These controls reduce accidental disclosure; they do not make CDP a complete security boundary. Always:
|
|
185
|
+
|
|
186
|
+
- Use a disposable browser profile.
|
|
187
|
+
- Bind remote debugging to loopback only.
|
|
188
|
+
- Never expose the debugging port to a LAN or the Internet.
|
|
189
|
+
- Avoid sensitive accounts and data in the debugging profile.
|
|
190
|
+
- Use an OS sandbox or VM when stronger isolation is required.
|
|
191
|
+
|
|
192
|
+
## Development
|
|
193
|
+
|
|
194
|
+
```powershell
|
|
195
|
+
npm run install:chromium
|
|
196
|
+
npm run check
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
`npm run check` type-checks, builds, runs the self-contained Node.js tests, exercises a vendored Cocos Creator 3.8.8 web fixture through live Chromium and CDP, packs the npm tarball, installs it into a temporary project, and smoke-tests the installed binary. Use it before pushing. `npm test` remains available for build plus self-tests only; `npm run test:integration` runs the live browser test separately.
|
|
200
|
+
|
|
201
|
+
The test suite covers URL policy, CDP connection reuse and recovery, scene traversal, property redaction and cycle handling, output bounds, Cocos version rejection, strict tool schemas, exact tool annotations, real page selection, inspector and debugger tools, visual bounds/capture, snapshots, diagnostics, and browser reconnection. CI installs the matching Playwright Chromium revision, runs the full check on Ubuntu and Windows with Node.js 20 and 22, and rejects high-severity production dependency advisories.
|
|
202
|
+
|
|
203
|
+
## Troubleshooting
|
|
204
|
+
|
|
205
|
+
- `CDP_UNAVAILABLE`: start Chromium with loopback remote debugging; rerun `npm run install:chromium` for development tests. A `404` usually means Chrome's built-in remote debugging toggle (`chrome://inspect/#remote-debugging`) holds the port; turn it off or use another port, and check listeners with `lsof -nP -iTCP:9222 -sTCP:LISTEN`. When `127.0.0.1` returns 404 or refuses the connection, the server retries `[::1]` on the same port.
|
|
206
|
+
- `MULTIPLE_PAGES`: call `cocos_list_pages`, then pass the exact reported `pageUrl`. If tabs share one URL, close duplicates or use a separate Chromium per project (see Page selection).
|
|
207
|
+
- `COCOS_NOT_FOUND` or `SCENE_NOT_READY`: wait for the web build to finish loading; use `cocos_runtime_info` after the active scene exists.
|
|
208
|
+
- Runtime mutation tools missing: restart the server with `--allow-runtime-mutation`; a tool call cannot enable this mode.
|
|
209
|
+
- Bounds/capture unavailable: select a visible UI node with `UITransform`. Capture is viewport-only, bounded, and never falls back to a full-page screenshot.
|
|
210
|
+
|
|
211
|
+
## Release and compatibility
|
|
212
|
+
|
|
213
|
+
- [Compatibility matrix](docs/COMPATIBILITY.md)
|
|
214
|
+
- [Release procedure](docs/RELEASING.md)
|
|
215
|
+
- [Security policy](SECURITY.md)
|
|
216
|
+
- [Changelog](CHANGELOG.md)
|
|
217
|
+
|
|
218
|
+
## Architectural references
|
|
219
|
+
|
|
220
|
+
This is a clean implementation, not a fork. No source module was copied from these projects:
|
|
221
|
+
|
|
222
|
+
- [Chrome DevTools MCP](https://github.com/ChromeDevTools/chrome-devtools-mcp), Apache-2.0, inspected at `b2f522c8ba0fd2e00a679159b4aa5243de5f1b78`.
|
|
223
|
+
- [Playwright MCP](https://github.com/microsoft/playwright-mcp), Apache-2.0, inspected at `f183dad4a52965583e3cc1d59b88cdc279e2e57d`.
|
|
224
|
+
- [CC Inspector](https://github.com/qq790git/cc-inspector), MIT, inspected at `ef5ef0ae033ee6a6ae496cf566fe5d91cf05aafd`.
|
|
225
|
+
|
|
226
|
+
They informed MCP tool design, CDP connection constraints, Cocos runtime discovery, bounded responses, and highlight behavior. Their license files remain in separate read-only reference clones and are not redistributed here because this repository contains independently written code.
|
package/dist/src/bridge.d.ts
CHANGED
|
@@ -8,7 +8,22 @@ export type BridgeRequest = {
|
|
|
8
8
|
uuid?: string | undefined;
|
|
9
9
|
name?: string | undefined;
|
|
10
10
|
path?: string | undefined;
|
|
11
|
+
nameContains?: string | undefined;
|
|
12
|
+
componentType?: string | undefined;
|
|
13
|
+
active?: boolean | undefined;
|
|
14
|
+
pathPrefix?: string | undefined;
|
|
11
15
|
limit?: number | undefined;
|
|
16
|
+
} | {
|
|
17
|
+
action: 'getNode';
|
|
18
|
+
uuid: string;
|
|
19
|
+
} | {
|
|
20
|
+
action: 'getNodeBounds';
|
|
21
|
+
uuid: string;
|
|
22
|
+
} | {
|
|
23
|
+
action: 'snapshotSubtree';
|
|
24
|
+
uuid: string;
|
|
25
|
+
maxDepth?: number | undefined;
|
|
26
|
+
maxNodes?: number | undefined;
|
|
12
27
|
} | {
|
|
13
28
|
action: 'getComponents';
|
|
14
29
|
uuid: string;
|
|
@@ -16,11 +31,65 @@ export type BridgeRequest = {
|
|
|
16
31
|
action: 'getProperties';
|
|
17
32
|
uuid: string;
|
|
18
33
|
componentType?: string | undefined;
|
|
34
|
+
componentUuid?: string | undefined;
|
|
19
35
|
maxDepth?: number | undefined;
|
|
20
36
|
} | {
|
|
21
37
|
action: 'highlightNode';
|
|
22
38
|
uuid: string;
|
|
23
39
|
durationMs?: number | undefined;
|
|
40
|
+
} | {
|
|
41
|
+
action: 'runtimeInfo';
|
|
42
|
+
} | {
|
|
43
|
+
action: 'runtimeDiagnostics';
|
|
44
|
+
} | {
|
|
45
|
+
action: 'setNodeActive';
|
|
46
|
+
uuid: string;
|
|
47
|
+
active: boolean;
|
|
48
|
+
} | {
|
|
49
|
+
action: 'setTransform';
|
|
50
|
+
uuid: string;
|
|
51
|
+
position?: Vector3 | undefined;
|
|
52
|
+
rotation?: Quaternion | undefined;
|
|
53
|
+
scale?: Vector3 | undefined;
|
|
54
|
+
} | {
|
|
55
|
+
action: 'setProperty';
|
|
56
|
+
uuid: string;
|
|
57
|
+
componentUuid: string;
|
|
58
|
+
key: string;
|
|
59
|
+
value: PropertyValue;
|
|
60
|
+
} | {
|
|
61
|
+
action: 'pause';
|
|
62
|
+
} | {
|
|
63
|
+
action: 'resume';
|
|
64
|
+
};
|
|
65
|
+
type Vector3 = {
|
|
66
|
+
x: number;
|
|
67
|
+
y: number;
|
|
68
|
+
z: number;
|
|
69
|
+
};
|
|
70
|
+
type Quaternion = {
|
|
71
|
+
x: number;
|
|
72
|
+
y: number;
|
|
73
|
+
z: number;
|
|
74
|
+
w: number;
|
|
75
|
+
};
|
|
76
|
+
type PropertyValue = boolean | number | string | {
|
|
77
|
+
x: number;
|
|
78
|
+
y: number;
|
|
79
|
+
z?: number | undefined;
|
|
80
|
+
w?: number | undefined;
|
|
81
|
+
} | {
|
|
82
|
+
width: number;
|
|
83
|
+
height: number;
|
|
84
|
+
} | {
|
|
85
|
+
r: number;
|
|
86
|
+
g: number;
|
|
87
|
+
b: number;
|
|
88
|
+
a?: number | undefined;
|
|
24
89
|
};
|
|
25
90
|
export declare function runBridge(page: Page, request: BridgeRequest): Promise<unknown>;
|
|
91
|
+
export declare function captureNode(page: Page, uuid: string): Promise<unknown>;
|
|
92
|
+
export declare function clickNode(page: Page, uuid: string): Promise<unknown>;
|
|
93
|
+
export declare function inspectCocosPage(): unknown;
|
|
26
94
|
export declare function inspectCocos(request: BridgeRequest): unknown;
|
|
95
|
+
export {};
|