Filesystem Watcher MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Filesystem Watcher MCP Watch /home/user/projects for modified .py files"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Filesystem Watcher MCP
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_eventsdrains 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
Getting started
Add the following config to your MCP client:
{
"mcpServers": {
"filesystemwatcher": {
"command": "uv",
"args": ["run", "python", "src/server.py"]
}
}
}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.pyFollow 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.pyAlternatively, 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
File system watching (4 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 |
|
| required | Absolute path to the directory to watch |
|
|
| Also watch all subdirectories |
|
|
| Filter by extension, e.g. |
|
|
| Glob pattern matched against file name, e.g. |
|
|
| Glob patterns to exclude, e.g. |
|
|
| Subset of |
Error responses — on failure success is false and error explains why:
Condition | Example error |
Path blocked by safety guardrails |
|
Process lacks read permission |
|
OS watcher backend failed to start |
|
Concurrent watch limit reached |
|
poll_events
Drain and return queued file system events (consume-once semantics).
Argument | Type | Default | Description |
|
|
| Filter events by watch ID; if omitted, all watches are drained |
|
|
| 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.pySafety guardrails
The server blocks watching dangerous system paths:
Platform | Blocked (exact) | Blocked (subtree) |
Windows |
|
|
Linux |
|
|
macOS |
|
|
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.
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-auditKnown 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 toolslist_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.
Inputs: no named parameters. Returns: object
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.
Inputs: watch_id, max_events. Returns: object
unwatchB
Stop and remove an active directory watch.
Inputs: watch_id (required). Returns: object
watch_directoryB
Start watching a directory for file system events.
Returns a watch_id that can be used with poll_events and unwatch.
Inputs: path (required), recursive, extensions, pattern, +2 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a distinct purpose: starting, listing, polling, and stopping watches. No overlap or ambiguity.
All tools use verb_noun snake_case pattern. 'unwatch' is slightly non-standard but still clear and consistent.
4 tools is appropriate for a filesystem watcher, covering all essential operations without being too many or too few.
Covers full lifecycle: create (watch_directory), read (list_active_watches, poll_events), delete (unwatch). No obvious gaps for basic watching.
Maintenance
Related MCP Connectors
Securely search and manage workspace context files for AI agents and teams.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Shared project context for AI agents and teams: docs, tasks, and messages that stay current.
Browse and manage files in your Moxt AI workspace from any MCP client.
Related MCP Servers
- AlicenseDqualityDmaintenanceEnables AI models to perform file system operations (reading, creating, and listing files) on a local file system through a standardized Model Context Protocol interface.3ISC
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables enhanced file system operations including reading, writing, copying, moving files with streaming capabilities, directory management, file watching, and change tracking.22MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to securely browse, search, inspect, and understand local project files through Model Context Protocol tools.1MIT
- FlicenseNot gradedqualityDmaintenanceProvides sandboxed file system tools (read, write, search, list, watch) over the Model Context Protocol, enabling resume matching and analysis workflows via an agent.-