Claude Code Integration
Step-by-step guide to integrate Distill with Claude Code
Claude Code Integration
This guide walks you through setting up Distill with Claude Code.
Prerequisites
- Claude Code installed (
npm install -g @anthropic-ai/claude-codeor download) - Node.js 20+ installed
Quick Setup (30 seconds)
npm install -g distill-mcp
distill-mcp setupDone! Restart Claude Code and you're ready.
Manual Setup
If the automatic setup didn't work:
Option 1: Via CLI (recommended)
claude mcp add distill -- npx distill-mcp serveOption 2: Via configuration file
Edit ~/.claude.json (global) or .mcp.json (per-project):
{
"mcpServers": {
"distill": {
"command": "distill-mcp",
"args": ["serve"]
}
}
}Or with npx (no global install):
{
"mcpServers": {
"distill": {
"command": "npx",
"args": ["distill-mcp", "serve"]
}
}
}Verify Installation
Check that the server is properly configured:
claude mcp listOr in Claude Code, use the /mcp command to see connected servers.
Then ask Claude to read a source file with smart_file_read to verify that Distill tools are available.
Using Distill Tools
Smart File Reading
Instead of reading entire files, use smart_file_read:
Use smart_file_read to get the structure of src/server.tsCompressing Build Output
When you get build errors:
Use auto_optimize to compress this build output: [paste output]Recommended CLAUDE.md Setup
Add this to your project's CLAUDE.md to enforce Distill usage:
## MCP Tool Usage
When reading source code files for exploration, use:
- `smart_file_read` instead of `Read` for .ts/.js/.py files
When you see large command output (>500 chars):
- Use `auto_optimize` to compress itInstalling Project Hooks
Distill can install hooks that remind you to use optimization tools:
distill-mcp setup --hooksThis adds hooks to your project that:
- Suggest
smart_file_readwhen reading code files - Suggest
auto_optimizefor large bash outputs - Remind about MCP tools on each prompt
Troubleshooting
MCP Server Not Starting
- Check Node.js version:
node --version(needs 20+) - Run doctor:
distill-mcp doctor - Check logs in Claude Code's output panel
Tools Not Appearing
- Check configuration:
claude mcp list - Verify JSON syntax is valid in
~/.claude.json - Try running
npx distill-mcp servemanually to check for errors - Use
/mcpin Claude Code to see server status
Permission Issues
On macOS/Linux, you may need to make the command executable:
chmod +x $(which distill-mcp)