Skip to main content
Glama
trycatchkamal

Filesystem Watcher MCP

Filesystem Watcher MCP

PyPI PyPI Downloads License: Apache 2.0 Python 3.10+

filesystemwatcher-mcp lets your AI coding agent (Gemini, Claude, Cursor, Copilot, etc.) watch directories for live file-system changes. It acts as a Model Context Protocol (MCP) server, giving your agent event-driven access to file creations, modifications, deletions, and moves — without busy-polling.

Key features

  • Event-driven file watching: Uses Watchdog for cross-platform native OS events (inotify, FSEvents, ReadDirectoryChangesW).

  • Safe by design: Blocks watching system-critical paths on Windows, macOS, and Linux. Strict path guardrails are enforced server-side.

  • Flexible filtering: Filter events by file extension, glob pattern, or event type (created, modified, deleted, moved).

  • Debounced events: Rapid successive events on the same file are coalesced over a 500 ms window — no duplicate noise.

  • Consume-once semantics: poll_events drains the queue, making it easy to integrate into agent loops.

  • Explicit error surfacing: All failure modes (permission denied, OS backend crash, watch limit) return structured {"success": false, "error": "..."} responses rather than crashing silently.

Related MCP server: File Operations MCP Server

Requirements

  • Python 3.10 or newer.

  • uv (recommended) or pip.

Getting started

Add the following config to your MCP client:

{
  "mcpServers": {
    "filesystemwatcher": {
      "command": "uv",
      "args": ["run", "python", "src/server.py"]
    }
  }
}
NOTE

Make sure you have cloned the repository and installed dependencies (uv sync) before pointing your MCP client at the server.

MCP Client configuration

To use the Filesystem Watcher MCP server, follow the instructions from Antigravity's docs to install a custom MCP server. Add the following config to the MCP servers config:

{
  "mcpServers": {
    "filesystemwatcher": {
      "command": "uv",
      "args": ["run", "python", "src/server.py"]
    }
  }
}

Use the Claude Code CLI to add the server (guide):

claude mcp add filesystemwatcher --scope user uv run python src/server.py

Follow the MCP install guide and use the standard config from above.

Go to Cursor Settings -> MCP -> New MCP Server. Use the config provided above.

gemini mcp add filesystemwatcher uv run python src/server.py

Alternatively, follow the MCP guide and use the standard config from above.

Your first prompt

Enter the following prompt in your MCP client to check if everything is working:

Watch my home directory for any new file creations and tell me when something appears.

Your agent should call watch_directory and then periodically call poll_events to report changes.

Tools

watch_directory

Start watching a directory for file system events. Returns a watch_id used to identify this watch session.

Argument

Type

Default

Description

path

str

required

Absolute path to the directory to watch

recursive

bool

false

Also watch all subdirectories

extensions

list[str]

null

Filter by extension, e.g. [".py", ".js"]

pattern

str

null

Glob pattern matched against file name, e.g. "*.log"

ignore_patterns

list[str]

null

Glob patterns to exclude, e.g. ["*.tmp", ".git/*"]

event_types

list[str]

null

Subset of ["created", "modified", "deleted", "moved"]

Error responses — on failure success is false and error explains why:

Condition

Example error

Path blocked by safety guardrails

"Watching '/etc' is not allowed: protected system location."

Process lacks read permission

"Permission denied: cannot watch '/protected'. Check read access."

OS watcher backend failed to start

"Filesystem observer failed to start for '...'. Backend may be unavailable."

Concurrent watch limit reached

"Watch limit reached (50 active watches). Call unwatch() first."

poll_events

Drain and return queued file system events (consume-once semantics).

Argument

Type

Default

Description

watch_id

str

null

Filter events by watch ID; if omitted, all watches are drained

max_events

int

50

Maximum events to return (1–500)

If watch_id is provided but does not match any active watch, the response includes a warning field to prevent agents from silently spinning on a stale ID:

