artifacty 0.11.1 → 0.12.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.
@@ -1,10 +1,10 @@
1
1
  # MCP Public API
2
2
 
3
- Artifacty's MCP server is the primary agent-to-agent integration surface. It
4
- supports local stdio MCP by default, a token-protected HTTP `/mcp` endpoint when
5
- enabled on the browser server, and stdio bridge mode for clients that need local
6
- stdio config but should write to a central Artifacty server. The server
7
- currently targets MCP protocol `2025-06-18`.
3
+ Artifacty's MCP server is the primary interface for agent-to-agent integration.
4
+ It uses local stdio MCP by default. The browser server can also expose a
5
+ token-protected HTTP `/mcp` endpoint. Stdio bridge mode lets a client use local
6
+ stdio configuration to write to a central Artifacty server. The server targets
7
+ MCP protocol `2025-06-18`.
8
8
 
9
9
  ## Capabilities
10
10
 
@@ -16,23 +16,40 @@ currently targets MCP protocol `2025-06-18`.
16
16
 
17
17
  ## Visibility and Access Control
18
18
 
19
- Once any user account exists on the server, every tool call and resource read
20
- is scoped by artifact `visibility` and `ownerUserId`: over the streamable-HTTP
21
- transport, a personal API token or session scopes access to that user; the
22
- shared `ARTIFACTY_API_TOKEN` (or any connection before the first user is
23
- created) has no personal identity and is treated as an anonymous team
24
- principal that can read/write `team` artifacts but never sees `private` ones.
25
- The local stdio transport is a fully trusted process: it is scoped to a
26
- personal user only when the local `ARTIFACTY_API_TOKEN` resolves to a
27
- personal API token, and is otherwise anonymous once the store has users. A
28
- `private` artifact a caller cannot see 404s (`ARTIFACT_NOT_FOUND`) from
29
- `artifacty_get`, resource reads, and list results, to avoid leaking its
30
- existence; write and manage operations (`artifacty_update`,
31
- `artifacty_archive`/`artifacty_restore`, `artifacty_set_visibility`) on an
32
- artifact the caller can see but does not own return
33
- `structuredContent.code === "forbidden"`. In single-user mode (no user
34
- accounts) none of this applies. See the README Security Model section for
35
- the full rule table.
19
+ Administrators can select a site-wide `public` or `private` access mode
20
+ at `/admin/access`. Public mode preserves the visibility rules below. Private
21
+ mode requires a personal identity: artifact reads are limited to the owner,
22
+ administrators, and explicitly shared users or team members; shared recipients
23
+ have read, comment, or edit grants. Artifacty applies the strongest permission
24
+ from the user's direct and team grants.
25
+ Comment grants permit feedback and resolution of the caller's own comments;
26
+ edit grants also permit new versions. Sharing, archive/restore, and review-status
27
+ management stay owner/admin-only. Token scopes are an additional restriction:
28
+ a read-scoped token cannot mutate even when its user has an edit grant.
29
+ In private mode, a shared server token or an anonymous stdio connection cannot
30
+ read or create artifacts. Use a personal API token for
31
+ agent access. Revoking shares or team membership affects subsequent resource
32
+ reads, searches, and live notifications. The HTTP transport also obeys the
33
+ administrator's IP/CIDR allowlist, using the TCP peer address, not forwarding
34
+ headers; local stdio has no HTTP source address.
35
+
36
+ In public mode, artifact `visibility` and `ownerUserId` control access after the
37
+ server has a user account. A personal API token identifies the user. The shared
38
+ `ARTIFACTY_API_TOKEN` has no personal identity. Artifacty treats it as an
39
+ anonymous team principal: it can read and write `team` artifacts, but cannot
40
+ read `private` artifacts.
41
+
42
+ Local stdio uses a personal identity only when `ARTIFACTY_API_TOKEN` resolves to
43
+ a personal token in the local store. Otherwise, it is anonymous after the store
44
+ has users. Before the store has users, public mode does not apply these user
45
+ access checks.
46
+
47
+ If a caller cannot read an artifact, `artifacty_get` and resource reads return
48
+ `ARTIFACT_NOT_FOUND`. List results omit the artifact. These rules prevent
49
+ disclosure of its existence. If a caller can read the artifact but lacks the
50
+ required write or management permission, the tool result contains
51
+ `structuredContent.code === "forbidden"`. See the README Security Model section
52
+ for the full rule table.
36
53
 
37
54
  ## Tools
38
55
 
@@ -56,17 +73,17 @@ Stable tool names:
56
73
  - `artifacty_info`: return store, browser URL, transport, and protocol information, plus `embeddings: { provider, model } | null` reporting whether a semantic-search embedding provider is configured.
