File System Observer MCP server

Monitors file system changes and sends real-time notifications when watched files or directories are modified, enabling live document editing and configuration monitoring workflows.
Back to servers
Provider
Really Him
Release date
May 27, 2025
Language
TypeScript
Stats
3 stars

The MCP Observer Server allows real-time monitoring of file system changes and notifies connected MCP clients when files are modified. This creates a bridge between your local file system and AI assistants, enabling them to respond automatically to file changes without manual intervention.

Installation

Prerequisites

  • Python 3
  • uv (Python package manager)

Setup Instructions

  1. Clone the repository:
git clone https://github.com/username/mcp-observer-server.git
cd mcp-observer-server
  1. Install dependencies using uv:
uv pip install -r requirements.txt
  1. Create the watched file that will be monitored:
touch src/mcp_observer_server/watched.txt

Usage

Starting the Server

You can start the server using one of the following methods:

Using make:

make start

Or directly with npx:

npx @modelcontextprotocol/inspector uv run src/mcp_observer_server/server.py

Connecting with Inspector

  1. Open the Inspector client.
  2. Connect to the server using stdio (no additional configuration is needed).

Subscribing to File Changes

The server provides two main ways to subscribe to file changes:

Method 1: Using the Subscribe Tool

  1. Once connected, look for the "subscribe" tool in Inspector.
  2. Use the tool to specify the file or directory you want to monitor.
Path: /path/to/your/file.txt

Method 2: Through the Resources Interface

  1. Click on "List Resources" in Inspector.
  2. Find and select the file you want to monitor.
  3. Click the "Subscribe" button to start monitoring that resource.

Quick Subscription to Default File

The server provides a convenience tool to subscribe to the default watched file:

  1. Find and use the "subscribe_default" tool in Inspector.
  2. This will automatically subscribe you to the pre-configured file at src/mcp_observer_server/watched.txt.

Testing the Subscription

  1. After subscribing to a file, open that file in any text editor.
  2. Make changes to the file and save it.
  3. You should see a notification appear in the bottom-right panel of Inspector, indicating that the file has been modified.

Available Tools

The server provides the following tools:

  • subscribe: Subscribe to changes in a specific file or directory
  • subscribe_default: Subscribe to the default watched file
  • unsubscribe: Cancel a subscription to a file or directory

Practical Applications

The MCP Observer Server can be used for various tasks:

  • Automated documentation updates when code changes
  • Live code reviews with real-time feedback
  • Testing automation triggered by file modifications
  • AI assistance that responds to your changes automatically
  • Git commit automation based on file changes

Troubleshooting

If you don't see notifications:

  • Ensure you've successfully subscribed to the file
  • Verify the file path is correct
  • Make sure you're saving changes to the file
  • Check that the server is still running

Architecture

The server uses a lightweight implementation built on:

  • The Watchdog library for file system monitoring
  • MCP SDK for protocol handling
  • Thread-safe notification system
  • Simple path-to-session mapping for subscription management

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later