{
  "count": 0,
  "events": [],
  "warning": "No active watch found with id 'abc-123'. Use list_active_watches to see current watch IDs."
}

list_active_watches

Return a summary of all currently active watches.

unwatch

Stop and remove a watch by watch_id.

Configuration

The server currently has no command-line flags; all configuration is done via the tool arguments at runtime.

You can inspect available tools interactively with the MCP Inspector:

npx @modelcontextprotocol/inspector mcp dev src/server.py

Safety guardrails

The server blocks watching dangerous system paths:

Platform

Blocked (exact)

Blocked (subtree)

Windows

C:\

C:\Windows, C:\Program Files, C:\ProgramData

Linux

/

/etc, /sys, /proc, /usr, /dev, /boot, …

macOS

/

/System, /Library, /usr, /private, …

Watching C:\Users or /home directly is also blocked; individual user home directories are allowed.

Concurrent watch limit: A maximum of 50 active watches are allowed at any time to prevent exhausting the OS inotify quota. Call unwatch to free a slot before creating a new one.

WARNING

The MCP server exposes file-system event data to MCP clients. Avoid watching directories that contain sensitive or personal data you would not want shared with your AI agent.

Debouncing

Events are coalesced over a 500 ms window per (event_type, path) key. Rapid successive events on the same file (e.g. multiple writes during a save) are reported as a single event.

Development

# Clone and install dependencies
git clone https://github.com/your-org/filesystemwatcher-mcp
cd filesystemwatcher-mcp
uv sync

# Run the server directly
uv run python src/server.py

# Run with MCP Inspector
npx @modelcontextprotocol/inspector mcp dev src/server.py

# Run tests
uv run pytest

# Security audit
uv run pip-audit

Known limitations

  • Only local file systems are supported; network mounts may not deliver native OS events reliably.

  • The server must be restarted to pick up changes to ignored/blocked path configuration.

Available Tools

4 tools
list_active_watchesA

Return a list of all currently active directory watches.

Each entry includes the watch_id, path, recursive flag, and created_at Unix timestamp.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.8/5.0
Behavior3/5

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

With no annotations, the description carries the full burden. It describes the output fields but does not disclose read-only nature, authentication needs, or any side effects. The tool name implies read-only behavior, but this is not explicit.

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 two sentences, front-loaded with the purpose, then listing output fields. 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?

For a simple list tool with no parameters and an output schema, the description covers the essential return fields. It lacks mention of how this relates to sibling tools like watch_directory, but overall is complete for its complexity.

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 no parameters, so the schema coverage is trivially 100%. Baseline for zero parameters is 4, and the description does not need to add parameter information.

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 returns a list of active directory watches and specifies the fields included in each entry. It distinguishes from sibling tools like poll_events, unwatch, and watch_directory by focusing on listing active watches.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. The description does not mention prerequisites, exclusions, or context for selecting this tool over siblings.

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

poll_eventsA

Drain and return queued file system events.

Events are removed from the queue once returned (consume-once semantics). Call repeatedly to receive all pending events.

ParametersJSON Schema
NameRequiredDescriptionDefault
watch_idNoOptional watch_id to filter results. If omitted, events from all active watches are returned.
max_eventsNoMaximum number of events to return in a single call (1–500, default 50).

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4/5.0
Behavior3/5

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

With no annotations, the description must disclose behavioral traits. It covers consume-once semantics and the need to call repeatedly, but omits details like blocking/non-blocking, rate limits, or error conditions. This is adequate but not comprehensive.

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 two concise sentences that front-load the core purpose and add necessary usage guidance 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?

The description covers core behavior (consume-once, repeated calls, optional filters). The presence of an output schema (not shown) reduces the need to describe return values. Slightly lacking in edge-case details, but sufficient for a polling tool.

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

Parameters3/5

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

