The final treasure, @name! Two of the newest, most powerful features deserve a closer look: MCP for connecting to the wider world, and hooks for automating your crew.
MCP (Model Context Protocol) connects Claude Code to external tools and data sources - GitHub, databases, Slack, a browser, and many more. Each connection is a trade route to another port.
Add a server from the command line:
1# Add the GitHub MCP server
2claude mcp add github npx -y @modelcontextprotocol/server-githubOr declare servers in a project file so the whole crew shares them:
1.mcp.jsonInspect and manage your connections in the REPL:
1/mcpYou can also load a specific MCP configuration when launching:
1claude \
2 --mcp-config ./mcp.jsonOnce connected, ask Claude to read a GitHub issue, query a database, or post a message to Slack - all from the terminal.
Hooks are shell commands that run automatically on events, configured in
.claude/settings.json. When the whistle blows, the crew acts - no reminders needed.The key events:
SessionStart - when a session beginsPreToolUse - before a tool runs (can block dangerous actions)PostToolUse - after a tool runs (e.g. format code)Stop - when Claude finishes respondingA hook that formats code after every edit:
1// .claude/settings.json
2{
3 "hooks": {
4 "PostToolUse": [
5 {
6 "matcher": "Edit",
7 "hooks": [
8 { "type": "command", "command": "npx prettier --write ." }
9 ]
10 }
11 ]
12 }
13}A
PreToolUse hook can refuse edits to protected paths, guarding your treasure like a cannon on the gunwale.Combine them and your ship nearly sails itself: MCP opens trade routes to GitHub and your database, while hooks keep the deck spotless - formatting after edits, running tests on stop, and blocking anything dangerous. Add subagents and skills from the previous lessons, and you command a full, disciplined pirate crew. 🏴☠️
See you on deck! 🚀