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 (download)
- Node.js 18+ installed
Quick Setup (30 seconds)
npm install -g distill-mcp
distill-mcp setup --claudeDone! Restart Claude Code and you're ready.
Manual Setup
If the automatic setup didn't work, configure manually:
Edit ~/.claude/mcp.json:
{
"mcpServers": {
"distill": {
"command": "distill-mcp",
"args": ["serve"]
}
}
}Or with npx (no global install):
{
"mcpServers": {
"distill": {
"command": "npx",
"args": ["distill-mcp", "serve"]
}
}
}Verify Installation
Restart Claude Code, then ask:
Run the session_stats toolYou should see session statistics with tokens used and saved.
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]Session Statistics
Check your savings:
Show my session stats with detailed breakdownRecommended 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 18+) - Run doctor:
distill-mcp doctor - Check logs in Claude Code's output panel
Tools Not Appearing
- Restart Claude Code completely
- Verify
mcp.jsonsyntax is valid JSON - Try running
npx distill-mcp servemanually to check for errors
Permission Issues
On macOS/Linux, you may need to make the command executable:
chmod +x $(which distill-mcp)