57
74
  - `artifacty_wait`: `{ artifactId?, tag?, type?, timeoutMs }` blocks up to `timeoutMs` (default 30000, max 120000) for the first change event matching the filter, and returns it as `structuredContent.event`, or `{ timedOut: true }` if none arrived in time. Works over any transport, including the stateless HTTP transport where `resources/subscribe` cannot push notifications (see Resources below) — it is a long-poll primitive for clients that cannot receive pushed notifications.
58
75
 
59
- Tool schemas use Artifacty schema v1 formats and artifact types. New optional
60
- properties may be added during 0.x releases; existing names should not be
61
- renamed without a documented migration.
76
+ Tool schemas use Artifacty schema v1 formats and artifact types. During 0.x releases, maintainers may add optional
77
+ properties. They should not rename existing properties without a documented
78
+ migration.
62
79
 
63
- Storage-layer validation and not-found errors (relation and comment errors
64
- included) carry a machine-readable `code`. `tools/call` surfaces those as an
65
- `isError: true` tool result with `structuredContent.code` set (for example
66
- `INVALID_RELATION`, `SELF_RELATION`, `ARTIFACT_NOT_FOUND`,
67
- `RELATION_NOT_FOUND`, `COMMENT_NOT_FOUND`, `THREAD_TOO_DEEP`,
68
- `COMMENT_TOO_LARGE`, `INVALID_REVIEW_STATUS`) instead of a JSON-RPC protocol
69
- error, so clients can branch on the code without inspecting error text.
80
+ Storage validation errors and not-found errors carry a machine-readable `code`.
81
+ This includes relation and comment errors. `tools/call` returns an
82
+ `isError: true` tool result with `structuredContent.code`, rather than a
83
+ JSON-RPC protocol error. Example codes include `INVALID_RELATION`,
84
+ `SELF_RELATION`, `ARTIFACT_NOT_FOUND`, `RELATION_NOT_FOUND`,
85
+ `COMMENT_NOT_FOUND`, `THREAD_TOO_DEEP`, `COMMENT_TOO_LARGE`, and
86
+ `INVALID_REVIEW_STATUS`. Clients can use the code without parsing error text.
70
87
 
71
88
  ## Resources
72
89
 
@@ -91,16 +108,16 @@ matching change event sends `notifications/resources/updated` with the same
91
108
  `{ uri }`. `resources/unsubscribe` accepts the same `{ uri }` shape and stops
92
109
  delivery.
93
110
 
94
- Subscriptions only deliver over the **stdio transport**, where one MCP
95
- context lives for the whole process and notifications are written directly
96
- to stdout. The streamable-HTTP `/mcp` transport (and the stdio bridge that
97
- proxies to it, `ARTIFACTY_MCP_MODE=bridge`) builds a fresh, stateless
98
- JSON-RPC context per POST request/response cycle — there is no open
99
- connection left to push a notification over once the response is sent, so
100
- `resources/subscribe` there is accepted (as the protocol requires) but never
101
- delivers anything. Clients on that transport should poll with `artifacty_list`
102
- or, better, use the `artifacty_wait` tool, which works as a bounded long-poll
103
- within a single request regardless of transport.
111
+ Subscriptions deliver notifications only over the **stdio transport**. One MCP
112
+ context lasts for the whole process and writes notifications to stdout.
113
+
114
+ The streamable-HTTP `/mcp` transport creates a stateless JSON-RPC context for
115
+ each POST request. The stdio bridge (`ARTIFACTY_MCP_MODE=bridge`) uses the same
116
+ HTTP transport. After the server sends a response, no connection remains for
117
+ push notifications. These transports accept `resources/subscribe`, as the
118
+ protocol requires, but do not deliver notifications. Clients should use
119
+ `artifacty_wait` for a bounded long-poll within one request. Alternatively,
120
+ clients can poll with `artifacty_list`.
104
121
 
105
122
  ## Prompts
106
123
 
@@ -112,23 +129,24 @@ Prompt names:
112
129
  - `artifacty_visual_qa`
113
130
  - `artifacty_release_notes`
114
131
 
115
- Each prompt returns one user message that instructs an agent to create or update
116
- an Artifacty artifact with discoverable `artifactType`, `sourceAgent`, and tags.
132
+ Each prompt returns one user message. The message instructs an agent to create
133
+ or update an artifact with searchable `artifactType`, `sourceAgent`, and tags.
117
134
  Prompts accept optional context arguments such as `artifactId`, `goal`, `scope`,
118
135
  `target`, or `version`. `artifacty_handoff` and `artifacty_review` additionally
