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

har-mcp

v0.1.1

Published

MCP server for analyzing HAR (HTTP Archive) files with LLM-friendly output

Downloads

216

Readme

HAR MCP Server

An MCP (Model Context Protocol) server for analyzing HAR (HTTP Archive) files with LLM-friendly output.

Runtime Requirement: This server requires Bun >= 1.0.0.

Features

  • Multiple analysis modes: summary, list, detail, content, stats, timeline, size, cookies
  • Powerful filtering: URL patterns, HTTP methods, status codes, content types, duration, body content
  • Sorting & pagination: Sort by various fields, paginate large result sets
  • Export capabilities: Export entries as cURL commands
  • JSON output: Programmatic JSON output for integration
  • Chrome DevTools support: Full support for Chrome-exported HAR files with extension fields
  • Truncated HAR repair: Automatic recovery of truncated HAR files (common with large exports)

Installation

bun install

This server only supports Bun runtime.

Usage

With Claude Desktop

After installing from npm, use bunx:

{
  "mcpServers": {
    "har": {
      "command": "bunx",
      "args": ["har-mcp"]
    }
  }
}

For local development:

{
  "mcpServers": {
    "har": {
      "command": "bun",
      "args": ["run", "/path/to/har-mcp/src/index.ts"]
    }
  }
}

With OpenCode

After installing from npm, use bunx:

{
  "mcp": {
    "servers": {
      "har": {
        "type": "local",
        "command": ["bunx", "har-mcp"]
      }
    }
  }
}

For local development:

{
  "mcp": {
    "servers": {
      "har": {
        "type": "local",
        "command": ["bun", "run", "/path/to/har-mcp/src/index.ts"]
      }
    }
  }
}

With MCP Inspector

npx @modelcontextprotocol/inspector bun run src/index.ts

Tools

read_har

Reads and analyzes HAR files with multiple output modes.

Parameters:

| Parameter | Type | Description | | ---------- | -------- | ---------------------------------------------------------- | | path | string | Required. Path to the HAR file | | mode | string | Output mode (default: "summary") | | filter | object | Filter criteria | | sort | object | Sorting options | | page | number | Page number for pagination (default: 1) | | pageSize | number | Entries per page (default: 20, max: 100) | | entries | number[] | Specific entry indexes (required for content/detail modes) | | format | string | Output format: "markdown" or "json" |

Output Modes:

| Mode | Description | | ---------- | ------------------------------------------------------------------ | | summary | Overview statistics (total entries, methods, status codes, timing) | | list | Paginated entry list with basic info | | detail | Full metadata for specific entries (headers, timing, query params) | | content | Response/request bodies for specific entries | | stats | Aggregate statistics grouped by endpoint | | timeline | Text-based waterfall visualization | | size | Payload size analysis | | cookies | Cookie propagation tracking |

Filter Options:

| Filter | Type | Description | | -------------- | -------------------------- | --------------------------------------------------------- | | url | string | URL pattern (substring, glob with *, or ~regex) | | method | string | string[] | HTTP method(s) to filter | | status | number | string | object | Status code, pattern (e.g., "4xx"), or range {min, max} | | contentType | string | Response content type filter | | minDuration | number | Minimum request duration in ms | | hasError | boolean | Filter to errors only (4xx/5xx) | | bodyContains | string | Filter by response body content |

Sort Options:

| Field | Description | | ---------- | -------------------------- | | index | Original order in HAR file | | time | Request start time | | duration | Request duration | | size | Response size | | status | HTTP status code |

Examples:

// Get summary of a HAR file
read_har(path: "/path/to/file.har")

// List all POST requests
read_har(path: "...", mode: "list", filter: { method: "POST" })

// Find slow requests (over 1 second)
read_har(path: "...", mode: "list", filter: { minDuration: 1000 }, sort: { by: "duration", order: "desc" })

// Get response body for first two entries
read_har(path: "...", mode: "content", entries: [0, 1])

// Find requests matching URL pattern
read_har(path: "...", mode: "list", filter: { url: "*/api/*" })

// Filter by regex
read_har(path: "...", mode: "list", filter: { url: "~\\.json$" })

// Find errors
read_har(path: "...", mode: "list", filter: { hasError: true })

// Filter by status range
read_har(path: "...", mode: "list", filter: { status: { min: 400, max: 499 } })

// Analyze request sizes
read_har(path: "...", mode: "size")

// View timeline waterfall
read_har(path: "...", mode: "timeline")

// Track cookies
read_har(path: "...", mode: "cookies")

// Get JSON output
read_har(path: "...", mode: "summary", format: "json")

export_har_curl

Export HAR entries as cURL commands for replay or debugging.

Parameters:

| Parameter | Type | Description | | ---------------- | -------- | --------------------------------------- | | path | string | Required. Path to the HAR file | | entries | number[] | Required. Entry indexes to export | | includeHeaders | boolean | Include request headers (default: true) | | includeCookies | boolean | Include cookies (default: false) | | compressed | boolean | Add --compressed flag | | verbose | boolean | Add -v flag |

Example:

// Export first request as cURL
export_har_curl(path: "/path/to/file.har", entries: [0])

// Export with cookies and verbose output
export_har_curl(path: "...", entries: [0, 1], includeCookies: true, verbose: true)

Browser Compatibility

This MCP server fully supports HAR files exported from:

  • Chrome DevTools - Including all Chrome-specific extension fields (_initiator, _priority, _resourceType, _transferSize, _workerRespondWithSettled, etc.)
  • Firefox DevTools - Standard HAR 1.2 format
  • Safari Web Inspector - Standard HAR format
  • Other tools - Any HAR 1.2 compliant export

Truncated HAR Repair

Large HAR files exported from browsers can sometimes be truncated (incomplete JSON). This server automatically detects and repairs truncated HAR files by:

  1. Finding the last complete HTTP entry
  2. Reconstructing valid JSON structure
  3. Displaying a warning with the number of recovered entries

When a truncated file is repaired, you'll see a warning like:

⚠️ **Warning**: HAR file was truncated and has been repaired.
Recovered 182 entries using chrome-timings repair method.
Some entries at the end of the file may be missing.

Development

bun start        # Run the server
bun test         # Run tests
bun lint         # Check code style
bun format       # Format code

Project Structure

src/
├── index.ts          # Entry point - stdio transport setup
├── server.ts         # MCP server configuration and tool registration
└── tools/
    └── har/
        ├── index.ts  # Tool exports and registration
        ├── schema.ts # Zod schemas for input validation
        └── modes/    # Output mode implementations

License

MIT