# MyArtifact > Open-source, local-first & serverless cloud visual artifact studio and Model Context Protocol (MCP) server for **Claude Code**, **OpenAI Codex**, and **Google Antigravity**. ## Overview MyArtifact brings interactive Web Artifacts (sandboxed React 19, Three.js / R3F, Mermaid, HTML, Markdown/KaTeX, SVG, and live TensorBoard runs) to terminal and IDE coding agents. It runs 100% locally on Node.js + SQLite (`~/.myartifact`) or in stateless cloud mode (Vercel + Neon Postgres + Cloudflare R2 / S3) with Google OIDC, cascading RBAC (`Workspace -> Project -> Category -> Artifact`), batch sharing, and delegated agent identities. ## Connect to MyArtifact Cloud (Default) ```bash # 0. Install the MyArtifact CLI globally (Node.js >= 22.5) npm i -g myartifact # 1. Check whether CLI & MCP are already linked to Cloud ("profile: cloud") myartifact whoami # 2. If not logged in, authorize once via Google OIDC (use --device on SSH/containers) myartifact login --cloud https://myartifact.app # 3. Auto-wire MCP config (.mcp.json) & SKILL.md for Claude Code, Codex, and Antigravity # (Once logged in, myartifact mcp and CLI commands automatically target Cloud — do NOT run myartifact serve) myartifact setup # 4. List or switch cloud workspaces myartifact workspace list myartifact workspace use # 5. Push local files directly to Cloud (returns https://myartifact.app/artifacts/eval-dashboard) myartifact push ./dashboard.tsx --slug eval-dashboard --project research myartifact get eval-dashboard myartifact index --project research ``` > Optional 100% offline local mode: `myartifact profile local && myartifact serve` (stores artifacts in `~/.myartifact` on `http://127.0.0.1:4173`). ## Supported Artifact Runtimes - `react`: Sandboxed React 19 TSX/JSX with preloaded Tailwind v4, Recharts, Lucide React, Three.js (+ OrbitControls, EffectComposer), @react-three/fiber, and @react-three/drei. - `html`: Isolated sandboxed HTML/CSS/JS widgets and mini-apps with persistent `window.storage`. - `mermaid`: Mermaid v11 flowcharts, sequence diagrams, ERDs, class diagrams, and state machines. - `svg`: Custom diagrams, clean hardware schematics, and bespoke icon artboards. - `markdown`: Rich typography reports rendered with Marked and KaTeX math (`$...$` / `$$...$$`). - `tensorboard`: Native TensorFlow `.tfevents` scalar curve dashboards plus model checkpoint lineage (`.safetensors` / `.pt`). - `code`: Syntax-ready source files and config snippets with unified diff inspection. ## Agent Operating Protocol 1. **Orient first via the LLM Wiki**: Always call `artifact_wiki_index()` (or `myartifact index`) before creating a new artifact to inspect the workspace LLM Wiki (`index.md` & `log.md`) projects, categories, and backlinks. 2. **Default to Visual-First Runtimes**: Choose interactive `react`, `html`, `threejs`, `mermaid`, `svg`, or `tb_log_scalars` over plain markdown whenever charts, UI workflows, 3D scenes, or diagrams explain faster. Use the Moss theme (`#F7F4ED` / `#151A16` canvas, `#485A43` / `#98AC93` sage accents). 3. **Iterate & Cross-Link**: Use `artifact_update` (or `upsert: true`) rather than creating duplicate slugs, cross-link related artifacts with `[[other-slug]]`, and persist editable UI state via `window.storage` / `artifact_storage_set`. 4. **Respect the Safe Agent Scope Ceiling**: Standard `myartifact login` sessions authorize `artifacts:read`, `artifacts:write`, `storage:write`, and `tb:write` while blocking destructive deletes (`artifacts:delete`) and permission changes (`iam:share`). ## MCP Tools (8 Tools via `myartifact mcp`) - `artifact_wiki_index` — Retrieve the synthesized Karpathy-pattern LLM Wiki `index.md`, `log.md`, and backlink graph. - `artifact_create` — Create or upsert a visual artifact with semantic project/category taxonomy (`project`, `category`). - `artifact_update` — Iterate an artifact into an immutable version checkpoint (`v2`, `v3`, ...) with agent attribution and unified diffs. - `artifact_get` — Fetch latest or historical version content, links, and `window.storage` entries. - `artifact_list` — Search artifacts via FTS5/PostgreSQL FTS or filter by project, category, tag, or agent. - `artifact_storage_set` — Persist stateful configuration or UI state into `window.storage`. - `tb_log_scalars` — Log training scalar series directly to a live visual TensorBoard run (`.tfevents`). - `tb_save_checkpoint` — Version model weight checkpoints under a TensorBoard run (direct S3/R2 SigV4 transfer on cloud). ## Cloud Auth, RBAC & Safe Agent Scope Ceiling - **Google OIDC + PKCE**: Browser auth sets `__Host-ma_session` HTTP-only cookies + CSRF double-submit protection; CLI login uses PKCE loopback (`127.0.0.1`) or RFC 8628 device flow with refresh-token replay detection. - **Cascading RBAC**: Hierarchical roles (`viewer = 10`, `editor = 20`, `admin = 30`, `owner = 40`) evaluate `Workspace -> Project -> Category -> Artifact`, supporting private projects (`inheritWorkspaceAcl = false`). - **Batch Sharing**: Apply grants across multiple artifacts/projects/categories × users, deferred `pending_email` invites (auto-claimed on verified Google login), workspace groups, verified Google `hd` workspace domains, and capability Share Links. - **Safe Agent Scope Ceiling**: Standard `myartifact login` issues delegated sessions (`artifacts:read`, `artifacts:write`, `storage:write`, `tb:write`) and blocks `artifacts:delete`, `iam:share`, and `workspace:admin` (`403 agent_scope_restricted`) unless explicitly elevated (`--elevate`). ## Links - Homepage: https://myartifact.app/ - Web App Manifest: https://myartifact.app/manifest.webmanifest - Sitemap: https://myartifact.app/sitemap.xml - GitHub: https://github.com/TannedCung/MyArtifact