-
Notifications
You must be signed in to change notification settings - Fork 2.6k
#906 - Add watchPaths option to McpHub for file change detection #1755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#906 - Add watchPaths option to McpHub for file change detection #1755
Conversation
|
add support multiple watchers per server. modified the setupFileWatcher method to properly handle asynchronous operations and prevent unhandled promise rejections. error handling now includes specific error messages that identify exactly where the error occurred.
mrubens
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution!
|
@01Rian Do you happen to have discord? would love to include you in our contributors private channel. My username is hrudolph if you can please reach out to me. |
|
@hannesrudolph Yes, I sent you a private message on discord. |
Context
#906
The core issues are:
Implementation
Added support for multiple file watchers per server in the McpHub class
fileWatchersmap to store arrays of watchers instead of a single watchersetupFileWatchermethod to maintain multiple watchers per serverremoveAllFileWatchersmethod to handle arrays of watchersFixed issue where custom
watchPathswatchers would overwrite the fallbackbuild/index.jswatcherAdded proper error handling to file watcher callbacks
asyncfunctionstry/catchblocks aroundawait this.restartConnection(name)callsImproved logging to distinguish between different types of watchers
Screenshots
How to Test
Configure an MCP server with explicit watchPaths:
{ "mcpServers": { "my-server": { "type": "stdio", "command": "node", "args": ["./dist/index.js"], "watchPaths": ["./dist/**/*.js"] } } }Get in Touch
Important
Adds
watchPathsoption toMcpHubfor custom file change detection and server restart.watchPathsoption toBaseConfigSchemainMcpHub.tsfor custom file path watching.setupFileWatcher()to restart servers on file changes.BaseConfigSchemato includewatchPathsas an optional array of strings.watchPathsin MCP server setup.This description was created by
for c5202d4. It will automatically update as commits are pushed.