This skill should be used when Pencil MCP tools are unavailable and need installation. It detects Pencil Desktop or an IDE with the Pencil extension and registers the MCP server with Claude Code CLI.
From soleurnpx claudepluginhub jikig-ai/soleur --plugin soleurThis skill uses the workspace's default tool permissions.
scripts/check_deps.shscripts/package-lock.jsonscripts/package.jsonscripts/pencil-error-enrichment.mjsscripts/pencil-mcp-adapter.mjsscripts/sanitize-filename.mjsAuto-detect, install, and register the Pencil MCP server with Claude Code CLI.
Prerequisite: One of: (1) the headless CLI (no GUI required, recommended for agents), (2) Pencil Desktop, or (3) an IDE (Cursor/VS Code) with the Pencil extension.
Known limitation: macOS detection uses unverified bundle ID dev.pencil.desktop -- falls back to PATH-based detection if incorrect.
Run check_deps.sh before proceeding. When invoked
from a pipeline (e.g., one-shot), pass --auto to skip interactive prompts,
auto-install the IDE extension, and auto-launch Pencil Desktop.
For interactive use:
bash ./plugins/soleur/skills/pencil-setup/scripts/check_deps.sh
For pipeline/automated use:
bash ./plugins/soleur/skills/pencil-setup/scripts/check_deps.sh --auto
If the script exits non-zero, no Pencil MCP source is available. Stop and inform the user with the printed instructions (both Desktop and IDE options).
If all checks pass, capture these values from the script output:
PREFERRED_MODE -- headless_cli, cli, desktop_binary, or idePREFERRED_BINARY -- path to binary (adapter for headless, pencil for CLI mode)PREFERRED_APP -- --app flag value (empty for CLI and headless modes)PREFERRED_NODE -- (headless_cli only) path to Node >= 22.9.0 binaryProceed to Step 1.
claude mcp list -s user 2>&1 | grep -q "pencil" && echo "REGISTERED" || echo "NOT_REGISTERED"
If REGISTERED, check the registered binary path still exists on disk. Extract the path from claude mcp list -s user output, then test -f <path>. If the file exists (or PREFERRED_MODE=cli), tell the user:
Then stop.
If the path does not exist or NOT_REGISTERED, continue to Step 2.
Registration varies by PREFERRED_MODE from Phase 0:
Remove any existing registration first:
claude mcp remove pencil -s user 2>/dev/null
PREFERRED_MODE=headless_cli)The adapter requires PENCIL_CLI_KEY in the MCP environment. Retrieve the key, then register with -e before the -- separator:
# Retrieve the key (Doppler, or use pencil login token)
PENCIL_KEY=$(doppler secrets get PENCIL_CLI_KEY -p soleur -c dev --plain 2>/dev/null)
# If Doppler is not available, check for a stored login token:
# PENCIL_KEY=$(cat ~/.config/pencil/auth.json 2>/dev/null | grep -o '"token":"[^"]*"' | cut -d'"' -f4)
claude mcp add pencil -s user -e PENCIL_CLI_KEY="$PENCIL_KEY" -- <PREFERRED_NODE> <PREFERRED_BINARY>
Replace <PREFERRED_NODE> with the Node 22+ binary path and <PREFERRED_BINARY> with the adapter path from Phase 0.
Critical: The -e flag must appear before --. Placing it after -- passes it as a CLI arg to the adapter instead of setting an environment variable, causing silent auth failures.
PREFERRED_MODE=cli)claude mcp add -s user pencil -- pencil mcp-server
No --app flag needed -- the CLI handles connection internally.
PREFERRED_MODE=desktop_binary)claude mcp add -s user pencil -- <PREFERRED_BINARY> --app <PREFERRED_APP>
Replace <PREFERRED_BINARY> and <PREFERRED_APP> with values from Phase 0.
PREFERRED_MODE=ide)claude mcp add -s user pencil -- <PREFERRED_BINARY> --app <PREFERRED_APP>
Replace <PREFERRED_BINARY> with the extension binary path and <PREFERRED_APP> with cursor or visual_studio_code.
claude mcp list -s user 2>&1 | grep pencil
If the pencil entry appears, tell the user:
If it does not appear, tell the user the registration failed and suggest running the commands manually.
PREFERRED_MODE=ide), the MCP server connects via WebSocket to the IDE's editor webview. batch_design/batch_get/open_document calls fail with WebSocket not connected to app unless the .pen file tab is open and visible in the IDE. Opening via cursor <path> CLI is not sufficient -- the user must click the tab to activate the webview.--auto to auto-launch Desktop before registration.batch_design operations, changes exist in editor memory only. The user must Ctrl+S (IDE) or Cmd+S/Ctrl+S (Desktop) to flush to disk. In headless CLI mode, the adapter auto-calls save() after mutating operations — no manual save needed.batch_get the current value before batch_design updates to avoid incorrect assumptions.pencil binary name collides with evolus/pencil. The check_deps.sh script guards against this by verifying the version string contains "pencil.dev" or checking for the mcp-server subcommand.pencil interactive command speaks a custom REPL format (tool_name({ key: value })), not MCP protocol. An adapter wrapper is needed to bridge it to Claude Code's MCP framework. The headless CLI also lacks the mcp-server subcommand that the Desktop-installed CLI exposes, and its version string (pencil 0.2.3) doesn't match existing detection patterns.pencil interactive --out supports a save() command that writes to disk without manual Ctrl+S.#!/usr/bin/env node, so the resolved Node depends on PATH, not on the binary that launched the adapter. The adapter's buildPencilEnv() must prepend dirname(process.execPath) to PATH to ensure child processes inherit the correct Node version (22+).padding: Passing padding to a batch_design operation on a text node produces "Invalid properties: /padding unexpected property". The adapter enriches this error with a hint, but the fix is to wrap the text in a frame and apply padding to the frame instead (see #1107 workaround).