119
136
  instruct the agent to pass `relations` on the create/update call so the graph
120
137
  stays populated automatically: `artifacty_handoff` recommends
121
138
  `relations: [{ toId: <source artifact ID>, relation: "derived-from" }]`, and
122
139
  `artifacty_review` recommends `relations: [{ toId: <reviewed artifact ID>, relation: "reviews" }]`.
123
- `artifacty_review` also prefers `artifacty_comment` (with `artifacty_set_review_status`
124
- to record the verdict) over publishing a separate review artifact when the
125
- review is short — a handful of findings — reserving a full review artifact
126
- for longer or multi-file reviews.
140
+ For a short review with a few findings, `artifacty_review` recommends
141
+ `artifacty_comment`. It recommends `artifacty_set_review_status` to record the
142
+ verdict. Longer reviews and reviews of multiple files use a separate review
143
+ artifact.
127
144
 
128
145
  ## OpenAPI
129
146
 
130
- Every `/api/*` HTTP route (artifacts, versions, import, audit, admin backup)
131
- plus the `/mcp` JSON-RPC endpoint is described by an OpenAPI 3.1 document:
147
+ An OpenAPI 3.1 document describes every `/api/*` HTTP route and the `/mcp`
148
+ JSON-RPC endpoint. The HTTP routes include artifacts, versions, import, audit,
149
+ and admin backup:
132
150
 
133
151
  - `GET /openapi.json`: the machine-readable document. No authentication
134
152
  required; served with `cache-control: no-store` so it always reflects the
@@ -138,11 +156,11 @@ plus the `/mcp` JSON-RPC endpoint is described by an OpenAPI 3.1 document:
138
156
  - `artifacty_info` (MCP tool) and `artifacty doctor` both report the
139
157
  document's URL as `<serverUrl>/openapi.json`.
140
158
 
141
- The document reuses the same JSON Schemas as the MCP tool `outputSchema`
142
- definitions (see `src/lib/schemas.js`), so an artifact summary, a full
143
- artifact-with-content record, a version, an audit event, a relation entry,
144
- and the standard `{ error, code?, details? }` error shape mean the same thing
145
- whether you're calling the HTTP API or an MCP tool. `test/openapi.test.js`
159
+ The document uses the JSON Schemas from the MCP tool `outputSchema`
160
+ definitions (see `src/lib/schemas.js`). The HTTP API and MCP tools therefore
161
+ use the same artifact summaries, full artifact records, versions, audit events,
162
+ and relation entries. They also use the same `{ error, code?, details? }`
163
+ error shape. `test/openapi.test.js`
146
164
  keeps the document's route table in sync with `src/server.js`'s dispatch.
147
165
 
148
166
  ## Compatibility Notes
@@ -163,8 +181,8 @@ keeps the document's route table in sync with `src/server.js`'s dispatch.
163
181
  - On central servers, use a personal token from `/account` so created artifacts
164
182
  include the token owner's email as `publisherId` and audit logs record the
165
183
  same identity as `actor`.
166
- - Remote MCP currently uses bearer/header token auth. OAuth and per-user scoped
167
- tokens are future hardening work.
184
+ - Remote MCP uses bearer or header token authentication. Personal tokens support
185
+ `read`, `write`, and `admin` scopes. OAuth is not supported.
168
186
  - Binary media resources return stored base64 text through MCP; browser `/raw`
169
187
  decodes first-class `image` and `video` artifacts into bytes.
170
188
  - Clients may display resources and prompts differently. Tools remain the most
@@ -1,6 +1,6 @@
1
1
  # Network Sharing
2
2
 
3
- Artifacty is local-first. The default server binds to `127.0.0.1` and is intended for a single machine. Binding to a non-local address is supported for short, intentional sharing sessions, but it increases the exposed surface area.
3
+ Artifacty stores artifacts locally. By default, the server binds to `127.0.0.1` for use on one machine. You can bind to a non-local address for a short sharing session. This exposes the server to other machines.
4
4
 
5
5
  ## Recommended Defaults
6
6
 
@@ -10,7 +10,7 @@ Use the local server for normal work:
10
10
  artifacty serve
11
11
  ```
12
12
 
13
- If another device on a trusted LAN or private VPN needs read access, prefer binding to a specific interface address instead of every interface:
13
+ If another device on a trusted LAN or private VPN needs read access, bind to a specific interface address. Avoid listening on every interface:
14
14
 
15
15
  ```bash
16
16
  artifacty serve --host 192.168.1.20 --share-mode lan --generate-token
@@ -34,23 +34,23 @@ artifacty serve --host 0.0.0.0 --share-mode lan --generate-token
34
34
 
