Distill

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 --claude

Done! 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 tool

You 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.ts

Compressing 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 breakdown

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 it

Installing Project Hooks

Distill can install hooks that remind you to use optimization tools:

distill-mcp setup --hooks

This adds hooks to your project that:

  • Suggest smart_file_read when reading code files
  • Suggest auto_optimize for large bash outputs
  • Remind about MCP tools on each prompt

Troubleshooting

MCP Server Not Starting

  1. Check Node.js version: node --version (needs 18+)
  2. Run doctor: distill-mcp doctor
  3. Check logs in Claude Code's output panel

Tools Not Appearing

  1. Restart Claude Code completely
  2. Verify mcp.json syntax is valid JSON
  3. Try running npx distill-mcp serve manually to check for errors

Permission Issues

On macOS/Linux, you may need to make the command executable:

chmod +x $(which distill-mcp)

On this page