> mcp, agents & hooks

This section is about extending Claude Code past its built-in tools. MCP (Model Context Protocol) connects it to external systems — issue trackers, databases, monitoring — so Claude reads and acts on them directly instead of you pasting data in. Subagents run side tasks in their own context and return a summary. Custom slash commands package repeated prompts, and hooks run your own shell commands at lifecycle events. Together they turn Claude Code from a coding assistant into a configurable workflow engine.

// mcp, agents & hooks

6 commands

// faq

How do I add an MCP server, and what's the -- for?

For a local process: claude mcp add <name> -- <command>, where everything after -- is the server command passed through untouched, so it separates Claude's own flags from the server's. For a remote service: claude mcp add --transport http <name> <url>, with --header for auth. After adding, run /mcp and check the server shows connected, since the add step doesn't validate credentials.

What are the three MCP scopes?

local (default) keeps a server private to you in the current project, stored in ~/.claude.json. project shares it with your team via a committed .mcp.json at the repo root. user makes it available across all your projects. When the same server name appears in more than one scope, local wins over project wins over user.

How is a subagent different from a custom slash command?

A custom slash command (a Markdown file in .claude/commands/) is a saved prompt you invoke with /name in your main conversation. A subagent (a Markdown file in .claude/agents/) runs a task in its own separate context window with its own tool access and returns only a summary, keeping search output and logs out of your main thread. Use commands for repeated prompts, subagents to offload context-heavy side work.

When should I use a hook instead of CLAUDE.md?

Use a hook when something must happen reliably regardless of what Claude decides — formatting after every edit, blocking a dangerous command, notifying you when a turn ends. Hooks are shell commands wired to lifecycle events (PreToolUse, PostToolUse, Stop, and more) in settings.json, and they execute deterministically. CLAUDE.md only shapes Claude's behavior as context, with no guarantee of compliance.