Skip to main content
Glama
hesreallyhim

MCP Observer Server

by hesreallyhim

mcp-observer-server

mcp-observer-server is an MCP (Model Context Protocol) server that monitors file system events and provides real-time notifications to MCP clients. It acts as a (more bi-directional) bridge between your local file system and AI assistants like Claude Inspector, enabling them to respond to file changes automatically.

NOTE: This is a demo/POC of a file monitoring MCP server that I'm working on. I'm seeing a lot of questions/comments/Issues/Discussions about this kind of thing, so I wanted to post this minimal implementation to share my approach.

Context

The MCP protocol defines the notion of a resource subscription, wherein a client can request to be notified of any changes to a resource, and the server can choose to send notifications. Here is the flow diagram:

Resource Subscription Flow Diagram

The protocol says the client should then send a read request back to the server to read the changes. (All of this is optional, by the way). But, I find this a bit cumbersome, and involves an extra trip, and I'd rather have my resource-update notification describe the change as well. Fortunately, the SDK offers a meta/_meta field and you can pretty much send whatever you want. So I might want to send the number of lines changed, a diff of the changes, who knows what. I haven't implemented that in this demo, right now I'm just sending the timestamp. (I basically ripped everything out from the server except the minimum POC.) Also, it's just running on stdio transport, nothing fancy.

NOTE!!! I haven't tested this with any "real" MCP clients yet - my understanding is that very view clients actually support resource subscriptions, since it's optional anyway. However, fortunately Inspector is a very good client, and you can use that to test this server.

DEMO INSTRUCTIONS:

  1. Clone the repository.

  2. Install the dependencies using uv (or, some other way I suppose).

  3. Run the server using make start (uses uv) or run npx @modelcontextprotocol/inspector uv run src/mcp_observer_server/server.py.

  4. Open the Inspector client and connect using stdio, no configuration needed.

  5. Use the subscribe tool to monitor a directory or file, (alternatively, you can run "List Resources", click a resource, and then click "Subscribe" button to subscribe to it).

  6. By default, the server will expose a file called watched.txt in src/mcp_observer_server/watched.txt (the file is .gitignored, so you have to create it), but you can subscribe to other files as well. You can subscribe this file with the subscribe_default tool.

  7. Modify the watched.txt file (or whatever file you subscribed to), and you should see a server notification appear in the bottom-right panel of the Inspector. This is the POC established.

Related MCP server: File MCP Server

DEMO VISUALIZATION

  1. Start the server and connect with Inspector: Start Server and Connect

  2. List the default resources: List Resources

  3. List the tools: List Tools

  4. Subscribe to the default file: Subscribe to Default File

  5. Modify the file: Modify the File

  6. See the notification appear: See Notification

🎉

Server Description

The MCP Observer Server tracks file and directory changes on your system, allowing MCP clients to subscribe to these events and take action when files are created, modified, deleted, or moved (current demo handles modification event). This server implements the full Model Context Protocol specification, providing:

  • Real-time file monitoring: Using the Watchdog library for efficient file system observation

  • Subscription management: Create, list, and cancel monitoring subscriptions for any path

  • Change history: Maintains a log of recent changes for each subscription (omitted in demo)

  • File and directory access: Read file contents and directory listings through MCP resources

  • Stateless design: Clients control what happens in response to file changes

Key Features

  • Subscribe to changes in specific files, directories, or entire repositories

  • Filter events by file patterns or event types (omitted in demo)

  • Query recent changes to see what files were affected (omitted in demo)

  • Access file contents via resource endpoints

  • Lightweight and efficient implementation with minimal dependencies

  • Simple integration with any MCP-compatible client (...that support resource subscriptions)

Practical Applications

The main pain point I am trying to solve is that unless Claude Code, e.g., touches a file and writes the change to it itself, it has no idea what is going on in your repo/project. (You know those notifications - "File changeed since last read"?) Having a client or coding assistant that is actually monitoring what you're doing in your project and you don't have to delegate every task to Claude just so that it knows that it happens, seems tremendously useful to me. Some practical applications include:

  • Automated documentation updates: Keep documentation in sync with code changes - you update some code, Claude is notified of the change, and it pro-actively checks or updates the doc-strings, etc.

  • Live code reviews: Get real-time feedback on code changes as you work, catching spelling errors, type errors, etc., giving advice, true pair programming.

  • Testing automation: Run tests when relevant files are modified.

  • AI assistance: Enable AI tools to respond to file changes automatically.

  • Git commit automation: Do you forget to commit frequently enough? Claude can watch your changes and suggest (or perform) commit actions more frequently.

Current Implementation Design

The server implementation features a streamlined architecture that prioritizes simplicity, reliability, and maintainability.

