@3dverse/livelink-mcp 0.0.0-stage → 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/README.md +62 -3
- package/dist/main.mjs +43688 -0
- package/dist/main.mjs.map +7 -0
- package/package.json +39 -6
package/README.md
CHANGED
|
@@ -1,3 +1,62 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# @3dverse/livelink-mcp
|
|
2
|
+
|
|
3
|
+
An [MCP](https://modelcontextprotocol.io) server letting an AI agent join 3dverse rendering sessions and read and edit their scenes live, through [`@3dverse/livelink-agent`](../livelink.clients/livelink.agent/README.md). It runs locally, launched by the MCP client over stdio, and acts with the token it is given.
|
|
4
|
+
|
|
5
|
+
The agent sees the scene as data (the entity tree and the components' values), and as images through a camera of its own.
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
The server is a single file, `dist/main.mjs`, that runs on Node 22 or later with nothing else installed: its dependencies are bundled in. Declare it to the MCP client through npm, e.g. for Claude Code in `.mcp.json`:
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"mcpServers": {
|
|
14
|
+
"livelink": {
|
|
15
|
+
"command": "npx",
|
|
16
|
+
"args": ["-y", "@3dverse/livelink-mcp"],
|
|
17
|
+
"env": { "LIVELINK_TOKEN": "<an API key or a user token>" }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Or copy the file anywhere and run it with Node: `"command": "node", "args": ["<path to>/main.mjs"]`. To build it from the repository root: `npm run build:mcp`.
|
|
24
|
+
|
|
25
|
+
It loads the 3dverse core's runtime from the 3dverse CDN when it starts, so it needs network access to 3dverse.
|
|
26
|
+
|
|
27
|
+
| Variable | Default | |
|
|
28
|
+
| ------------------------------ | -------------------------------- | ------------------------------------------------------------ |
|
|
29
|
+
| `LIVELINK_TOKEN` | required | The token the server acts with. |
|
|
30
|
+
| `LIVELINK_API_URL` | `https://api.3dverse.com/app/v1` | The 3dverse API, to target another environment. |
|
|
31
|
+
| `LIVELINK_MCP_TIMEOUT_MS` | `30000` | The deadline of each call into a session. |
|
|
32
|
+
| `LIVELINK_MCP_JOIN_TIMEOUT_MS` | `60000` | The deadline of joining or starting a session. |
|
|
33
|
+
| `LIVELINK_MCP_DEBUG` | unset | `1` logs every message the core receives, on standard error. |
|
|
34
|
+
|
|
35
|
+
## Tools
|
|
36
|
+
|
|
37
|
+
| Tool | |
|
|
38
|
+
| ------------------------------------------------ | ---------------------------------------------------------------------------------------- |
|
|
39
|
+
| `list_sessions` | The running sessions of a scene. |
|
|
40
|
+
| `join_session`, `start_session`, `leave_session` | Join a running session, start one (transient by default), leave one. |
|
|
41
|
+
| `capture_image` | A JPEG image of what the client's camera sees. |
|
|
42
|
+
| `get_scene` | The entity tree, from the roots or under an entity, to a depth and a number of entities. |
|
|
43
|
+
| `find_entities` | Entities by name, or by the components they have and have not. |
|
|
44
|
+
| `get_entity` | An entity's name, parent, visibility and components' values. |
|
|
45
|
+
| `update_entity` | Set, reset or remove components, show or hide. |
|
|
46
|
+
| `create_entity`, `delete_entities` | Create an entity under a parent or at the root; delete entities. |
|
|
47
|
+
| `fire_event` | Fire a script event. |
|
|
48
|
+
| `get_scene_settings` | The scene's settings. |
|
|
49
|
+
|
|
50
|
+
The `livelink://component-types` resource gives every component's fields and types, from the installed `@3dverse/livelink.core`.
|
|
51
|
+
|
|
52
|
+
Joining or starting a session sets up the client's frame before answering: the images' size (`width` and `height`, 1280x720 by default) and a camera entity of its own, whose id the join answers. The camera renders with the default render graph through a perspective lens, from the scene's default camera transform, unless the join gives it other components (`camera`). The agent moves it with `update_entity`, like any entity, and `capture_image` renders what it sees. The camera is transient, and deleted when the client leaves.
|
|
53
|
+
|
|
54
|
+
Updates and deletions of existing entities are saved to the scene when the session is not transient and the token has write access to the scene. They are saved by the update loop's broadcast, once per second: leaving a session waits for it. Entities created through Livelink are transient: they are never saved to the scene.
|
|
55
|
+
|
|
56
|
+
## Behaviour around the core
|
|
57
|
+
|
|
58
|
+
- **Deadlines.** The core never rejects a connection that fails nor a request left open by a disconnection: every call into a session runs against a deadline. A join that connects after its deadline is disconnected.
|
|
59
|
+
- **The client renders on request.** It joins as a rendering client configured with the JPEG codec, so the renderer only renders the frames captured. A client whose frame cannot be set up is disconnected, and the join fails.
|
|
60
|
+
- **Captures run one at a time per session**, after the scene's assets finish loading or the deadline passes; the image says which. The changes made before a capture reach the renderer before its frame is requested, so a moved camera shows in it; a change that loads assets may only show in a later capture.
|
|
61
|
+
- **Creations and deletions run one at a time per session.** The core answers creations in order, so one that never gets its answer would hand every later creation its predecessor's entity: a creation or deletion missing its deadline leaves the session, to be joined again.
|
|
62
|
+
- **Standard output** carries the protocol, so every console output goes to standard error, and an unhandled rejection is logged rather than ending the process.
|