@vivix-labs/studio-chat-mcp 0.1.15 → 0.1.17

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 ADDED
@@ -0,0 +1,122 @@
1
+ # Studio Chat MCP adapter
2
+
3
+ Studio loads this user-scoped server plugin into its Host process. The plugin owns MCP tools, chat declarations, card action routing, projection and the bundled MCP Apps page. Codex connects to the plugin's authenticated Streamable HTTP route.
4
+
5
+ ## Install and enable
6
+
7
+ The public Studio suite installer installs this Host plugin and its card provider, enables them in user scope, and registers the CLI `stdio` bridge (`vivix-studio agent mcp`) in the agent configuration. Existing server entries and personal Skills are preserved. CLI and Workbench operations are available immediately after installation. The current agent host decides when it exposes MCP tools and interactive cards. Use the unified `vivix-studio` Skill's `chat-interactions.md` for session handling and card routing.
8
+
9
+ Use the paired Studio CLI with SDK API 0.2.6, Node.js 22.12+ and pnpm 10.33.0. Build a standard Studio plugin directory from this repository.
10
+
11
+ ```sh
12
+ pnpm --filter @vivix-labs/studio-chat-mcp package "$PWD/artifacts/studio-chat-host"
13
+ vivix-studio plugin install "$PWD/artifacts/studio-chat-host/studio-chat-mcp"
14
+ vivix-studio plugin enable @vivix-labs/studio-chat-mcp --scope user --instance studio-chat --trust --allow-access host.operations
15
+ ```
16
+
17
+ Open a project and enable its business plugins normally. Discover their ready operations with `vivix-studio plugin describe`. Use ordinary `plugin call <adapter-instance> run --scope user --input <file> --json` or the MCP tools to open a card. The adapter also registers an `action` operation for subsequent clicks.
18
+
19
+ The package exports its chat protocol types from `@vivix-labs/studio-chat-mcp/shared`. Chat components import these types from the adapter package. The CLI SDK does not export chat types.
20
+
21
+ ## Connect an MCP client
22
+
23
+ For any MCP client that speaks `stdio` (Codex, Claude Code, Cursor, Antigravity, etc.), configure the CLI's built-in bridge command:
24
+
25
+ ```toml
26
+ [mcp_servers.vivix-studio-chat]
27
+ command = "vivix-studio"
28
+ args = ["agent", "mcp"]
29
+ ```
30
+
31
+ The bridge automatically starts the shared local Host if it is stopped, discovers the active `studio-chat` route credential, and forwards JSON-RPC messages to the Host over loopback HTTP — surviving Host restarts, port changes, and reboots without updating client configuration.
32
+
33
+ To inspect the underlying Host endpoint directly (e.g., for testing):
34
+
35
+ ```sh
36
+ printf '{}\n' > connection-input.json
37
+ vivix-studio plugin call studio-chat connection --scope user --input connection-input.json --json
38
+ ```
39
+
40
+ The plugin requires Studio plugin API 0.2.6. It exposes discovery and media reads on the same connection as `run_studio_action`, the app-only `studio_card_action`, and `ui://studio/chat/v13.html`. Its connection PID equals the Studio Host PID. Disabling the plugin removes the route through the normal plugin lifecycle. The current bundled MCP dependency requires an explicit Host restart for code upgrades when the generic reloader reports `restart_required`.
41
+
42
+ ## Discover and read through one connection
43
+
44
+ `list_chat_capabilities({})` defaults to `{kind:"user",id:"user"}` and returns ready reusable components, declared chat operations and read-only media queries with their actual `scope` and `target`. Component entries come from the enabled provider's existing `components.list`; the adapter does not keep a second component registry. Generic interactions need a user-scoped component provider and do not create a business project.
45
+
46
+ Pass the returned route to `describe_chat_capability({scope,target,componentId?})`. A component description contains its props, result, selected render input and examples, with local schema references intact. For saved project operations, use the selected project's explicit scope. The Host still enforces grants, readiness, bindings and receipts. Legacy `projectId` input remains supported; supplying both it and `scope` is rejected.
47
+
48
+ `query_studio_media({scope,target,input})` invokes only a discovered media query with read effects and no confirmation. Read its input schema first. Returned records, task output refs and file selections provide the immutable `ref: {storeId,objectId,versionId}` for `resolve_chat_media({scope,ref,fileId?})`.
49
+
50
+ `run_studio_action`, `studio_card_action` and `query_studio_media` treat `input` as a JSON object. A JSON-encoded object string from an MCP client is parsed once and normalized; arrays, scalars, `null` and strings that do not encode an object are rejected before any Host operation runs. Every discovered operation currently declares an object input schema, so this is the adapter contract rather than a per-operation setting.
51
+
52
+ The resolver delegates `{ref,fileId?,access:"https"}` to the existing backend file-access operation. The file service checks the selected bytes, follows a matching saved origin, reuses a usable stored HTTPS URL, or asks the original API provider for a fresh read ticket by its persisted remote ID and original task identity. Ordinary local reads keep their existing behavior. An unmatched local file is an explicit error; resolving never uploads, generates or substitutes another version. The MCP response contains the fixed ref, file ID, MIME type, HTTPS URL and optional expiry, without the Host path.
53
+
54
+ Tool `content` is a short readable receipt. `structuredContent` contains model-readable creative data and routing. Signed action bindings, the script digest and prepared messages travel in `_meta` for the App. The page reads the current registered renderer for the original versioned component ID through a read-only MCP resource, then verifies the response's component ID and script digest before mounting. Historical props use the current compatible appearance. The saved digest remains available for legacy clients. The page also accepts legacy replies whose public data contains bindings. A tool return proves neither that a client displayed the card nor that a click delivered a continuation; those require separate UI evidence.
55
+
56
+ The adapter's `resourceDomains` configuration declares canonical HTTPS origins for media and other resources. Its default is the Official media CDN, `https://static.vivi-x.ai`. Declare any additional verified source origins explicitly in this adapter's configuration. Discovery returns the active `resourceDomains`; a readable URL alone does not establish that a native host permits the iframe to load it. The component's own `mediaOrigins` further restricts each card. Do not use URL proxies, rehosting or disabled checks to evade a host URL-safety rejection.
57
+
58
+ - [Installation-to-card acceptance](acceptance/README.md)
59
+ - [Card page and sandbox](chat-ui/README.md)
60
+
61
+ ## Discover native action targets
62
+
63
+ Search `list_chat_capabilities({scope,kind:"nativeOperation",query,offset,limit})`.
64
+ The default limit is 20, the maximum is 100, and nextOffset identifies the next page.
65
+ Describe the returned target with kind=nativeOperation to read input/output schemas,
66
+ effects, confirm and contract. This includes operations without a chat declaration.
67
+ Discovery reads metadata without invoking business operations; default component
68
+ discovery does not expand into the whole native catalog.
69
+
70
+ An installed source may provide `dynamicActions(context)`. It resolves native
71
+ bindings from initial input or authenticated binding context. The adapter admits
72
+ those exact same-scope targets through host.operations, signs them with the source
73
+ and retains invokeBound recovery. The resolver is installed server code; browser
74
+ input never supplies a destination or callback. Static dependency rules are unchanged.
75
+
76
+ ## Declare a chat operation
77
+
78
+ The App-only `read_local_media` tool reads a supplied absolute image, audio or video `path`
79
+ and byte `offset` directly on the local Host. Each response contains at most
80
+ 256 KiB in `_meta["studio/media"]`; binary data does not enter public tool output.
81
+ Local images support PNG, JPEG and WebP through the same chunk and Blob transport.
82
+ The component receives an optional `readMedia` callback through the sandbox bridge,
83
+ which accepts only paths declared by the original card projection. Later reads
84
+ carry the initial file identity/size/mtime and reject changes. No preview registry,
85
+ public media endpoint, import or CLI SDK change is involved. Existing HTTPS media
86
+ and action dispatch keep their current routes. Use a matching component package
87
+ and adapter; local paths require the Host to share the caller's filesystem.
88
+
89
+ A business plugin publishes `extensions: { chat: { component, projectResult, actions } }`
90
+ on its operation and registers the component in the manifest's `components` field.
91
+ The adapter routes `(action, input)` to the declared destination. Business plugins
92
+ own object identity, validation, input mapping, and writes. See the
93
+ [component contract](chat-ui/README.md) for Props and Host receipt recovery.
94
+
95
+ Card projectors may return optional server-only `bindingContext` JSON. The adapter
96
+ puts it inside the existing signed Host operation bindings, strips the top-level
97
+ field from the public projection, and supplies the authenticated snapshot as
98
+ `ChatActionContext.bindingContext` and `ChatProjectionContext.bindingContext`.
99
+ Browser action input never supplies that context. Updated projections can replace
100
+ it; unchanged legacy cards omit it and keep context-free bindings. The Host keeps
101
+ its existing size limit, scope/caller authentication, generation validation and
102
+ receipt-before-preparation replay. Context is signed for integrity, not encrypted;
103
+ do not put secrets in it.
104
+
105
+ ## Send a follow-up message
106
+
107
+ A declared action can provide `prepareMessage(request, context)` instead of a
108
+ target. The adapter authenticates the original source binding and passes its
109
+ server-owned context to this callback. The callback returns `{intent, data}` with
110
+ a nonempty intent and JSON object data. This read-only path invokes no business
111
+ operation and creates no business receipt.
112
+
113
+ When the client advertises structured model context, the outer MCP App uses
114
+ `updateModelContext` for the exact interaction data, then sends the readable
115
+ request. Clients with messaging but without structured context receive the
116
+ request followed by the complete interaction JSON in the same message.
117
+ The sandbox receives the result status without prepared message metadata.
118
+
119
+ Unsupported or rejected sends retain the draft. Unknown sends retain their
120
+ original request identity and are not automatically resent. The component's
121
+ prompt and target actions remain exclusive per button. If a client advertises
122
+ structured context but the update fails, the page retains the draft.