35
35
  ## Required Safeguards
36
36
 
37
- Non-local hosts require both `ARTIFACTY_SHARE_MODE=lan|team` and an API token. This prevents accidentally exposing an unauthenticated Artifacty server.
37
+ Before binding to a non-local address, set both `ARTIFACTY_SHARE_MODE=lan|team` and an API token. Artifacty rejects startup without these settings.
38
38
 
39
- The generated token protects HTTP API routes and browser write forms. Prefer the `x-artifacty-token` or `Authorization: Bearer <token>` header for scripts. URLs with `?token=...` are convenient for local foreground sessions, but can be stored in browser history, shell history, reverse-proxy logs, or referrers.
39
+ The generated token protects HTTP API routes and browser write forms. For scripts, use the `x-artifacty-token` or `Authorization: Bearer <token>` header. Local foreground sessions can use `?token=...` URLs. These URLs can expose tokens in browser history, shell history, reverse-proxy logs, or referrers.
40
40
 
41
41
  Artifacty does not terminate TLS. Do not expose it directly on the public internet. If a shared instance must cross an untrusted network, put it behind a TLS reverse proxy or a private VPN.
42
42
 
43
- When Artifacty binds outside loopback, startup output includes a warning that the server is reachable beyond the local machine and that TLS is not provided by Artifacty. Background `serve` returns this warning in JSON; foreground `serve` and `src/server.js` also write it to stderr.
43
+ If Artifacty binds outside loopback, startup output warns that other machines can reach the server. The warning also states that Artifacty does not provide TLS. Background `serve` returns the warning in JSON. Foreground `serve` and `src/server.js` also write it to stderr.
44
44
 
45
45
  ## Browser Write Behavior
46
46
 
47
- Remote browsers can read shared pages and can submit browser forms when the request is same-origin with the Artifacty host, for example `Origin: http://10.0.0.50:8787` with `Host: 10.0.0.50:8787`. Mutating browser routes reject cross-origin requests to reduce CSRF risk. For scripts and agents, prefer API or MCP writes with an explicit token header.
47
+ Remote browsers can read pages allowed by the current access mode and artifact permissions. To submit a browser form, the request origin must match the Artifacty host. For example, `Origin: http://10.0.0.50:8787` matches `Host: 10.0.0.50:8787`. Routes that change data reject cross-origin browser requests to reduce CSRF risk. For scripts and agents, use API or MCP writes with an explicit token header.
48
48
 
49
- Do not disable the origin check just to make remote browser writes easier. Same-origin central dashboard writes should pass; writes initiated from another website should fail with `NON_LOCAL_ORIGIN`.
49
+ Keep the origin check enabled. A write from the central dashboard should pass when its origin matches the server. A write from another website should fail with `NON_LOCAL_ORIGIN`.
50
50
 
51
51
  ## Renderer Guidance
52
52
 
53
- Artifact content is untrusted. HTML, SVG, Mermaid, and React artifacts are rendered with sandboxing and CSP controls, but shared viewing still means content reaches another user's browser. Keep `ARTIFACTY_ENABLE_REACT_RENDERER` disabled for LAN sessions unless every viewer trusts the artifact source.
53
+ Treat artifact content as untrusted. Artifacty uses sandboxing and CSP controls to render HTML, SVG, Mermaid, and React. Shared content still reaches each viewer's browser. Keep `ARTIFACTY_ENABLE_REACT_RENDERER` disabled for LAN sessions unless every viewer trusts the artifact source.
54
54
 
55
55
  See [threat-model.md](threat-model.md) for the full trust-boundary summary.
56
56
 
@@ -8,7 +8,14 @@ Use this checklist before publishing or distributing Artifacty.
8
8
  npm run release:check
