Skip to main content
Glama

mcp-lock-manager

An MCP server that provides file-level exclusive locking across multiple Claude Code instances. Prevents conflicts when multiple agents edit files in the same project simultaneously.

How It Works

When multiple Claude Code sessions share a project, they can clobber each other's edits. This MCP server acts as a mutex — each session acquires a lock before editing a file and releases it when done. Locks are stored in a local .locks/ directory using atomic filesystem operations.

Stale locks from crashed sessions are automatically detected via PID liveness checks and cleaned up.

Related MCP server: asynkor

Setup

1. Install & Build

git clone https://github.com/maxwellplanck/mcp-lock-manager.git
cd mcp-lock-manager
npm install
npm run build

2. Configure Claude Code

Add to your .claude/settings.json (project or user-level):

{
  "mcpServers": {
    "lock-manager": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-lock-manager/build/index.js", "--project-root", "/absolute/path/to/your/project"]
    }
  }
}

The --project-root flag tells the server which project directory to manage locks for. If omitted, it defaults to the current working directory.

You can also set the project root via environment variable:

{
  "mcpServers": {
    "lock-manager": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-lock-manager/build/index.js"],
      "env": {
        "PROJECT_ROOT": "/absolute/path/to/your/project"
      }
    }
  }
}

Tools

lock_acquire

Acquire exclusive locks on one or more files before editing.

Parameter

Type

Required

Description

paths

string[]

Yes

Project-relative file paths (use forward slashes)

owner

string

No

Label for this session (e.g. "Agent A")

Acquires all-or-nothing — if any file is already locked by another live session, the entire request fails with conflict details.

lock_release

Release file locks when done editing.

Parameter

Type

Required

Description

paths

string[]

No

Paths to release. Omit to release all locks for this session.

lock_list

List all active locks with owner, PID, alive status, and timestamp. Takes no parameters.

lock_cleanup

Force-remove all stale locks held by dead processes. Takes no parameters. Useful when lock_list shows locks with alive: false.

Adding to Your Workflow

For best results, add instructions to your project's CLAUDE.md telling Claude to use locks:

## File Locking

This project uses mcp-lock-manager for multi-session coordination.
Before editing any file, acquire a lock with `lock_acquire`. Release locks with `lock_release` when done.
If a lock conflict occurs, do not proceed — wait or ask the other session to release.

License

MIT

Available Tools

4 tools
lock_acquireA

Acquire exclusive file locks. Fails with conflict details if any path is held by another live session. Always call this before editing files.

ParametersJSON Schema
NameRequiredDescriptionDefault
ownerNoOptional label for this session (e.g. 'Agent A')
pathsYesProject-relative file paths to lock (use forward slashes)

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations, so description carries full burden. It discloses exclusivity and conflict failure mode, but doesn't specify lock lifecycle (e.g., auto-release).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with main purpose, no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Adequately covers tool purpose and behavior for a simple lock tool; could mention lock persistence, but sibling tools imply it.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

100% schema coverage; description adds context about path conflicts and exclusivity, enhancing understanding beyond schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool acquires exclusive file locks, distinguishing it from siblings like lock_release and lock_list.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit guidance: 'Always call this before editing files.' Implicitly indicates when to use, but doesn't contrast with alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

lock_cleanupA

Force-remove all stale locks (dead PIDs). Use when lock_list shows locks with alive: false.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must fully disclose behavioral traits. It says 'Force-remove,' indicating destructive action, but does not detail permissions, side effects, or behavior in edge cases (e.g., no stale locks). This is adequate for a simple tool but lacks depth.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at two sentences, with the action and usage guidance front-loaded. Every word adds value with no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter tool with clear sibling tools, the description is complete. It covers purpose and when to use, though it could optionally mention return values. The lack of output schema is acceptable given the tool's simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are zero parameters, and schema coverage is 100%. The description does not need to add parameter information. The baseline for 0 params is 4, and nothing is missing.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool removes stale locks (dead PIDs), differentiating it from siblings like lock_acquire, lock_list, and lock_release. It uses a specific verb and resource, with no ambiguity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage context: 'Use when lock_list shows locks with alive: false.' It implies the precondition but does not exclude other use cases or mention when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

lock_listA

List all current file locks with owner, PID, timestamp, and alive status.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Description mentions output fields (owner, PID, timestamp, alive status) but does not disclose behavioral details like permissions required, performance impacts, or whether it shows a snapshot. With no annotations, this is a minimal but acceptable disclosure for a simple read-only tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence that immediately states the action and output details. No wasted words, front-loaded with the verb and resource.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no parameters, no output schema, and a simple listing operation, the description fully covers what the tool does and what it returns. No missing information.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters exist, so schema coverage is automatically 100%. The description adds valuable information about what the tool outputs, which is beyond the empty schema. Baseline for 0 parameters is 4, and the description's detail on output fields elevates it to 5.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clear verb 'list' specifies the action precisely, and the resource is 'current file locks' with enumerated details (owner, PID, timestamp, alive status). Differentiates from siblings which are mutating actions (acquire, cleanup, release).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit usage guidance or alternatives provided. However, the name and description imply it is for viewing current locks, and sibling tools are all mutating, so the purpose is distinct. Missing explicit 'when to use' or 'when not to use' statements.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

lock_releaseA

Release file locks. If paths are omitted, releases ALL locks for this session.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathsNoPaths to release, or omit to release all locks for this session

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It discloses that omitting paths releases all locks for the session, which is critical behavioral context. It does not detail potential failure modes or return values, but for a simple release operation, this is adequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences: the first states the primary action, the second provides the key condition on parameter omission. No redundant words, perfectly front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simple structure (one optional parameter, no nested objects, no output schema), the description sufficiently covers the tool's behavior. Could mention error handling or return format, but not essential for this tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with a description for 'paths'. The description adds the semantic nuance that omitting the parameter releases all locks, which goes beyond the schema's field description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's action ('Release file locks') and distinguishes between releasing specific paths versus all locks for the session. This differentiates it from siblings like lock_acquire and lock_list.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains when to omit the 'paths' parameter (to release all locks for the session), providing clear context. However, it does not explicitly state when to use this tool versus alternatives, though the purpose is implied by the sibling names.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 4 tool updatesv1.0.0
    • First observedlock_acquire
    • First observedlock_cleanup
    • First observedlock_list
    • First observedlock_release

TDQS

A4.5/5.0
Disambiguation5/5

Each tool has a distinct purpose: acquire, release, list, and cleanup locks. No two tools overlap in functionality.

Naming Consistency5/5

All tools follow a consistent verb_noun pattern (e.g., lock_acquire, lock_list), making them highly predictable.

Tool Count5/5

Four tools cover the essential operations of a lock manager without unnecessary additions or gaps.

Completeness5/5

The set provides full lifecycle management: acquire, release (including bulk), list, and cleanup of stale locks. No obvious missing operations.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Coordination layer for AI coding agents working on the same codebase. Adds file locks, shared project memory, and cross-machine file sync so Claude Code, Cursor, Windsurf, and other MCP agents stop overwriting each other.
    50
    Apache 2.0

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/maxwellplanck/mcp-lock-manager'

If you have feedback or need assistance with the MCP directory API, please join our Discord server