Architecture Highlights

  1. Simplified Structure

    • Focused implementation (~170 lines of code)

    • Consolidated functionality into a small set of core components

    • Clean function-based design that leverages the MCP SDK directly

    • High readability and maintainability

  2. Efficient State Management

    • Simple dictionary structure maps paths to client sessions

    • Uses a watched dictionary for direct path-to-session mapping

    • Minimal state tracking with clear data flow

    • Avoids redundant data structures

  3. MCP Protocol Integration

    • Direct use of MCP SDK function decorators

    • Clean resource URI handling

    • Simplified server initialization with proper capability configuration

    • Direct notification delivery system

  4. Event Processing

    • Streamlined Watchdog event handler implementation

    • Direct event-to-notification path

    • Thread-safe communication via call_soon_threadsafe

    • Efficient event filtering

  5. Notification System

    • Direct use of MCP notification primitives

    • Reliable delivery with proper error handling

    • Accurate UTC timestamp handling

    • Clean URI formatting

Core Components

  1. Data Structure

    • Single global dictionary watched maps Path objects to sets of ServerSession objects

    • Each path entry contains the set of sessions subscribed to that path

  2. Tool API

    • Two essential tools: subscribe and unsubscribe

    • Simple path parameter for straightforward subscription management

    • Clean error handling and path validation

  3. Resource Handling

    • File URIs directly exposed through resource listing

    • Path resolution and validation

    • Text content reading for files

  4. Event Processing

    • Watcher class extends FileSystemEventHandler

    • Processes modified events directly

    • Thread-safe notification dispatching

    • Path relativity handling for nested paths

  5. Notification Delivery

    • ServerNotification creation and sending

    • Event metadata with timestamps

    • Clean URI formatting

The implementation achieves a good balance between functionality and simplicity, resulting in a reliable and maintainable codebase.

Available Tools

4 tools
list_watchedA

List all currently monitored paths and their subscriber counts

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.6/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It indicates a read operation ('List') but doesn't specify whether this requires authentication, how data is returned (e.g., format, pagination), or any rate limits. The description is minimal and lacks essential behavioral context for a tool that likely interacts with subscription systems.

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 a single, efficient sentence that front-loads the core purpose without any wasted words. It directly communicates the tool's function in a clear and structured manner, making it easy to understand at a glance.

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 (likely low, but involves subscription monitoring), no annotations, and no output schema, the description is insufficient. It doesn't explain what the output looks like (e.g., list format, data structure), potential errors, or operational constraints, leaving significant gaps for an AI agent to use it effectively.

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?

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the absence of inputs. The description doesn't need to compensate for any parameter gaps, and it appropriately doesn't mention parameters, making it complete in this regard. A baseline of 4 is appropriate for zero-parameter tools.

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 specific action ('List all') and resource ('currently monitored paths and their subscriber counts'), distinguishing it from sibling tools like subscribe/unsubscribe which perform different operations. It precisely defines what the tool does without being vague or tautological.

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 implies usage context by specifying 'currently monitored paths,' suggesting this tool is for viewing existing subscriptions rather than modifying them. However, it doesn't explicitly state when to use this versus alternatives or provide any exclusion criteria, leaving some ambiguity about its specific application scenarios.

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

subscribeC

Subscribe to changes on a file or directory

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYes

TDQS

C2.8/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. While 'Subscribe to changes' implies a monitoring/notification function, it doesn't describe what kind of changes trigger notifications, how notifications are delivered, whether this requires specific permissions, rate limits, or what happens when multiple subscriptions exist. This leaves significant behavioral gaps for a tool that likely establishes ongoing monitoring.

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 a single, efficient sentence that states the core purpose without unnecessary words. It's appropriately sized for a tool with one parameter and gets straight to the point with zero wasted verbiage.

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?

For a subscription tool with no annotations, no output schema, and minimal parameter documentation, the description is inadequate. It doesn't explain what 'subscribing' entails operationally, what format notifications take, how to manage subscriptions, or what the tool returns. Given the complexity of establishing monitoring and the complete lack of structured documentation, this description leaves too many questions unanswered.

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

Parameters2/5

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

With 0% schema description coverage for the single 'path' parameter, the description provides no additional semantic information about what the path represents, its format, or constraints. The description mentions 'file or directory' which gives some context for the path parameter, but this is minimal compensation for the complete lack of schema documentation.

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

Purpose4/5

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

The description clearly states the action ('Subscribe to changes') and target resource ('on a file or directory'), providing a specific verb+resource combination. However, it doesn't distinguish this tool from its sibling 'subscribe_default', which appears to be a related subscription tool, so it doesn't fully differentiate from alternatives.

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?

