@vivix-labs/studio-chat-mcp 0.1.2 → 0.1.4

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/dist/shared.d.ts CHANGED
@@ -82,12 +82,19 @@ export interface OperationChat<O = unknown> {
82
82
  actions: Readonly<
83
83
  Record<string, string | OperationTarget | ChatActionBinding | ChatMessageBinding>
84
84
  >;
85
+ /** Installed server code resolves native actions from input or signed bindingContext.
86
+ * The adapter admits these exact same-scope targets through host.operations. */
87
+ dynamicActions?: (context: unknown) => Readonly<Record<string, ChatActionBinding>>;
85
88
  }
86
89
 
87
90
  export interface ChatCardProps {
88
91
  data: Record<string, unknown>;
89
92
  projectId: string;
90
93
  target: OperationTarget;
94
+ /** Download an original card media URL through the MCP Apps host, when supported. */
95
+ download?(media: { uri: string; name: string }): Promise<void>;
96
+ /** Read bytes of a local media path declared by this card, without a public URL. */
97
+ readMedia?(input: LocalMediaRead): Promise<LocalMediaChunk>;
91
98
  action(
92
99
  name: string,
93
100
  input?: Record<string, unknown>,
@@ -95,6 +102,25 @@ export interface ChatCardProps {
95
102
  ): Promise<ChatCardResult>;
96
103
  }
97
104
 
105
+ export interface LocalMediaSnapshot {
106
+ sizeBytes: number;
107
+ mtimeMs: number;
108
+ inode: number;
109
+ device: number;
110
+ }
111
+ export interface LocalMediaRead {
112
+ path: string;
113
+ offset: number;
114
+ expected?: LocalMediaSnapshot;
115
+ }
116
+ export interface LocalMediaChunk {
117
+ base64: string;
118
+ nextOffset: number;
119
+ totalBytes: number;
120
+ mimeType: string;
121
+ snapshot: LocalMediaSnapshot;
122
+ }
123
+
98
124
  /** The sandbox receives projection data and errors, never executable bundle metadata. */
99
125
  export interface ChatCardResult {
100
126
  text: string;
package/package.json CHANGED
@@ -1,10 +1,16 @@
1
1
  {
2
2
  "name": "@vivix-labs/studio-chat-mcp",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22.12.0"
7
7
  },
8
+ "scripts": {
9
+ "build": "tsx scripts/build-chat-mcp.ts build",
10
+ "package": "tsx scripts/build-chat-mcp.ts package",
11
+ "check": "tsc --noEmit",
12
+ "test": "tsx --test tests/*.test.ts chat-ui/*.test.ts"
13
+ },
8
14
  "devDependencies": {
9
15
  "@modelcontextprotocol/client": "2.4.0",
10
16
  "@modelcontextprotocol/core": "2.4.0",
@@ -40,11 +46,5 @@
40
46
  "access": "public",
41
47
  "registry": "https://registry.npmjs.org/",
42
48
  "tag": "beta"
43
- },
44
- "scripts": {
45
- "build": "tsx scripts/build-chat-mcp.ts build",
46
- "package": "tsx scripts/build-chat-mcp.ts package",
47
- "check": "tsc --noEmit",
48
- "test": "tsx --test tests/*.test.ts chat-ui/*.test.ts"
49
49
  }
50
- }
50
+ }
@@ -24,6 +24,13 @@ returned `scope`, `target`, schemas and examples. General conversation component
24
24
  default to user scope and do not require creating a business project. The MCP
25
25
  entry point reads the enabled provider's live catalog. Choose from that catalog.
26
26
 
27
+ For a reusable card button calling one native operation, explicitly search this
28
+ connection with `kind:"nativeOperation"` and describe the returned target with the
29
+ same kind. Read its input schema, effects and confirm. Configure target.mode=native
30
+ and inputBindings as described in the installed chat-components interaction guide.
31
+ The native operation needs no chat view or receiver envelope. Keep the original
32
+ scope and let the Host handle execution, approvals and request-key recovery.
33
+
27
34
  Prepare props from the user's actual topic, draft or candidates. Open the
28
35
  returned route with `run_studio_action`, using its actual scope and input.
29
36
  Scope each prompt action to the clicked operation and use the latest interaction
@@ -40,8 +47,14 @@ readable URL does not prove the native host permits it. Report a URL-safety
40
47
  rejection separately from expiry or decoding; do not proxy, rehost or disable
