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

traceui-mcp

v0.2.1

Published

Static analysis for React/Next.js — MCP server for AI agents to understand frontend code without running it

Readme

TraceUI

Static analysis for React/Next.js — built for AI agents and developers who need to understand frontend code without running it.

npm version license tests typescript


Why TraceUI?

React DevTools is great — when you can run the app. But when you're:

  • Asking an AI agent to understand a component before editing it
  • Onboarding to an unfamiliar codebase
  • Doing code review without a local dev environment
  • Building tooling that needs to reason about UI logic

...you need something that works on source files, not a running browser.

TraceUI parses React components statically and outputs a compact, structured summary: states, effects, custom hooks, API calls, event flows, and file relationships — all in one JSON object (~2000–4000 tokens per file).

| | React DevTools | TraceUI | |---|---|---| | Requires running app | ✅ | ❌ | | Works on source files | ❌ | ✅ | | AI-friendly output | ❌ | ✅ | | Custom hook resolution | ❌ | ✅ | | Cross-file relationships | ❌ | ✅ |


Quick Demo

traceui analyze src/components/OrderList.js
{
  "file": "OrderList.js",
  "component": "OrderList",
  "states": [
    { "name": "orders", "setter": "setOrders", "init": "[]" },
    { "name": "openEdit", "setter": "setOpenEdit", "init": "false" }
  ],
  "effects": [
    { "deps": ["isSuperAdmin"], "body": "if (isSuperAdmin) { fetchPendingCount(); }" }
  ],
  "hooks": [
    {
      "name": "useOrders",
      "file": "useOrders.js",
      "apiCalls": ["fetchShippingOrders"],
      "exports": ["handleFilterChange", "refreshOrders"],
      "states": ["orders", "loading", "page"]
    }
  ],
  "flows": [
    {
      "on": "success",
      "handler": "inline:{setOpenEdit(false); refreshOrders()...}",
      "steps": ["setState:setOpenEdit", "hook:useOrders.refreshOrders → api:fetchShippingOrders"],
      "line": 476
    }
  ],
  "related_files": [
    { "file": "useOrders.js", "path": "/src/hooks/useOrders.js", "type": "hook" },
    { "file": "OrderTable.js", "path": "/src/components/OrderTable.js", "type": "component" }
  ],
  "used_by": [
    { "file": "OrderPage.js", "path": "/src/pages/OrderPage.js", "imports": ["OrderList"] }
  ]
}

Installation

# Via npx (no install needed)
npx traceui-mcp

# Or install globally
npm install -g traceui-mcp

Local development

# Clone
git clone https://github.com/philau2512/traceui-mcp.git
cd traceui-mcp

# Install dependencies
npm install

# Build
npm run build

# Link CLI globally (optional)
npm link

Usage

CLI

# Compact output (default — AI-friendly)
traceui analyze src/components/OrderList.js

# Full raw output
traceui analyze src/components/OrderList.js --raw

# Save to file
traceui analyze src/components/OrderList.js -f output.json

MCP Server (for AI agents)

TraceUI ships an MCP server with 2 tools that AI agents can call directly.

Config for Qwen Code / Claude Desktop:

{
  "mcpServers": {
    "traceui": {
      "command": "npx",
      "args": ["-y", "traceui-mcp@latest"]
    }
  }
}

Available tools:

| Tool | Description | |---|---| | traceui_analyze_file | Analyze a single React component file | | traceui_resolve_hook | Deep-dive into a custom hook — API calls, states, exports |

Example tool call:

{
  "tool": "traceui_analyze_file",
  "arguments": {
    "file_path": "/project/src/components/OrderList.js"
  }
}

Output Format

| Field | Description | |---|---| | file | Filename | | component | Component name | | states | useState calls — name, setter, init value | | effects | useEffect blocks — deps array + body summary | | hooks | Custom hook calls — resolved file, API calls, exports, internal states | | flows | UI event → handler → setState → API call chain | | related_files | Local imports with type (component / hook / util / constant) + absolute path | | used_by | Reverse lookup — which files import this component |

Alias resolution (@services/xxx, @components/xxx) is handled automatically via tsconfig.json / jsconfig.json.


MCP Workflow (AI Agent Example)

A typical AI agent workflow using TraceUI:

1. Agent receives task: "Add pagination to OrderList"

2. Agent calls: traceui_analyze_file("src/components/OrderList.js")
   → Learns: states, existing hooks, current flows

3. Agent calls: traceui_resolve_hook("src/hooks/useOrders.js")
   → Learns: fetchShippingOrders signature, page state, handleFilterChange

4. Agent now understands the full data flow before writing a single line

No guessing. No hallucinated function signatures. No "I'll need to see the full codebase."


Project Structure

src/
├── cli.ts                  # CLI entry point (Commander.js)
├── parser/
│   ├── visitors.ts         # AST visitors — states, effects, hooks, imports
│   ├── hook-resolver.ts    # Resolve + parse custom hook internals
│   ├── import-resolver.ts  # Alias resolution (tsconfig paths)
│   └── types.ts
├── formatter/
│   ├── compact.ts          # AI-friendly compact output
│   └── behavior.ts         # Flow/behavior extraction
├── flow/
│   └── analyzer.ts         # UI event → handler → API flow tracing
├── graph/
│   └── builder.ts          # Component relationship graph
└── mcp/
    ├── index.ts            # MCP server entry
    └── tools.ts            # Tool definitions

Roadmap

| Version | Status | Features | |---|---|---| | v0.1 | ✅ Done | Single file analysis, states, effects, API calls | | v0.2 | ✅ Done | Custom hook resolution, MCP server, alias resolution, used_by |


Contributing

Contributions are welcome. Here's how to get started:

git clone https://github.com/philau2512/traceui-mcp.git
cd traceui-mcp
npm install
npm run build
npm test          # 128 tests via Vitest

Good first issues:

  • Add support for useReducer state extraction
  • Improve useEffect body summarization
  • Add React Query (useQuery, useMutation) detection
  • Improve alias resolution for non-tsconfig projects

Before submitting a PR:

  • Run npm test — all tests must pass
  • Add tests for new parser features
  • Keep compact output format backward-compatible

Tech stack: TypeScript · ts-morph (AST) · Commander.js · MCP SDK · Vitest


License

MIT