9
9
  ```
10
10
 
11
- This runs syntax checks, the full Node test suite, and a local smoke test that starts the HTTP server with token auth enabled, creates an artifact, verifies secret blocking, reads audit logs, writes a backup, and checks MCP tool/resource/prompt discovery.
11
+ This command runs syntax checks, the full Node test suite, and a local smoke test. The smoke test checks these operations:
12
+
13
+ - Start the HTTP server with token authentication.
14
+ - Create an artifact.
15
+ - Block detected secrets.
16
+ - Read audit logs.
17
+ - Write a backup.
18
+ - Discover MCP tools, resources, and prompts.
12
19
 
13
20
  Run the local diagnostics pass:
14
21
 
@@ -19,10 +26,10 @@ artifacty doctor
19
26
  ## Packaging
20
27
 
21
28
  - Confirm `package.json` `version` and `files` are intentional.
22
- - Run `npm pack --dry-run` and inspect the included paths.
23
- - Review package size after renderer dependencies. Mermaid is a default dependency;
24
- React, ReactDOM, and Babel standalone are optional dependencies used only by the
25
- gated React renderer.
29
+ - Run `npm pack --dry-run`.
30
+ - Inspect the paths in the package output.
31
+ - Review the package size with renderer dependencies included. Mermaid is a default dependency.
32
+ React, ReactDOM, and Babel standalone are optional dependencies for the gated React renderer.
26
33
  - Verify the global commands resolve after install: `artifacty`, `artifacty-mcp`.
27
34
 
28
35
  ## Security
@@ -30,10 +37,11 @@ artifacty doctor
30
37
  - Keep the default HTTP bind address at `127.0.0.1`.
31
38
  - Require `ARTIFACTY_API_TOKEN` and `ARTIFACTY_SHARE_MODE=lan` or `team` before binding to `0.0.0.0`.
32
39
  - Confirm non-loopback startup output includes the LAN/team warning.
33
- - Confirm `artifacty serve` starts a managed background server and returns prompt-friendly JSON; use `artifacty serve --foreground` for attached log checks.
40
+ - Confirm `artifacty serve` starts a managed background server and returns JSON.
41
+ - Use `artifacty serve --foreground` to check attached logs.
34
42
  - Confirm `artifacty service plist|unit|task --dry-run` renders macOS, Linux, and Windows service definitions.
35
43
  - Prefer `x-artifacty-token` or `Authorization: Bearer <token>` over query tokens in scripts.
36
- - Review secret-scan bypasses. `--allow-secrets` and `ARTIFACTY_ALLOW_SECRETS=true` should be deliberate and temporary.
44
+ - Review each secret-scan bypass. Use `--allow-secrets` and `ARTIFACTY_ALLOW_SECRETS=true` only for deliberate, temporary exceptions.
37
45
  - Review [../SECURITY.md](../SECURITY.md) and [threat-model.md](threat-model.md) when changing auth, rendering, MCP, or network-sharing behavior.
38
46
  - Treat artifact HTML and imported agent payloads as untrusted content.
39
47
  - Confirm scripted artifact iframes never include `allow-same-origin`.
@@ -41,17 +49,20 @@ artifacty doctor
41
49
  `Access-Control-Allow-Origin: null` only for `Origin: null` requests, so
42
50
  opaque-origin sandbox iframes can import local ESM without weakening sandbox
43
51
  flags or using a wildcard CORS policy.
44
- - Confirm SVG viewer output strips `<script>`, `on*` attributes, and `javascript:` links while `/raw` preserves original source.
45
- - Browser-smoke each renderer that executes client code. Route status alone does
46
- not prove Mermaid or React rendered inside the iframe.
52
+ - Confirm SVG viewer output removes `<script>`, `on*` attributes, and `javascript:` links.
53
+ - Confirm `/raw` preserves the original source.
54
+ - Test each renderer that executes client code in a browser. Confirm the rendered output.
55
+ A successful route response does not prove that Mermaid or React rendered inside the iframe.
47
56
  - Keep `ARTIFACTY_ENABLE_REACT_RENDERER` disabled by default. Enable it only when the operator accepts arbitrary component execution risk.
48
- - Confirm parent app CSP does not include `unsafe-eval`; it should appear only on the React frame response CSP.
57
+ - Confirm the parent app CSP excludes `unsafe-eval`.
58
+ - Confirm only the React frame response CSP permits `unsafe-eval`.
49
59
  - Confirm CodeQL, Scorecard, and Dependabot configuration changes are intentional.
50
60
  - Confirm npm publish still uses OIDC Trusted Publishing rather than a long-lived npm token.
51
61
 
52
62
  ## Operations
53
63
 
54
- - Export a backup before upgrades: `artifacty backup` (artifacts only) or `artifacty backup --full` (also users, tokens, audit log, relations, webhooks) before a server move or major upgrade.
64
+ - Before an upgrade or server move, export a backup. Use `artifacty backup` for artifacts only. Use `artifacty backup --full` to also include users, tokens, audit logs, relations, and webhooks.
55
65
  - Confirm `artifacty audit --limit 20` shows recent create/update/read/archive events.
56
66
  - Confirm `artifacty doctor` reports no failures. A stopped server warning is acceptable when intentionally checking an offline store.
57
- - For background service installs, dry-run first: `artifacty service install --dry-run`. Use `--platform macos|linux|windows` to review another OS definition.
67
+ - Before installing a background service, run `artifacty service install --dry-run`.
68
+ - To review a definition for another operating system, use `--platform macos|linux|windows`.