I Connected Claude Code to 5 Tools and Added Automation Hooks — Here is What Changed

Connect Claude Code to Perplexity, Firecrawl, and Notion via MCP servers, then build 3 automation hooks that enforce standards automatically.

Table of Contents

This lesson covers connecting Claude Code to external tools using MCP servers (Model Context Protocol) and adding automation hooks. It shows how to set up Perplexity for web search, Firecrawl for web scraping, and Notion for reading a content calendar, plus command hooks that auto-format files, block dangerous commands, and check content quality.

What you will be able to do

  • Connect Claude Code to Perplexity, Firecrawl, and Notion through MCP servers so it can search the web, scrape pages, and read a content calendar.
  • Configure an MCP server with the claude mcp add command, including API keys and environment variables.
  • Write command hooks that run shell scripts automatically at PreToolUse, PostToolUse, and Stop events.
  • Block dangerous bash commands such as rm -rf and git push --force before they run, using exit code 2.
  • Auto-format edited files with Prettier and flag forbidden brand-voice phrases in draft markdown files.

Before you start

  • jq installed, for parsing the JSON input hook scripts receive (brew install jq on macOS, sudo apt-get install jq on Linux).
  • Node.js and npm installed, for the npx commands used in MCP server setup.
  • prettier installed globally or in the project, for the format-on-save hook.
  • API keys for Perplexity, Firecrawl, and Notion, plus a Notion integration shared with your content calendar database.

Reference

Component Command / Config What it does
Perplexity MCP claude mcp add perplexity --env PERPLEXITY_API_KEY=your-key-here -- npx -y @perplexity-ai/mcp-server Adds search and reason tools for live web data
Firecrawl MCP claude mcp add firecrawl --url https://mcp.firecrawl.dev/your-api-key/v2/mcp Adds firecrawl_scrape, firecrawl_search, firecrawl_map tools
Notion MCP claude mcp add --transport http notion https://mcp.notion.com/mcp Lets Claude Code read and check status of content calendar entries
Verify servers /mcp Lists connected MCP servers and their available tools
PreToolUse hook Fires before any tool runs; exit code 2 blocks the action Used to stop dangerous bash commands before they execute
PostToolUse hook Fires after any tool completes Used to run Prettier automatically after Edit or Write
Stop hook Fires when Claude finishes responding Used for cleanup or reporting tasks
Exit codes 0 = proceed, 2 = block, any other code = warning only How a hook script communicates its result back to Claude Code

Common errors and fixes

What goes wrong The fix
"command not found: jq" when a hook fires Install jq: brew install jq (macOS) or sudo apt-get install jq (Linux)
A CLAUDE.md rule like "always format with Prettier" gets skipped sometimes (in testing, followed 7 of 10 sessions) Use a PostToolUse hook instead; hooks run every time, CLAUDE.md rules are only suggestions
The format-on-save hook runs but the file is not formatted Install prettier in the project or globally (npm install --save-dev prettier or npm install -g prettier); without it the hook skips formatting silently
Claude Code attempts a destructive command such as git push --force or rm -rf The block-dangerous.sh PreToolUse hook matches the pattern and exits with code 2, blocking the command and telling Claude Code why
Claude Code cannot see the Notion content calendar after adding the MCP server Share the Notion database with the integration you created at notion.so/my-integrations; creating the API key alone is not enough

Read the full walkthrough

The complete lesson, with screenshots and any downloads, is published on Substack as part of Claude Code Masterclass: Build AI Systems Without Writing Code.

Read Lesson 3 on Substack →

More in this section

Continue the course

Browse all lessons in the Claude Code Masterclass: Build AI Systems Without Writing Code course, or subscribe to the GenAI Unplugged newsletter to get new lessons in your inbox.

Dheeraj Sharma

Dheeraj Sharma

AI Systems Builder
Creator of the n8n Zero to Hero course (42 lessons, 31+ hours). I help solopreneurs build AI systems that grow revenue without growing workload.

Get the n8n Mastery Bundle

All workflows, cheat sheets, and premium resources from the entire course in one package.

Read the full lesson on Substack