Automation
Hook
Hooks
What n8n-mcp-skills runs automatically, and when. A hook is a command Claude Code fires at a fixed moment, without you asking for it.
Install
> /plugin marketplace add czlonkowski/n8n-skills > /plugin install n8n-mcp-skills@n8n-mcp-skills
Ships with n8n-mcp-skills. Installing the plugin gets these hooks.
What fires, and when
SessionStart
Fires once when a session begins, and again after a context compaction. It is where a plugin sets up its environment, or restores state the compaction dropped.
- Matches
startup|resume|clear|compact${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh
PreToolUse
- Matches
^mcp__.*__get_node$${CLAUDE_PLUGIN_ROOT}/hooks/pre-tool-use/get-node.sh - Matches
^mcp__.*__n8n_create_workflow$${CLAUDE_PLUGIN_ROOT}/hooks/pre-tool-use/create-workflow.sh - Matches
^mcp__.*__(n8n_update_partial_workflow|n8n_update_full_workflow)${CLAUDE_PLUGIN_ROOT}/hooks/pre-tool-use/update-workflow.sh - Matches
^mcp__.*__(validate_workflow|n8n_validate_workflow)$${CLAUDE_PLUGIN_ROOT}/hooks/pre-tool-use/validate-workflow.sh - Matches
^mcp__.*__n8n_test_workflow$${CLAUDE_PLUGIN_ROOT}/hooks/pre-tool-use/test-workflow.sh - Matches
^mcp__.*__n8n_instances$${CLAUDE_PLUGIN_ROOT}/hooks/pre-tool-use/instances.sh - Matches
^mcp__.*__n8n_manage_credentials$${CLAUDE_PLUGIN_ROOT}/hooks/pre-tool-use/manage-credentials.sh
PostToolUse
- Matches
^mcp__.*__validate_workflow$${CLAUDE_PLUGIN_ROOT}/hooks/post-tool-use/validate-workflow.sh
Where it lives
- hooks/session-start.shRunsGitHub
Read the script
#!/usr/bin/env bash # Portions of this file are adapted from the n8n-io/skills plugin # (https://github.com/n8n-io/skills), licensed under Apache License 2.0. # Adapted for the community n8n-mcp MCP server. See /NOTICES. # # SessionStart hook for n8n-mcp-skills. # Loads the meta-skill (using-n8n-mcp-skills) into every session via additionalContext. # Re-fires on resume/clear/compact so the protocol survives compaction. # # On `clear` and `compact`, also wipes the PreToolUse hook markers for this # session so the per-node-type warnings can fire again. The agent's memory # of those warnings is gone after a clear/compact, so the markers shouldn't # keep them silent. # # Fails silently and never blocks session startup. set -uo pipefail PLUGIN_ROOT="${CLAUDE_PLUGIN_ROOT:-$(cd "$(dirname "$0")/.." && pwd)}" META_SKILL="${PLUGIN_ROOT}/skills/using-n8n-mcp-skills/SKILL.md" CACHE_DIR="${HOME}/.cache/n8n-mcp-skills" mkdir -p "${CACHE_DIR}" 2>/dev/null || true INPUT="$(cat)" # --- Reset PreToolUse markers on clear/compact ------------------------------- # # After /clear or /compact, the agent has lost the additionalContext that the # PreToolUse hooks injected earlier in the session. Without wiping markers, # the per-node warnings stay silent for the rest of the session even though # the agent no longer remembers them. if command -v jq >/dev/null 2>&1; then SOURCE="$(echo "${INPUT}" | jq -r '.source // empty' 2>/dev/null)" SESSION_ID="$(echo "${INPUT}" | jq -r '.session_id // empty' 2>/dev/null)" if [[ "${SOURCE}" == "clear" || "${SOURCE}" == "compact" ]] && [[ -n "${SESSION_ID}" ]]; then STATE_DIR="${TMPDIR:-/tmp}/n8n-mcp-skills-state" rm -f "${STATE_DIR}/${SESSION_ID}-"*.loaded 2>/dev/null || true fi fi # --- Build additionalContext -------------------------------------------------- if [[ ! -r "${META_SKILL}" ]]; then # Skill missing or unreadable. Fail open with no context, don't break session. exit 0 fi SKILL_BODY="$(cat "${META_SKILL}")" ADDITIONAL_CONTEXT="${SKILL_BODY}" # --- Emit hook output --------------------------------------------------------- # jq is the safe way to escape arbitrary text into JSON. Fall back to python3 # if jq isn't installed (rare on macOS, possible on minimal Linux). if command -v jq >/dev/null 2>&1; then jq -n --arg ctx "${ADDITIONAL_CONTEXT}" '{ hookSpecificOutput: { hookEventName: "SessionStart", additionalContext: $ctx } }' elif command -v python3 >/dev/null 2>&1; then python3 -c ' import json, sys ctx = sys.stdin.read() print(json.dumps({ "hookSpecificOutput": { "hookEventName": "SessionStart", "additionalContext": ctx } })) ' <<< "${ADDITIONAL_CONTEXT}" else # No JSON encoder available, skip injection rather than emit malformed JSON. exit 0 fi
Read the script before you install anything that runs on your machine. This is the one part of a plugin that acts without being asked.
Ships withn8n-mcp-skills
Expert Claude Code skills for building flawless n8n workflows using the n8n-mcp MCP server
Get the whole plugin
Stats
6,011
Stars
999
Forks
Active
Maintenance
Shell
Language
MIT
License
3d ago
Last commit
9mo ago
Created
Repo: czlonkowski/n8n-skills

