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

claude-ops-mcp

v0.1.0

Published

MCP server for managing Claude Code operation history

Readme

claude-ops-mcp

MCP server that indexes Claude Code operation history (file edits/writes, Bash runs, reads) from local Claude Desktop logs and exposes it as queryable tools. Designed to help agents inspect what happened, generate diffs, and assist with rollback or failure analysis.

Status: early preview. Planned to be published to npm; for now, install from source.

Features

  • Operation history indexing: parses Claude Desktop JSONL session logs under ~/.claude/projects/*.
  • File-change queries: list recent creates/updates/deletes for any file or glob-like pattern.
  • Bash history: list commands with summaries, then drill down to stdout/stderr details.
  • Diff views: retrieve detailed diffs for Edit/Write/MultiEdit operations in a unified format.
  • Session discovery: automatically locates the active session via Claude’s tool-use metadata.
  • MCP-first: communicates over stdio and advertises tools via the Model Context Protocol.

How It Works

  • Claude Desktop writes session logs per project at ~/.claude/projects/<projectHash>/<sessionId>.jsonl.
  • When this server initializes, it emits a session UID and can later resolve the correct session using the tool-use id (_meta["claudecode/toolUseId"]) that Claude passes to MCP tools.
  • Handlers parse the JSONL log stream, map operations to a compact index (OperationIndex), and provide detailed diffs on demand.
  • Supported MCP protocol version: 2024-11-05.

Requirements

  • Node.js >= 18
  • Claude Desktop (or another MCP client) running on the same machine

Installation

Planned npm distribution:

npm install -g claude-ops-mcp   # not yet published

From source (current way):

git clone https://github.com/pppp606/claude-ops-mcp.git
cd claude-ops-mcp
npm ci
npm run build

Configure With Claude Desktop

Option A — after global npm install (once published):

{
  "mcpServers": {
    "claude-ops-mcp": {
      "command": "claude-ops-mcp",
      "args": [],
      "env": {}
    }
  }
}

Option B — from this repo’s build (today):

{
  "mcpServers": {
    "claude-ops-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/claude-ops-mcp/dist/index.js"],
      "env": {}
    }
  }
}

Place the JSON into Claude Desktop’s MCP configuration (see your Claude version’s docs). A minimal generic .mcp.json entry for other clients is provided in .mcp.example.json.

Available Tools

The server advertises these tools via MCP’s list_tools:

  1. listFileChanges
  • Input: { filePath: string, limit?: number }
  • Returns: recent non-READ file operations (CREATE/UPDATE/DELETE) matching the path or pattern.

Example response:

{
  "operations": [
    {
      "id": "toolu_01UGt...",
      "timestamp": "2025-01-01T12:34:56.789Z",
      "tool": "Edit",
      "filePath": "/path/to/project/src/index.ts",
      "summary": "Edit operation on /path/to/project/src/index.ts",
      "changeType": "update"
    }
  ],
  "totalCount": 1,
  "hasMore": false,
  "limit": 100,
  "filePath": "src/index.ts"
}
  1. listBashHistory
  • Input: { limit?: number }
  • Returns: recent Bash commands with concise summaries.

Example response:

{
  "commands": [
    {
      "id": "toolu_01Vabc...",
      "timestamp": "2025-01-01T12:35:01.000Z",
      "command": "npm test",
      "exitCode": 0,
      "workingDirectory": "/path/to/project",
      "summary": "PASS src/foo.test.ts"
    }
  ],
  "totalCount": 3,
  "hasMore": false,
  "limit": 100
}
  1. showBashResult
  • Input: { id: string } (use an id returned by listBashHistory)
  • Returns: stdout/stderr and exit code for the specific Bash operation.

Example response:

{
  "id": "toolu_01Vabc...",
  "timestamp": "2025-01-01T12:35:01.000Z",
  "command": "npm test",
  "exitCode": 0,
  "workingDirectory": "/path/to/project",
  "stdout": "PASS src/foo.test.ts\n...",
  "stderr": ""
}
  1. showOperationDiff
  • Input: { id: string } (use an id returned by listFileChanges or listBashHistory)
  • Returns: tool-specific diff details. For Edit/Write/MultiEdit, includes oldString, newString, and a unified diff; for Bash, includes stdout, stderr, and exitCode.

Example (Edit/Write style):

{
  "id": "toolu_01UGt...",
  "timestamp": "2025-01-01T12:34:56.789Z",
  "tool": "Edit",
  "filePath": "/path/to/project/src/index.ts",
  "diff": {
    "oldString": "console.log('old')",
    "newString": "console.log('new')",
    "unified": "--- /path/to/project/src/index.ts\n+++ /path/to/project/src/index.ts\n- console.log('old')\n+ console.log('new')\n"
  },
  "_debug": {
    "hasToolResult": true
  }
}

Notes on Session Discovery

  • Primary path: the server expects Claude to pass _meta["claudecode/toolUseId"] with each tool call; it uses this to find the active session file and caches it for subsequent calls.
  • Fallbacks: the server can also discover the most recent session for the current project path, but toolUseId-based discovery is the most reliable.
  • Cache: discovery results are cached in-memory; tune TTL with CLAUDE_OPS_CACHE_TTL_MS (milliseconds).

Environment Variables

  • CLAUDE_OPS_CACHE_TTL_MS: override the session discovery cache TTL in milliseconds.

Development

Scripts:

npm run dev          # run with tsx (stdio MCP)
npm run build        # compile to dist/
npm test             # run Jest tests
npm run lint         # eslint
npm run format       # prettier
npm run ci           # typecheck + lint + coverage + build

Local MCP config examples:

  • .mcp.example.json (generic MCP client)
  • claude_desktop_config.example.json (Claude Desktop)

Dependency Management

This repository consolidates dependency updates and security checks to keep CI signal clean:

  • Weekly npm updates: single PR grouping all patch/minor updates; majors ignored by default
  • Monthly GitHub Actions updates: single PR grouping all actions
  • PR-time Dependency Review: blocks introducing known vulnerabilities (requires Dependency graph enabled)
  • CI npm audit: production dependencies only, threshold moderate

See docs/dependency-management.md for details and how to adjust thresholds and schedules.

Roadmap

This project targets the goals described in issue #1:

  • MCP server foundation, session log identification via UID/toolUseId
  • Operation index API and detailed diff API
  • File change and Bash history APIs with unified diff format
  • Future: rollback helpers, performance tuning, security hardening

Security and Privacy

  • Reads local Claude logs only; does not send data to external services.
  • Standard file access permissions apply; no elevated privileges are required.

License

MIT