Module 12 · Lesson 06
Hooks, MCP Servers, and Extending Claude Code for Your Team
Reading time: 20 minutes Track: Claude Fluency for Teams · Developer path
Beyond the default setup
Out of the box, Claude Code is a powerful tool. With hooks and MCP servers, it becomes a customized tool that knows your team's workflows, has access to your team's data sources, and enforces your team's standards automatically.
Hooks
Hooks are shell commands that run automatically in response to Claude Code events. You configure them in .claude/settings.json in your project or in ~/.claude/settings.json for global defaults.
Available hook events:
| Hook | When it runs |
|---|---|
PreToolUse | Before any tool call (file read, edit, bash command) |
PostToolUse | After any tool call |
Notification | When Claude wants to notify you of something |
Stop | When Claude finishes a response |
Common useful hooks:
Auto-format after edits
{
"hooks": {
"PostToolUse": [{
"matcher": "Write",
"hooks": [{
"type": "command",
"command": "prettier --write $CLAUDE_FILE_PATH"
}]
}]
}
}
Run tests after any change
{
"hooks": {
"PostToolUse": [{
"matcher": "Write",
"hooks": [{
"type": "command",
"command": "npm test -- --testPathPattern=$(basename $CLAUDE_FILE_PATH .ts)"
}]
}]
}
}
Lint before finalizing
{
"hooks": {
"Stop": [{
"hooks": [{
"type": "command",
"command": "npm run lint"
}]
}]
}
}
The feedback loop hooks create: With auto-format and auto-test hooks, Claude's edits are immediately formatted and tested. Claude sees the test output, can observe failures, and can iterate without you needing to run anything manually. This tight loop dramatically accelerates debugging and refactoring tasks.
MCP Servers
MCP (Model Context Protocol) is an open protocol for connecting Claude to external data sources and tools. An MCP server exposes capabilities — read data, perform actions — that Claude Code can invoke during sessions.
What MCP enables:
- Claude can query your internal documentation
- Claude can read your team's Jira/Linear issues
- Claude can check your deployment status
- Claude can look up your API specs
- Claude can query your database (read-only)
How MCP servers work:
You configure MCP servers in .claude/settings.json:
{
"mcpServers": {
"internal-docs": {
"command": "npx",
"args": ["-y", "@yourcompany/mcp-docs-server"],
"env": { "DOCS_TOKEN": "..." }
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": { "GITHUB_TOKEN": "..." }
}
}
}
With this configured, you can ask Claude: "What do our internal docs say about the authentication flow?" or "What's the status of PR #1234?" and Claude has access to those systems.
Building a simple MCP server:
If you have internal tooling or documentation, building an MCP server for it is straightforward — it's a small Node.js or Python program that responds to a defined protocol. The MCP SDK handles most of the boilerplate.
Team-level MCP configuration:
Commit your team's MCP server configuration (without secrets) to your repository so every team member gets the same tool access. Store secrets in environment variables or your secrets manager.
Recommended team extension setup
For most engineering teams, this starting configuration delivers significant value:
- Auto-format hook: Run your formatter after every file write
- Auto-test hook: Run relevant tests after changes
- GitHub MCP: Let Claude see PRs, issues, and repo context
- Internal docs MCP (if you have a docs system): Let Claude reference your internal documentation
This setup, combined with a good CLAUDE.md, makes Claude Code feel like a team member who has full context on your tooling and standards.