Schema coverage is 100%, so the description adds no new meaning beyond the parameter descriptions in the input schema. Baseline score of 3 applies as the schema already documents parameters fully.

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 explicitly states the action ('Drain and return') and the resource ('queued file system events'), and clearly differentiates from sibling tools that manage watches (list_active_watches, unwatch, watch_directory).

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 advises calling repeatedly to receive all events, which implies polling behavior. While it doesn't explicitly contrast with siblings, the context of the tool name and siblings makes usage clear.

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

unwatchB

Stop and remove an active directory watch.

ParametersJSON Schema
NameRequiredDescriptionDefault
watch_idYesThe watch_id returned by watch_directory.

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

B3.3/5.0
Behavior2/5

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

The description only states the action without revealing side effects, reversibility, or behavior like stopping event delivery. With no annotations, the description bears the full burden and provides minimal transparency.

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?

A single, front-loaded sentence concisely communicates the tool's purpose with no unnecessary words.

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

Completeness3/5

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

For a simple tool with one parameter and a clear output schema, the description is adequate but lacks completeness in terms of usage context, side effects, and error conditions.

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

Parameters3/5

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

The schema covers 100% of parameters with a description that matches the tool's description. The description adds no new semantic value beyond the schema, meeting the baseline for high schema coverage.

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 explicitly states the verb 'stop and remove' and the resource 'active directory watch', making the tool's purpose clear and distinct from siblings: watch_directory creates, list_active_watches lists, poll_events polls events.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives, or on prerequisites such as the watch being active. The agent must infer usage from context.

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

watch_directoryB

Start watching a directory for file system events.

Returns a watch_id that can be used with poll_events and unwatch.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to the directory to watch.
recursiveNoIf True, also watch all subdirectories recursively.
extensionsNoOptional list of file extensions to include, e.g. [".py", ".js"]. If omitted, all extensions are reported.
patternNoOptional glob pattern matched against the file *name*, e.g. "*.log". Applied in addition to (not instead of) the extensions filter.
ignore_patternsNoOptional glob patterns to exclude, e.g. ["*.tmp", ".git/*"]. Matched against both the file name and its full path.
event_typesNoOptional subset of event types to report. Valid values: "created", "modified", "deleted", "moved". If omitted, all event types are reported.

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

B3.3/5.0
Behavior2/5

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

With no annotations, the description carries full burden but only states 'start watching' and the return value. No disclosure of side effects, permissions, resource usage, or failure modes (e.g., directory not found).

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

Conciseness4/5

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

The description is concise (two sentences), front-loaded with the main action, and avoids repetition. It could include more useful context, but is appropriately sized.

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

Completeness2/5

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

Given the tool's complexity (6 parameters, output schema exists, sibling tools), the description lacks guidance on the watch lifecycle, asynchronous behavior, and how the watch_id integrates with other tools. It is incomplete for a tool that requires follow-up steps.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all parameters. The description adds no extra meaning beyond the schema, earning the baseline score of 3.

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 action ('Start watching a directory') and the resource ('file system events'), and distinguishes itself from sibling tools (list_active_watches, poll_events, unwatch) by initiating the watch.

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?

The description mentions that the returned watch_id is used with poll_events and unwatch, implying the workflow, but does not explicitly state when to use or not use this tool, nor does it provide alternatives or prerequisites.

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

TDQS

A3.9/5.0
Disambiguation5/5

Each tool has a distinct purpose: starting, listing, polling, and stopping watches. No overlap or ambiguity.

Naming Consistency4/5

All tools use verb_noun snake_case pattern. 'unwatch' is slightly non-standard but still clear and consistent.

Tool Count5/5

4 tools is appropriate for a filesystem watcher, covering all essential operations without being too many or too few.

Completeness5/5

Covers full lifecycle: create (watch_directory), read (list_active_watches, poll_events), delete (unwatch). No obvious gaps for basic watching.

Maintenance

ActivityInactive
ResponsivenessNo issues

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

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/trycatchkamal/filesystemwatcher-mcp'

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