npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mcp-bundle-analyzer

v0.1.0

Published

MCP server — analyze frontend bundle sizes and find optimization opportunities

Downloads

130

Readme

@mcp-devtools/bundle-analyzer

MCP server — analyze webpack and Vite bundle sizes, detect duplicate packages, identify tree-shaking opportunities, and compare builds.

Install

npm install -g @mcp-devtools/bundle-analyzer

Generate a stats file

Webpack:

npx webpack --json > stats.json

# For module-level analysis (find_large_modules, detect_duplicate_packages, analyze_tree_shaking):
npx webpack --stats=verbose --json > stats.json

Vite — add rollup-plugin-visualizer to vite.config.ts:

import { visualizer } from 'rollup-plugin-visualizer'

export default defineConfig({
  plugins: [visualizer({ filename: 'stats.json', json: true })]
})

Add to Claude Desktop

~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "bundle-analyzer": {
      "command": "mcp-bundle-analyzer"
    }
  }
}

Restart Claude Desktop after editing the config.

Tools

analyze_bundle

Analyze a webpack stats.json, rollup-plugin-visualizer JSON, or dist/ directory. Auto-detects the format.

path: string  — Path to stats.json, visualizer JSON, or dist/ directory

Returns total size, JS/CSS asset breakdown, top 20 modules by size, and optimization suggestions.


find_large_modules

Find modules exceeding a size threshold. Requires module data (--stats=verbose).

stats_path: string       — Path to stats.json or visualizer JSON
threshold_kb?: number    — Size threshold in KB (default: 50)

Returns modules grouped by vendor vs. app code with import context.


detect_duplicate_packages

Find npm packages bundled at multiple versions. Common when dependencies have conflicting peer requirements.

stats_path: string  — Path to stats.json (--stats=verbose) or visualizer JSON

Returns duplicate packages with all instance paths, wasted size estimate, and fix guidance (npm dedupe, overrides, webpack alias).


analyze_tree_shaking

Identify tree-shaking opportunities: CommonJS modules that can't be eliminated, webpack optimization bailouts, and partially used modules (barrel file suspects).

stats_path: string  — Path to webpack stats.json

For full analysis, set optimization: { usedExports: true } in your webpack config and run with --stats=verbose.


compare_bundles

Diff two builds to measure the impact of a change.

before_path: string  — Path to baseline stats.json
after_path: string   — Path to new stats.json

Returns total JS size diff, changed/added/removed assets with size percentages.

Example prompts

"Analyze the bundle at ./dist/stats.json — what's making it large?"

"Find all modules larger than 100KB in my webpack build"

"Are there duplicate packages in my bundle?"

"Which packages can't be tree-shaken and why?"

"Compare my bundle before and after removing lodash"

Development

npm install
npm run build
npm run dev   # watch mode

License

MIT