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 🙏

© 2025 – Pkg Stats / Ryan Hefner

locker-mcp

v1.0.0

Published

MCP server for file locking and access control for AI code tools

Readme

Locker-MCP

A minimal Model Context Protocol (MCP) server for file locking and access control in AI code tools.

Overview

Locker-MCP prevents AI coding agents from repeatedly editing the same files by tracking file lock states and providing context-aware access control. When a file is "done," the LLM locks it via MCP, adding a comment header and saving metadata to prevent accidental changes.

Features

  • File State Management: Track files as unlocked, locked-context, or locked
  • Context Tracking: Store purpose/context descriptions for locked files
  • Self-Evaluation: LLMs must assess confidence (0-100%) before editing locked-context files
  • Audit Trail: Complete history of state transitions with timestamps
  • Security: Path validation and local-only operation

Installation

npm install locker-mcp

Usage

As MCP Server

Start the server for use with MCP clients:

npx locker-mcp

Programmatic Usage

import { Locker } from 'locker-mcp';

const locker = new Locker();

// Lock a file with context
const result = locker.lockFile({
  filePath: 'src/auth.ts',
  context: 'Authentication module implementation'
});

// Check file state
const state = locker.getFileState({ filePath: 'src/auth.ts' });
console.log(state.state); // 'locked-context'

// Update file context
locker.updateFile({
  filePath: 'src/auth.ts',
  context: 'Enhanced authentication with 2FA',
  state: 'locked-context'
});

// Finalize file (no further edits)
locker.finalizeFile('src/auth.ts');

MCP Tools

The server exposes these tools for MCP clients:

  • getFileState: Check current lock state of a file
  • lockFile: Lock a file with context description
  • unlockFile: Remove lock state from a file
  • updateFile: Update file context and/or state
  • finalizeFile: Mark file as fully locked
  • getAllTrackedFiles: List all tracked files

File States

  • unlocked: No restrictions, normal editing allowed
  • locked-context: Locked with context, editable only if change aligns with context (≥80% confidence)
  • locked: Fully locked, no edits allowed

Workflow Example

  1. LLM completes work on a file
  2. LLM calls lockFile with file path and context description
  3. Locker adds // LOCKED: <UUID> STATE=locked-context comment to file
  4. Metadata saved to .reporepo/locker/locker.json
  5. Future edit attempts require confidence assessment
  6. If confidence ≥80%, edit proceeds; otherwise rejected

Development

# Install dependencies
npm install

# Build
npm run build

# Run tests
npm test

# Run with coverage
npm run test:coverage

# Lint
npm run lint

File Structure

.reporepo/locker/
└── locker.json    # Metadata with file states and history

Each entry contains:

  • filePath: File path
  • id: Unique identifier (UUID)
  • state: Current lock state
  • context: Purpose description
  • history: Array of state changes with timestamps

Security

  • All file operations are validated for path traversal attacks
  • Only local project files can be modified
  • No external network calls
  • User maintains full control over all operations

License

MIT