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

five-whys-mcp-server

v1.0.2

Published

MCP server implementing the 5 whys methodology for root cause analysis

Readme

Five Whys MCP Server

A Model Context Protocol (MCP) server that implements the 5 Whys methodology for systematic root cause analysis. This tool helps developers and problem-solvers identify the root cause of issues through structured questioning.

What is the 5 Whys Methodology?

The 5 Whys is a problem-solving technique that involves asking "why" repeatedly (typically 5 times) to drill down to the root cause of a problem. It's particularly effective for:

  • Debugging complex software issues
  • Understanding system failures
  • Identifying process bottlenecks
  • Analyzing user experience problems
  • Investigating production incidents

Features

  • Interactive Analysis: Guides you through the 5 Whys process step by step
  • State Management: Maintains analysis state across multiple interactions
  • Multiple Export Formats: Export results as Markdown, JSON, or plain text
  • Root Cause Identification: Automatically identifies the root cause after completion
  • Reset & Restart: Easily start fresh analyses
  • MCP Integration: Works seamlessly with Claude and other MCP-compatible tools

Installation

Prerequisites

  • Node.js 18 or higher
  • npm or yarn

Install the Package

npm install five-whys-mcp-server

Add to Claude Code

Option 1: Automatic Installation (Recommended)

Use the Claude CLI command to add the server automatically:

claude mcp add five-whys npx five-whys-mcp-server # For local installation
claude mcp add -s user five-whys npx five-whys-mcp-server # user scope

This command will:

  • Add the server to your Claude configuration
  • No manual file editing required
  • Works with both Claude Desktop and Claude Code

Option 2: Manual Installation

  1. Open your Claude Desktop configuration file:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%/Claude/claude_desktop_config.json
  2. Add the server configuration:

{
  "mcpServers": {
    "five-whys": {
      "command": "npx",
      "args": ["five-whys-mcp-server"]
    }
  }
}
  1. Restart Claude Desktop

Usage

Once installed and configured, you can use the following tools in Claude Code:

1. Start a New Analysis

Ask Claude to start a 5 whys analysis with your problem statement:

Claude Code Examples:

"Start a 5 whys analysis for: The website is loading slowly for users"

"Help me analyze why our CI/CD pipeline keeps failing"

"I need to do a root cause analysis on this bug: Users can't log in after the latest update"

What happens:

  • Claude will use the start_five_whys tool
  • You'll get the first "why" question to answer
  • The analysis session begins

2. Answer Why Questions

Respond naturally to Claude's "why" questions during the analysis:

Claude Code Examples:

"The database queries are taking too long"

"Because there are no indexes on the user_activity table"

"The development team didn't know about indexing best practices"

What happens:

  • Claude uses the answer_why tool with your response
  • You get the next "why" question automatically
  • Progress is tracked (e.g., "Question 2/5")

3. Check Current State

Ask Claude to show your current progress:

Claude Code Examples:

"Show me the current state of my 5 whys analysis"

"What's my progress on the root cause analysis?"

"Can you display where we are in the analysis?"

What happens:

  • Claude uses the get_current_state tool
  • You see all questions and answers so far
  • Current progress and next steps are displayed

4. Export Results

Request your complete analysis in different formats:

Claude Code Examples:

"Export my 5 whys analysis as markdown"

"Give me the analysis results in JSON format"

"Can you export this as a text summary I can share with my team?"

Available formats:

  • markdown - Rich formatted document (default)
  • json - Structured data format
  • text - Plain text summary

What happens:

  • Claude uses the export_analysis tool
  • You get a complete formatted report
  • Perfect for documentation or sharing

5. Reset Analysis

Start fresh when needed:

Claude Code Examples:

"Reset the current analysis, I want to start over"

"Clear this analysis and let me begin with a new problem"

"Start fresh - I need to analyze a different issue"

What happens:

  • Claude uses the reset_analysis tool
  • All current progress is cleared
  • You can immediately start a new analysis

Complete Workflow Example

Here's how a typical session with Claude Code looks:

You: "Start a 5 whys analysis for: The website is loading slowly for users"

Claude: ✅ Analysis started successfully. Please answer the first 'why' question.

Current Analysis:

  • Problem: The website is loading slowly for users
  • Status: In Progress
  • Progress: 1/5 questions

Next Question: Why did this problem occur?

You: "The database queries are taking too long"

Claude: ✅ Answer recorded. Please answer the next 'why' question (2/5).

Questions & Answers:

  1. Why did this problem occur? → The database queries are taking too long

Next Question: Why did this happen?

You: "There are no indexes on frequently queried columns"

Claude: ✅ Answer recorded. Please answer the next 'why' question (3/5).

[continues until completion]

You: "Export this analysis as markdown"

Claude: [provides complete formatted analysis]

Example Analysis Session

1. Problem: "The website is loading slowly for users"
   
2. Why is the website loading slowly?
   → The database queries are taking too long
   
3. Why are the database queries taking too long?
   → There are no indexes on frequently queried columns
   
4. Why are there no indexes on frequently queried columns?
   → The database was not properly optimized during development
   
5. Why was the database not properly optimized during development?
   → There was no database performance review in the development process
   
6. Why was there no database performance review in the development process?
   → The development team lacks database optimization expertise

Root Cause: The development team lacks database optimization expertise

Available Tools

| Tool | Description | Parameters | |------|-------------|------------| | start_five_whys | Begin a new analysis | problem: string | | answer_why | Answer current question | answer: string | | get_current_state | Get analysis status | none | | export_analysis | Export results | format?: 'markdown' \| 'json' \| 'text' | | reset_analysis | Reset current analysis | none |

Development

Local Development

  1. Clone the repository
  2. Install dependencies: npm install
  3. Build the project: npm run build
  4. Start development mode: npm run dev

Testing

To test the MCP server locally:

# Start the server
npm start

# In another terminal, test with MCP inspector
npx @modelcontextprotocol/inspector http://localhost:3000

Configuration

The server runs on stdio transport by default, which is suitable for MCP integration. No additional configuration is required.

Troubleshooting

Common Issues

  1. Server not starting: Ensure Node.js 18+ is installed
  2. Tools not appearing in Claude: Check the configuration file path and restart Claude
  3. Permission errors: Make sure the package has execute permissions

Debug Mode

To run with debug output:

DEBUG=* npx five-whys-mcp-server

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

MIT License - see LICENSE file for details

Support

For issues and questions:

  • Open an issue on GitHub
  • Check the troubleshooting section
  • Review the MCP documentation

Built with the Model Context Protocol (MCP) for seamless integration with AI assistants.