[Experimental] Add Multi-Instance Support and Log Output Cleanup#56
[Experimental] Add Multi-Instance Support and Log Output Cleanup#56tylerstraub wants to merge 5 commits intoCoding-Solo:mainfrom
Conversation
- Replace single activeProcess with Map-based activeProcesses for concurrent instance management - Add instanceId parameter to run_project, get_debug_output, and stop_project tools - Add args parameter to run_project for passing command-line arguments to Godot - Add list_processes tool to view all running instances with status - Add isRunning flag to GodotProcess interface for status tracking - Redirect all debug/log output to console.error (stderr) to prevent MCP protocol interference - Clean log output: strip carriage returns, filter empty lines, trim whitespace - Improve process cleanup to handle multiple instances - Add nextInstanceId counter for auto-generating instance IDs - Retain process output after exit for debugging purposes This enables MMORPG development workflows where multiple Godot instances (server + multiple clients) can run simultaneously with proper isolation and management.
- Update the description for the 'list_processes' tool to clarify it tracks both running and recently exited instances. - Improve instance ID validation to allow reuse of IDs for exited processes. - Ensure only running processes are killed during stop operations, while still tracking all instances. - Add logging for cleaning up exited processes to aid in debugging.
|
So I've been using this branch heavily and I can tell you at least from a user perspective its working really really well. The agent has been able to manage multiple processes (my workflow requires 2 clients, 1 server) and tail them individually by its own instance name it creates at runtime. It also able to use the "all" variants to take down or start up multiple processes at once. The only thing I added not covered here was add some additional re-enforcement in my Full disclosure though this was very loosely planned by me and executed fully by a Cursor IDE agent in like 20 minutes and therefore probably not suitable for main branch. I just primarily wanted to demonstrate the need and a possible approach here. |
Overview
This PR adds experimental support for running multiple Godot instances simultaneously, along with improvements to log output formatting. This work was developed to address a specific use case (multiplayer game development with dedicated server + multiple clients) and is presented here as a potential contribution for maintainers to consider.
Status: Experimental / Proof of Concept
Testing: Limited to ad-hoc use case; not fully tested across all scenarios
Recommendation: Review and consider for future main branch integration
Motivation
The current implementation supports running a single Godot instance at a time. For multiplayer game development workflows, there's a need to:
This PR extends the MCP server to support these workflows while maintaining backward compatibility.
Changes
Core Features
Multi-Instance Process Management
activeProcesswithMap<string, GodotProcess>to track multiple instancesinstanceId(user-provided or auto-generated)id,projectPath,scene,startedAt,isRunningEnhanced
run_projectToolinstanceIdparameter for unique identifiersargsparameter to pass command-line arguments (e.g.,--server,--headless,profile=X,port=Y)instance_1,instance_2, etc.)Enhanced
get_debug_outputToolinstanceIdparameter to get output for a specific instanceinstanceIdis omittedEnhanced
stop_projectToolinstanceIdparameter to stop a specific instanceinstanceIdis omittedNew
list_processesToolLog Output Improvements
\r) from outputstderrinstead ofstdoutto prevent MCP protocol interferenceTechnical Details
Modified Files:
src/index.ts: Core implementation changes (371 lines changed: +304, -67)README.md: Documentation updates (37 lines changed: +35, -2)Key Implementation Changes:
GodotProcessinterface extended withid,projectPath,scene,startedAt,isRunningGodotServerclass now usesMap<string, GodotProcess>instead of single processnextInstanceIdcounter for auto-generationlogDebug()to useconsole.error()for stderr outputUse Cases
Multiplayer Development Workflow
Backward Compatibility
instanceIdcontinue to workget_debug_outputandstop_projectwithoutinstanceIdoperate on all instances (maintains previous behavior when only one instance exists)Testing Status
Tested Scenarios:
Not Yet Tested:
Documentation
list_processesto autoApprove configuration examplesBreaking Changes
None. All changes are backward compatible.
Next Steps / Considerations
This PR is presented as experimental work that has been useful for a specific development workflow. Before considering for main branch integration, maintainers may want to:
Feedback and suggestions are welcome. This is intended as a starting point for discussion rather than a final implementation.