New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

distill-mcp

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

distill-mcp

Distill - MCP Server for LLM token optimization and context compression

latest
Source
npmnpm
Version
0.8.1
Version published
Weekly downloads
3
-62.5%
Maintainers
1
Weekly downloads
 
Created
Source

Distill

Extract the essence. Compress the context. Save tokens.

Distill is an open-source MCP server that optimizes LLM token usage through intelligent context compression. Works with Claude Code, Cursor, and Windsurf.

npm version License: MIT

Why Distill?

ProblemDistill SolutionSavings
Large build outputsAuto-compress errors80-95%
Reading entire filesAST-based extraction50-70%
Multiple tool callsTypeScript SDK execution98%
Verbose logsSmart summarization80-90%

Quick Start

# Run directly with npx
npx distill-mcp

# Or install globally
npm install -g distill-mcp

# Configure your IDE
distill-mcp setup

Add to Claude Code

claude mcp add distill -- npx distill-mcp

Features

  • Smart File Reading - Extract functions, classes, or signatures without loading entire files
  • Auto Compression - Detects content type and applies optimal compression
  • Code Execution SDK - Write TypeScript instead of chaining tool calls
  • Lazy Loading - Only loads tools when needed (85% token overhead reduction)
  • 7 Languages - TypeScript, JavaScript, Python, Go, Rust, PHP, Swift

MCP Tools

Core Tools (Always Loaded)

ToolPurposeSavings
auto_optimizeAuto-detect and compress content40-95%
smart_file_readRead code with AST extraction50-70%
code_executeExecute TypeScript with SDK98%
discover_toolsBrowse/load additional tools-

On-Demand Tools

ToolPurposeSavings
semantic_compressTF-IDF based compression40-60%
summarize_logsSummarize server/test/build logs80-90%
analyze_build_outputParse build errors95%+
deduplicate_errorsGroup repeated errors80-95%
diff_compressCompress git diffs50-80%
context_budgetPre-flight token estimation-
session_statsUsage analytics-

Usage Examples

Smart File Reading

# Get file structure overview
mcp__distill__smart_file_read filePath="src/server.ts"

# Extract specific function
mcp__distill__smart_file_read filePath="src/server.ts" target={"type":"function","name":"createServer"}

# Get skeleton (signatures only)
mcp__distill__smart_file_read filePath="src/server.ts" skeleton=true

Compress Build Output

# After a failed build, compress the output
mcp__distill__auto_optimize content="<paste npm/tsc/webpack output>"

Code Execution SDK

The code_execute tool provides 98% token savings by letting LLMs write TypeScript:

mcp__distill__code_execute code="return ctx.compress.auto(ctx.files.read('logs.txt'))"

SDK API:

// File operations
ctx.files.read(path)
ctx.files.glob(pattern)
ctx.files.exists(path)

// Code analysis
ctx.code.skeleton(content, lang)
ctx.code.extract(content, lang, {type, name})
ctx.code.parse(content, lang)

// Compression
ctx.compress.auto(content, hint?)
ctx.compress.logs(logs)
ctx.compress.diff(diff)
ctx.compress.semantic(content, ratio?)

// Git operations
ctx.git.diff(ref?)
ctx.git.log(limit?)
ctx.git.blame(file, line?)

// Search
ctx.search.grep(pattern, glob?)
ctx.search.symbols(query)

// Analysis
ctx.analyze.dependencies(file)
ctx.analyze.callGraph(fn)

Discover Tools

# Browse available tools (metadata only)
mcp__distill__discover_tools category="compress"

# Load tools when needed
mcp__distill__discover_tools category="compress" load=true

# TOON format for compact output
mcp__distill__discover_tools format="toon"

CLI Commands

distill-mcp setup          # Auto-configure detected IDEs
distill-mcp setup --claude # Configure Claude Code only
distill-mcp setup --cursor # Configure Cursor only
distill-mcp doctor         # Verify installation
distill-mcp serve          # Start MCP server
distill-mcp analyze        # Analyze codebase token usage
distill-mcp --help         # Show help

IDE Configuration

Claude Code

After running distill-mcp setup, your config will include:

{
  "mcpServers": {
    "distill": {
      "command": "npx",
      "args": ["distill-mcp", "serve"]
    }
  }
}

Cursor / Windsurf

Configuration is automatically added to the appropriate settings file.

Token Overhead

Distill uses lazy loading to minimize overhead:

ModeTokensDescription
Core only264Default (4 tools)
All tools1,108Full suite (21 tools)
Savings76%Lazy vs eager loading

Security

Code execution runs in a sandboxed environment:

  • Blocked: eval, require, import(), process, global
  • File access restricted to working directory
  • Sensitive files blocked (.env, credentials, keys)
  • Memory limit: 128MB, Timeout: 30s

Development

# Install dependencies
bun install

# Run tests
bun run test

# Build
bun run build

# Start dev server
bun run dev

Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines.

Priority areas:

  • New language parsers (Java, C#, Kotlin)
  • SDK extensions
  • Documentation

License

MIT

npm · GitHub · Documentation

Keywords

mcp

FAQs

Package last updated on 05 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts