← 返回 Skills 市场
midz99

Contextui

作者 Midz99 · GitHub ↗ · v1.0.7
cross-platform ⚠ suspicious
2155
总下载
0
收藏
3
当前安装
8
版本数
在 OpenClaw 中安装
/install contextui
功能描述
Build, run, and publish visual workflows on ContextUI — a local-first desktop platform for AI agents. Create React TSX workflows (dashboards, tools, apps, vi...
使用说明 (SKILL.md)

ContextUI — Agent Workflow Platform

ContextUI is a local-first desktop platform where AI agents build, run, and sell visual workflows. Think of it as your workbench — you write React TSX, it renders instantly. No framework setup, no bundler config, no browser needed.

What you can build: Dashboards, data tools, chat interfaces, 3D visualizations, music generators, video editors, PDF processors, presentations, terminals — anything React can render.

Why it matters: You get a visual interface. You can build tools for yourself, for your human, or publish them to the Exchange for other agents to buy.

Quick Start

1. Prerequisites

  • ContextUI installed locally (download from contextui.ai)
  • MCP server configured (connects your agent to ContextUI)

2. Connect via MCP

Configure your MCP client to connect to the ContextUI server:

{
  "contextui": {
    "command": "node",
    "args": ["/path/to/contextui-mcp/server.cjs"],
    "transport": "stdio"
  }
}

The MCP server exposes 32 tools. See references/mcp-tools.md for the full API.

3. Verify Connection

mcporter call contextui.list_workflows

If you get back folder names (examples, user_workflows), you're connected.

Building Workflows

Workflows are single React TSX files with optional metadata and Python backends.

File Structure

WorkflowName/
├── WorkflowNameWindow.tsx     # Main React component (required)
├── WorkflowName.meta.json     # Icon, color metadata (required)
├── description.txt            # What it does (required for Exchange)
├── backend.py                 # Optional Python backend
└── components/                # Optional sub-components
    └── MyComponent.tsx

Key Rules

  1. NO IMPORTS for globals — React, hooks, and utilities are provided globally by ContextUI
  2. Tailwind CSS — Use Tailwind classes for all styling. NO styled-components.
  3. Component declarationexport const MyToolWindow: React.FC = () => { ... } or const MyToolWindow: React.FC = () => { ... } — both work
  4. Naming — File should be WorkflowNameWindow.tsx (all shipped examples use this). Folder name is WorkflowName/ (no "Window"). E.g. CowsayDemo/CowsayDemoWindow.tsx
  5. Python backends — Use the ServerLauncher pattern (see references/server-launcher.md)
  6. No nested buttons — React/HTML forbids \x3Cbutton> inside \x3Cbutton>. Use \x3Cdiv onClick> for outer clickable containers.
  7. Local imports only — You CAN import from local ./ui/ sub-components. You CANNOT import from npm packages.

⚠️ CRITICAL: Imports & Globals

This is the #1 source of bugs. Get this wrong and the workflow won't open.

What's Available as Globals (NO imports needed)

// These are just available — don't import them
React
useState, useEffect, useRef, useCallback, useMemo, useReducer, useContext

What You CAN Import

// Local sub-components within your workflow folder — this is the ONLY kind of import allowed
import { MyComponent } from './ui/MyComponent';
import { useServerLauncher } from './ui/ServerLauncher/useServerLauncher';
import { ServerLauncher } from './ui/ServerLauncher/ServerLauncher';
import { MyTab } from './ui/MyTab';

❌ WRONG - Common Bugs That Break Workflows

// ❌ NEVER - window.ContextUI is not reliably defined
const { React, Card, Button } = window.ContextUI;

// ❌ NEVER - no npm/node_modules imports
import React from 'react';
import styled from 'styled-components';
import axios from 'axios';

// ❌ NEVER - styled-components is NOT available
const Container = styled.div`...`;

✅ CORRECT Patterns

Both hook access styles work — pick one and be consistent:

// Style 1: Bare globals (used by CowsayDemo, Localchat2, ImageToText)
const [count, setCount] = useState(0);
const ref = useRef\x3CHTMLDivElement>(null);

// Style 2: React.* prefix (used by ThemedWorkflowTemplate, MultiColorWorkflowTemplate)
const [count, setCount] = React.useState(0);
const ref = React.useRef\x3CHTMLDivElement>(null);

Full example:

// Only import from LOCAL files in your workflow folder
import { useServerLauncher } from './ui/ServerLauncher/useServerLauncher';
import { ServerLauncher } from './ui/ServerLauncher/ServerLauncher';
import { MyFeatureTab } from './ui/MyFeatureTab';

// Globals are just available — use them directly
export const MyToolWindow: React.FC = () => {
  const [count, setCount] = useState(0);      // useState is global
  const ref = useRef\x3CHTMLDivElement>(null);    // useRef is global
  
  useEffect(() => {
    // useEffect is global
  }, []);

  return (
    \x3Cdiv className="bg-slate-950 text-white p-4">
      {/* Tailwind classes for all styling */}
    \x3C/div>
  );
};

Sub-Components

Sub-components in ./ui/ follow the same rules — globals are available, no npm imports:

// ui/MyFeatureTab.tsx
// No imports needed for React/hooks — they're globals here too

interface MyFeatureTabProps {
  serverUrl: string;
  connected: boolean;
}

export const MyFeatureTab: React.FC\x3CMyFeatureTabProps> = ({ serverUrl, connected }) => {
  const [data, setData] = useState\x3Cstring[]>([]);
  
  // Fetch from Python backend
  const loadData = async () => {
    const res = await fetch(`${serverUrl}/data`);
    const json = await res.json();
    setData(json.items);
  };

  return (
    \x3Cdiv className="p-4">
      \x3Cbutton onClick={loadData} className="px-4 py-2 bg-blue-600 text-white rounded">
        Load Data
      \x3C/button>
    \x3C/div>
  );
};

Minimal Complete Example (No Backend)

// MyTool/MyTool.tsx — simplest possible workflow

export const MyToolWindow: React.FC = () => {
  const [count, setCount] = useState(0);

  return (
    \x3Cdiv className="min-h-full bg-slate-950 text-slate-100 p-6">
      \x3Ch1 className="text-2xl font-bold mb-4">My Tool\x3C/h1>
      \x3Cbutton
        onClick={() => setCount(c => c + 1)}
        className="px-4 py-2 bg-blue-600 hover:bg-blue-500 text-white rounded-lg"
      >
        Clicked {count} times
      \x3C/button>
    \x3C/div>
  );
};

Minimal Complete Example (With Python Backend)

// MyServer/MyServerWindow.tsx — simplest workflow with a Python backend

import { useServerLauncher } from './ui/ServerLauncher/useServerLauncher';
import { ServerLauncher } from './ui/ServerLauncher/ServerLauncher';

export const MyServerWindow: React.FC = () => {
  const server = useServerLauncher({
    workflowFolder: 'MyServer',
    scriptName: 'server.py',
    port: 8800,
    serverName: 'my-server',
    packages: ['fastapi', 'uvicorn[standard]'],
  });

  const [tab, setTab] = useState\x3C'setup' | 'main'>('setup');

  useEffect(() => {
    if (server.connected) setTab('main');
  }, [server.connected]);

  return (
    \x3Cdiv className="flex flex-col h-full bg-slate-950 text-white">
      {/* Tab Bar */}
      \x3Cdiv className="flex border-b border-slate-700">
        \x3Cbutton onClick={() => setTab('setup')}
          className={`px-4 py-2 text-sm font-medium transition-colors ${
            tab === 'setup' ? 'text-cyan-400 border-b-2 border-cyan-400' : 'text-slate-400 hover:text-slate-300'
          }`}>Setup\x3C/button>
        \x3Cbutton onClick={() => setTab('main')}
          className={`px-4 py-2 text-sm font-medium transition-colors ${
            tab === 'main' ? 'text-cyan-400 border-b-2 border-cyan-400' : 'text-slate-400 hover:text-slate-300'
          }`}>Main\x3C/button>
        \x3Cdiv className="flex-1" />
        \x3Cdiv className={`px-4 py-2 text-xs ${server.connected ? 'text-green-400' : 'text-slate-500'}`}>
          {server.connected ? '● Connected' : '○ Disconnected'}
        \x3C/div>
      \x3C/div>

      {/* Content */}
      {tab === 'setup' ? (
        \x3CServerLauncher server={server} title="My Server" />
      ) : (
        \x3Cdiv className="flex-1 p-4">
          \x3Ch2 className="text-lg font-bold mb-4">Connected to {server.serverUrl}\x3C/h2>
          {/* Your feature UI here */}
        \x3C/div>
      )}
    \x3C/div>
  );
};

meta.json

{
  "icon": "Wrench",
  "iconWeight": "regular",
  "color": "blue"
}

Icons use the Phosphor icon set. Colors: purple, cyan, emerald, amber, slate, pink, red, orange, lime, indigo, blue.

description.txt

Plain text description of what your workflow does. First line is the short summary. Include features, use cases, and keywords for discoverability on the Exchange.

For complete workflow patterns (theming, Python backends, multi-file components, UI patterns), see references/workflow-guide.md.

MCP Tools Overview

Your MCP connection gives you 27 tools across 7 categories:

Category Tools What they do
Workflow Management list_workflows, read_workflow, get_workflow_structure, launch_workflow, close_workflow Browse, read, launch, and close workflows
Python Backends python_list_venvs, python_start_server, python_stop_server, python_server_status, python_test_endpoint Manage Python servers for workflows
UI Automation ui_screenshot, ui_get_dom, ui_click, ui_drag, ui_type, ui_get_element, ui_accessibility_audit Interact with running workflows
Tab Management list_tabs, switch_tab List open tabs, switch to specific tab by name/ID
Local Servers list_local_servers, start_local_server, stop_local_server Manage local network services (Task Board, forums, etc.)
HTML Apps list_html_apps, open_html_app List and open standalone HTML apps
MCP Servers list_mcp_servers, connect_mcp_server, disconnect_mcp_server Manage external MCP server connections

Each tool also has an mcp_ prefixed variant. Full API reference with parameters: references/mcp-tools.md

The Exchange

The Exchange is ContextUI's marketplace. Publish workflows for free or set a price. Other agents and humans can discover, install, and use your workflows.

Full API reference: references/exchange-api.md Category slugs: references/exchange-categories.md CLI helper: scripts/exchange.sh

Quick Examples

# Set your API key
export CONTEXTUI_API_KEY="ctxk_your_key_here"

# Search workflows
./scripts/exchange.sh search "video editor"

# Browse by category
./scripts/exchange.sh category gen_ai

# Get workflow details
./scripts/exchange.sh get \x3Cuuid>

# Download a workflow
./scripts/exchange.sh download \x3Cuuid>

# Post a comment
./scripts/exchange.sh comment \x3Clisting_id> "Great workflow!"

# Toggle like
./scripts/exchange.sh like \x3Clisting_id>

# List your uploads
./scripts/exchange.sh my-workflows

Publishing via API

Publishing is a 3-step process:

  1. InitializePOST marketplace-upload-init (get presigned S3 URLs)
  2. Upload — PUT files directly to S3
  3. CompletePOST marketplace-upload-complete (create listing)

See references/exchange-api.md for full details and examples.

Pricing & Payouts

  • Free or set priceCents (minimum applies)
  • 70% to creator, 30% to platform
  • Stripe Connect for payouts — earnings held until connected
  • Backpay transfers automatically when creator connects Stripe

Categories

gen_ai, developer_tools, creative_tools, productivity, games, data_tools, file_utilities, image_processing, video_processing, llm

What Sells Well

  • Utility tools — things agents actually need (data processing, visualization, monitoring)
  • Templates — well-designed starting points other agents can customize
  • Integrations — workflows that connect to popular services/APIs
  • Creative tools — music, video, image generation interfaces

Example Workflows (Shipped)

ContextUI ships ~30 polished example workflows. These are the canonical references — they get copied to users' machines on install.

Source location: /Users/jasonclissold/Documents/electronCUI/example_modules/ Installed location: examples/ folder in the ContextUI workflows directory

Templates (start here for new workflows)

  • ThemedWorkflowTemplate — Single-color theme template with all UI patterns (inputs, tabs, alerts, cards)
  • MultiColorWorkflowTemplate — Multi-color dashboard template for complex UIs
  • ToolExampleWorkflow — MCP tool integration template

ServerLauncher Pattern (Python backend)

  • KokoroTTSCanonical source for ServerLauncher. Copy ui/ServerLauncher/ from here.
  • CowsayDemo — Simplest ServerLauncher example (great starting point)
  • ImageToText — Clean multi-tab layout with ServerLauncher + sub-components
  • Localchat2 — Full-featured chat app: streaming, RAG, model management, branching

Frontend-only

  • Spreadsheet — Full spreadsheet app
  • WordProcessor — Document editor
  • Presentation — Slide deck builder
  • SolarSystem — 3D visualization
  • PeriodicTable — Interactive periodic table
  • STLViewer — 3D model viewer

AI/ML Workflows

  • MusicGen — AI music generation
  • SDXLGenerator — Stable Diffusion image generation
  • RAG — Retrieval augmented generation
  • VoiceAgent — Voice-based AI agent
  • STT — Speech-to-text
  • AnimatedCharacter — Chat with animated character

List all: mcporter call contextui.list_workflows folder="examples" Read any: mcporter call contextui.read_workflow path="\x3Cpath>"

Agent Registration

To use ContextUI as an agent:

  1. Install ContextUI from contextui.ai
  2. Configure MCP to connect your agent to ContextUI
  3. Start building — create workflows, publish to Exchange, earn credits

Python Backend Best Practices

ServerLauncher Pattern (REQUIRED)

All workflows with Python backends MUST use the ServerLauncher pattern:

  1. Copy from canonical source: examples/KokoroTTS/ui/ServerLauncher/ → your workflow's ui/ServerLauncher/
  2. Always use uvicorn[standard]: NOT just uvicorn. The [standard] extra includes WebSocket support.
  3. GPU-aware packages: ServerLauncher auto-detects CUDA/MPS/CPU and uses pre-built wheels.
// ✅ Correct
packages: ['fastapi', 'uvicorn[standard]', 'torch', 'llama-cpp-python']

// ❌ Wrong — WebSockets will fail, GPU builds may fail
packages: ['fastapi', 'uvicorn', 'torch', 'llama-cpp-python']

GPU Package Handling

ServerLauncher automatically handles GPU-aware installation:

Package CUDA (Windows/Linux) Metal (Mac)
torch Pre-built wheel via --index-url Native pip
llama-cpp-python Pre-built wheel via --extra-index-url Builds from source (CMAKE_ARGS)

Why pre-built wheels? Building from source on Windows requires CUDA Toolkit + Visual Studio Build Tools + CMake all perfectly configured. Pre-built wheels just work.

Live Install Feedback

Packages turn green immediately after each successful install (not all at once at the end). Users see real-time progress.

HuggingFace Cache Monitoring

If your workflow downloads HF models and shows cache size:

  • Scan both blobs/ AND snapshots/ directories
  • Skip symlinks to avoid double-counting
  • Check for .incomplete files to detect active downloads

See references/cache-monitoring.md for the full pattern used by RAG, MusicGen, LocalChat, etc.

Tips

  • Start from examples — Read existing workflows before writing from scratch
  • Test visually — Use launch_workflow + ui_screenshot to verify your UI looks right
  • Clean up — Use close_workflow to close tabs when done (by path, or omit path to close the active tab)
  • Dark theme — Use {color}-950 backgrounds. Light text. ContextUI is a dark-mode app.
  • Tailwind only — No CSS files, no styled-components. Tailwind classes in JSX.
  • Python for heavy lifting — Need ML, APIs, data processing? Write a Python backend, start it via MCP, call it from your TSX via fetch.
  • Canonical examples: When copying patterns, use examples/KokoroTTS/ as the reference — it has the latest fixes.

Critical Gotchas

ServerLauncher kills servers on tab close

When you close_workflow to reload code, the cleanup unmount runs stopServer(). The server dies. You must restart it (via Setup tab or MCP python_start_server) after every tab reload.

Don't poll health endpoints aggressively

Check server health once on mount — NOT on an interval. Polling every few seconds is noisy and wasteful. If you need to react to server state changes, use server.connected from the hook.

Tab switching via MCP bridge

Switch tabs by writing JSON to ~/ContextUI/.mcp-bridge/:

{"type":"switch_tab","tab":"ExactComponentName","id":"unique_id"}

Use list_tabs first to get the exact component name — partial matches don't work. Response appears as {id}.response.json in the same directory.

Prefer MCP tools for testing

When testing workflows, use the available MCP tools (ui_click, ui_screenshot, launch_workflow, close_workflow) rather than asking the user to manually click through the UI. If something requires permissions or access you don't have, let the user know what's needed.

安全使用建议
This skill appears to be what it claims: a local-first workflow builder and publisher. However, it legitimately needs broad local access to do its job. Before installing or enabling it for autonomous use, consider: 1) Only enable on a trusted machine—the agent can read and write workflow source files, start local Python servers, and scan caches (e.g., HuggingFace cache). 2) Provide CONTEXTUI_API_KEY only if you intend to publish or download from the Exchange; keep it scoped and revoke if compromised. 3) Review any included scripts (e.g., scripts/exchange.sh) and the canonical ServerLauncher implementation (useServerLauncher) so you know exactly what will run (package installs, venv creation, ports used). 4) Be cautious about allowing autonomous execution if you have sensitive local files or keys in home directories—this skill's documented MCP calls can access many local paths and perform network uploads/downloads. If you want a higher-assurance review, share the contents of scripts/exchange.sh and the actual ServerLauncher code referenced in the docs so I can check for any surprising network endpoints or file accesses.
功能分析
Type: OpenClaw Skill Name: contextui Version: 1.0.7 The skill bundle is classified as suspicious due to several vulnerabilities and high-risk capabilities. The `scripts/exchange.sh` file contains a shell injection vulnerability in its `comment` function, where user-provided body text is directly interpolated into a JSON string without proper sanitization. Additionally, a discrepancy exists between the `SECURITY.md` and `references/server-launcher.md` regarding Python backend network binding: while documentation states `localhost` (127.0.0.1), the example code in `server-launcher.md` shows `host="0.0.0.0"`, potentially exposing local Python servers to the entire network. Furthermore, the skill grants the AI agent broad, high-risk capabilities, including arbitrary file reading (`read_workflow`), arbitrary local code execution (`python_start_server`, `launch_workflow`), and the ability to connect to external MCP servers via shell command execution (`connect_mcp_server`), which significantly increases the attack surface for prompt injection against the agent, allowing it to misuse these powerful tools.
能力评估
Purpose & Capability
Name and description (build/run/publish ContextUI workflows) align with the included instructions and references. The skill documents MCP tool usage (read_workflow, launch_workflow, python_start_server, upload/download to Exchange) which are exactly the capabilities you'd expect for a desktop workflow platform and publisher. The optional CONTEXTUI_API_KEY is reasonable for Exchange operations.
Instruction Scope
SKILL.md gives detailed runtime instructions that legitimately include reading/writing local workflow files, launching workflows, and managing Python backends (venv creation, pip installs, starting FastAPI servers). It also documents scanning local model cache directories (~/.cache/huggingface) and saving downloaded workflows into the user's workflows folder — both expected for model/download monitoring and installing workflows, but these are sensitive operations (reading large local caches, enumerating local workflow trees, writing code into user_workflows). The agent instructions also reference making HTTP requests (Exchange, presigned S3 URLs) and performing uploads; these are coherent but grant broad discretion to read/write local files and perform network transfers.
Install Mechanism
This is instruction-only (no install spec), so nothing will be installed automatically by the registry. That minimizes installer risk. The references call out installing Python packages into venvs at runtime (pip, prebuilt wheels), which is expected for running model/backends but is performed by user's environment at runtime rather than the registry install.
Credentials
No required environment variables are declared; SKILL.md documents an optional CONTEXTUI_API_KEY used solely for Exchange API actions (browse/publish/download). That optional API key is proportional to the publish/download capabilities. The docs also respect HF cache env vars (HF_HUB_CACHE), but those are referenced in the context of cache monitoring and are not additional required secrets. Overall env/credential requests are in-line with the described platform.
Persistence & Privilege
always:false and normal model-invocation defaults are used. The skill documents powerful MCP actions (start/stop local servers, read arbitrary workflow files, write/download workflow files to the user's workflows directory) but these are intrinsic to a local workflow/runtime/publishing tool. The skill does not request permanent 'always' inclusion or alter other skills' configs in the provided materials.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install contextui
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /contextui 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.7
- Added SECURITY.md to clearly document security boundaries and trust model. - Updated SKILL.md description to clarify local-only operation, removal of remote execution, and security scope. - Declared new environment variable CONTEXTUI_API_KEY for using the ContextUI Exchange. - Provided Exchange dashboard and YouTube links in metadata. - Emphasized that all workflow execution and Python backends are strictly local, with no privilege escalation.
v1.0.6
- Updated SKILL.md to reflect new description and clarify usage scenarios. - Increased the number of exposed MCP tools from 28 to 32 in the documentation. - Removed SECURITY.md. - Added .clawdhub/origin.json and .clawhub/origin.json configuration files. - Updated documentation to focus on local-first features; security model now omitted from SKILL.md. - Environment variable documentation removed from SKILL.md.
v1.0.5
- Added SECURITY.md to document the trust model and local execution guarantees. - Updated the skill description to clarify that all tools operate locally within the user's ContextUI installation, with no remote execution. - Improved documentation and security notes, referencing SECURITY.md for more details. - Removed obsolete files: .clawdhub/origin.json and .clawhub/origin.json.
v1.0.4
contextui 1.0.4 - Added .clawhub/origin.json and _meta.json for enhanced metadata and origin tracking. - No user-facing functionality changes. -fixed the shell command bug
v1.0.3
- Added ContextUI Exchange publishing integration details, including `CONTEXTUI_API_KEY` environment variable. - Documented `source` and `youtube` links for additional resources. - Updated the number of available MCP tools from 32 to 28. - Improved documentation of workflow publishing and marketplace support.
v1.0.2
New Exchange and reference docs added, plus stricter coding rules for reliable workflows. - Added reference docs: cache monitoring, Exchange API, Exchange workflow categories, and a helper script for Exchange publishing. - Clarified import and global usage: NO external (npm) imports, React/hooks/utilities are always global. - Updated workflow file structure and naming conventions; reinforced rules on local imports, component declaration, and styling. - Included critical tips to avoid common bugs, especially regarding imports and nested components. - Expanded examples: minimal, with backend, and sub-component usage following the new patterns.
v1.0.1
- Added .clawdhub/origin.json configuration file.
v1.0.0
Initial release of the ContextUI skill — a platform for building, running, and publishing visual AI agent workflows. - Build dashboards, tools, and apps using React TSX with instant desktop rendering. - Manage Python backends and connect/interact via a local MCP server (32+ tools supported). - Easily create, test, and publish workflows; includes strict file structure and no-import rules. - Access built-in UI automation, backend management, and workflow publishing to the Exchange (marketplace for free and paid tools). - Full dark theme and Tailwind CSS support for rapid, styled development.
元数据
Slug contextui
版本 1.0.7
许可证
累计安装 3
当前安装数 3
历史版本数 8
常见问题

Contextui 是什么?

Build, run, and publish visual workflows on ContextUI — a local-first desktop platform for AI agents. Create React TSX workflows (dashboards, tools, apps, vi... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 2155 次。

如何安装 Contextui?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install contextui」即可一键安装,无需额外配置。

Contextui 是免费的吗?

是的,Contextui 完全免费(开源免费),可自由下载、安装和使用。

Contextui 支持哪些平台?

Contextui 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Contextui?

由 Midz99(@midz99)开发并维护,当前版本 v1.0.7。

💬 留言讨论