The description provides no guidance on when to use this tool versus alternatives like 'subscribe_default' or 'list_watched'. It doesn't mention prerequisites, exclusions, or contextual factors that would help an agent choose between subscription-related tools.

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

subscribe_defaultB

Subscribe to the default watched.txt file for development

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.1/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('subscribe') but doesn't explain what subscription entails (e.g., real-time updates, notifications, persistence), permissions required, side effects, or error conditions. This leaves significant gaps for a mutation-like operation.

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 a single, efficient sentence with no wasted words. It front-loads the core action and target, making it easy to parse quickly. Every element ('subscribe', 'default', 'watched.txt file', 'development') contributes meaning without redundancy.

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 has no parameters (simplifying input) but no annotations or output schema, the description is incomplete. It lacks details on behavior, return values, error handling, and differentiation from siblings like 'subscribe'. For a subscription tool with mutation implications, this leaves too many unknowns for effective agent use.

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?

The tool has 0 parameters, and schema description coverage is 100% (empty schema). The description doesn't need to add parameter details, and it appropriately avoids discussing nonexistent inputs. A baseline of 4 is applied since no parameters exist to document.

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

Purpose4/5

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

The description clearly states the action ('subscribe') and target resource ('default watched.txt file for development'), making the purpose understandable. It doesn't explicitly distinguish from sibling tools like 'subscribe' (which likely allows custom targets) or 'list_watched'/'unsubscribe', but the specificity of 'default' provides some implicit differentiation.

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 explicit guidance is provided on when to use this tool versus alternatives like 'subscribe' (for non-default files) or 'list_watched' (for viewing subscriptions). The description implies it's for development purposes, but doesn't clarify prerequisites, exclusions, or specific use cases compared to siblings.

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

unsubscribeC

Unsubscribe from changes on a file or directory

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYes

TDQS

C2.8/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Unsubscribe from changes') but doesn't explain what 'changes' refers to, whether this operation is reversible, what permissions are required, or what happens after unsubscribing (e.g., notifications stop). For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

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 a single, efficient sentence with zero waste—it directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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 (a mutation operation with no annotations, no output schema, and low schema coverage), the description is incomplete. It lacks details on behavioral traits, parameter usage, output expectations, and differentiation from siblings, making it inadequate for informed tool selection and invocation.

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

Parameters2/5

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

The input schema has 1 parameter with 0% description coverage, so the schema provides no semantic information. The description mentions 'a file or directory' but doesn't clarify what the 'path' parameter represents (e.g., format, examples, or constraints). It adds minimal value beyond the schema's structural definition.

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

Purpose4/5

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

The description clearly states the action ('Unsubscribe from changes') and the target resource ('on a file or directory'), providing a specific verb+resource combination. However, it doesn't explicitly distinguish this tool from its sibling 'subscribe' or 'subscribe_default', which would require mentioning what makes 'unsubscribe' different from those subscription tools.

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?

The description provides no guidance on when to use this tool versus alternatives like 'list_watched' or when not to use it. There's no mention of prerequisites (e.g., needing an existing subscription) or contextual cues for selection among sibling tools, leaving usage decisions ambiguous.

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 updates
    • First observedlist_watched
    • First observedsubscribe
    • First observedsubscribe_default
    • First observedunsubscribe

TDQS

A3.6/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose with no overlap: list_watched for viewing current subscriptions, subscribe for adding new ones, subscribe_default for a specific default case, and unsubscribe for removal. The descriptions reinforce these distinct roles, making misselection unlikely.

Naming Consistency5/5

All tools follow a consistent verb_noun pattern (list_watched, subscribe, subscribe_default, unsubscribe) with clear, action-oriented names. The naming is uniform and predictable, enhancing usability.

Tool Count5/5

With 4 tools, this server is well-scoped for its purpose of monitoring file/directory changes. Each tool serves a necessary function in the subscription lifecycle, and the count is neither too sparse nor bloated.

Completeness5/5

The tool set provides complete coverage for the domain of file/directory monitoring: list (read), subscribe (create), unsubscribe (delete), and a specialized subscribe_default for convenience. There are no obvious gaps, supporting full agent workflows.

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

  • F
    license
    A
    quality
    D
    maintenance
    A Model Context Protocol (MCP) server that enables AI assistants to perform comprehensive file operations including finding, reading, writing, editing, searching, moving, and copying files with security validations.
    7
    1
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    A secure file server for AI assistants that provides comprehensive file operations and text manipulation with configurable access levels and multiple connection modes.
    6
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    A secure, sandboxed file system server that enables reading, writing, searching, and managing files through MCP-compatible AI clients with path traversal protection and size limits.
    -

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/hesreallyhim/mcp-observer-server'

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