fix: graceful shutdown and comprehensive documentation#1
Open
murr2k wants to merge 1 commit intoAdancurusul:mainfrom
Open
fix: graceful shutdown and comprehensive documentation#1murr2k wants to merge 1 commit intoAdancurusul:mainfrom
murr2k wants to merge 1 commit intoAdancurusul:mainfrom
Conversation
This commit addresses MCP server shutdown errors and adds extensive documentation for the project. ## Shutdown Fixes (src/main.rs) - Refactored main loop to use tokio::select! for clean signal handling - Service termination now logged as debug instead of error, preventing spurious error messages when Claude Code disconnects normally - Added explicit connection cleanup via connection_manager.close_all() - Proper logging of closed connection count during shutdown ## Connection Manager Improvements (src/serial/mod.rs) - Added close_all() method for graceful bulk connection cleanup - Improved connection lifecycle management - Enhanced parameter validation for serial configuration ## Handler Updates (src/tools/serial_handler.rs) - Exposed connection_manager() accessor for shutdown cleanup - Enables main.rs to properly clean up resources on exit ## New Documentation ### CLAUDE.md - Build and run commands for development - Architecture overview with component descriptions - Key patterns (tool macros, connection IDs, data encoding) - Data flow summary ### SERIAL_MCP_SERVER_THEORY_OF_OPERATION.md Comprehensive technical documentation including: - System overview with architecture diagrams - MCP protocol integration details - Connection lifecycle state machine - Data flow for read/write operations - Thread safety and synchronization primitives - Session management architecture - Error handling hierarchy and recovery strategies - Configuration system documentation - Tool parameter schemas - Platform-specific behavior (Windows/Linux/macOS) - Performance characteristics - Example MCP JSON-RPC messages All Mermaid diagrams use proper quoting for special characters to ensure compatibility with Mermaid v11.12.2+. Contributed-by: Murray Kopit <github@linknode.com> (github.com/murr2k) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Shutdown Fixes
tokio::select!for clean signal handlingconnection_manager.close_all()cleanup on exitNew Documentation
CLAUDE.md - Quick reference for Claude Code with build commands and architecture overview
SERIAL_MCP_SERVER_THEORY_OF_OPERATION.md - Comprehensive technical docs including:
Test Plan
cargo build --release)Notes
All Mermaid diagrams use proper quoting for special characters (
#,/,<>) to ensure compatibility with modern Mermaid versions.🤖 Generated with Claude Code
Contributed by: @murr2k