41
48
  checks to evade that rejection. A changed UI resource must be tested in a
42
49
  connection that actually loads the new resource version.
43
- Use existing valid URLs directly. A local file without a registered source is a
44
- reported preview gap; it does not authorize upload or generation.
50
+ Use existing valid URLs directly. For PNG/JPEG/WebP images, audio, or video
51
+ already available on the local MCP Host, supply its absolute `path` instead of
52
+ `src` when the component's schema supports it; use exactly one of the two.
53
+ Video `poster` strings still require HTTPS. The card reads `path + offset`
54
+ through the App-only `read_local_media` channel and loads the complete file
55
+ before display or playback. It needs no preview ID,
56
+ import or public URL. A remote MCP Host cannot read a path on the user's computer.
57
+ This whole-file preview does not provide progressive long-video playback.
45
58
 
46
59
  If discovery returns no ready matching capability, report that status and retain
47
60
  the draft. For an unmet general presentation need, follow the installed
package/README.md DELETED
@@ -1,95 +0,0 @@
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 adds their authenticated HTTP connection to the private Codex configuration. Restart the Codex chat to discover the new connection. Existing MCP entries and personal Skills are preserved.
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
- Read the installed adapter's connection with an empty input JSON file.
24
-
25
- ```sh
26
- printf '{}\n' > connection-input.json
27
- vivix-studio plugin call studio-chat connection --scope user --input connection-input.json --json
28
- ```
29
-
30
- The private result contains `url`, `headers.Authorization` and the adapter's `pid`. Configure the MCP client with that URL and header. For Codex, the corresponding configuration has this shape.
31
-
32
- ```toml
33
- [mcp_servers.vivix-studio-chat]
34
- url = "http://127.0.0.1:<host-port>/v1/user/http/studio-chat/mcp"
35
-
36
- [mcp_servers.vivix-studio-chat.http_headers]
37
- Authorization = "Bearer <route-credential>"
38
- ```
39
-
40
- Keep the credential in the client's private configuration. It authorizes this exact plugin route. The Host derives it from the profile's existing persistent browser key. The saved Host port and route credential survive Host restarts. CLI bearer credentials continue rotating at startup. Start the Host through the Studio CLI before reconnecting a stopped Host.
41
-
42
- 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/v4.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`.
43
-
44
- ## Discover and read through one connection
45
-
46
- `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.
47
-
48
- 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.
49
-
50
- `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?})`.
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, executable UI assets and prepared messages travel only in `_meta` for the App. 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
- ## Declare a chat operation
62
-
63
- A business plugin publishes `extensions: { chat: { component, projectResult, actions } }`
64
- on its operation and registers the component in the manifest's `components` field.
65
- The adapter routes `(action, input)` to the declared destination. Business plugins
66
- own object identity, validation, input mapping, and writes. See the
67
- [component contract](chat-ui/README.md) for Props and Host receipt recovery.
68
-
69
- Card projectors may return optional server-only `bindingContext` JSON. The adapter
70
- puts it inside the existing signed Host operation bindings, strips the top-level
71
- field from the public projection, and supplies the authenticated snapshot as
72
- `ChatActionContext.bindingContext` and `ChatProjectionContext.bindingContext`.
73
- Browser action input never supplies that context. Updated projections can replace
74
- it; unchanged legacy cards omit it and keep context-free bindings. The Host keeps
75
- its existing size limit, scope/caller authentication, generation validation and
76
- receipt-before-preparation replay. Context is signed for integrity, not encrypted;
77
- do not put secrets in it.
78
-
79
- ## Send a follow-up message
80
-
81
- A declared action can provide `prepareMessage(request, context)` instead of a
82
- target. The adapter authenticates the original source binding and passes its
83
- server-owned context to this callback. The callback returns `{intent, data}` with
84
- a nonempty intent and JSON object data. This read-only path invokes no business
85
- operation and creates no business receipt.
86
-
87
- The outer MCP App sends the prepared content through the current client's
88
- `sendMessage` API. The sandbox receives the result status, never the prepared
89
- message metadata. Client confirmation means the message was sent, while business
90
- changes require the subsequent conversation turn and persisted readback.
91
-
92
- Unsupported or rejected sends retain the draft. Unknown sends retain their
93
- original request identity and are not automatically resent. The component's
94
- prompt and target actions remain exclusive per button. No context-update API or
95
- widget-state write substitutes for message delivery.