Minor Contribution: improve error handling, logger portability, and server initialization patterns#2
Open
beer-to-code wants to merge 1 commit intonitrocloudofficial:mainfrom
Conversation
…erver initialization patterns
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.
Description
Type of Change
Related Issues
Changes Made
The case 'json' branch was missing a break, causing fall-through to the default case. This silently overwrote JSON resource responses with double-serialized content.
Replace debug console.error with logger.debug (server.ts)
A console.error('[DEBUG] NitroStackServer.start()...') was running on every server start. Since MCP uses STDIO for JSON-RPC, any stderr output can interfere with the protocol. Replaced with this.logger.debug() to follow the project's own logging conventions.
Use PromptNotFoundError instead of generic Error (server.ts)
The GetPromptRequestSchema handler threw new Error('Prompt not found: ...') while tools and resources already use their dedicated error classes (ToolNotFoundError, ResourceNotFoundError). Updated to use the existing PromptNotFoundError class from errors.ts for consistency.
Remove console.error from Zod schema conversion (tool.ts)
The toJsonSchema() catch block used console.error, which breaks MCP's STDIO protocol. Changed to a silent fallback with an explanatory comment.
Use os.devNull instead of hardcoded /dev/null (logger.ts)
The fallback logger transport used filename: '/dev/null', which doesn't exist on Windows. Replaced with Node.js built-in os.devNull for cross-platform compatibility.
Bug Fixes (@nitrostack/cli)
Fix non-existent createTool in generated scaffold code (init.ts)
The createProjectFromScratch fallback template imported createTool from @nitrostack/core, which doesn't exist in the public API. Updated to use new Tool({...}), which is the correct exported class.
Fix incorrect website URL in generated README (init.ts)
Generated project READMEs linked to nitrostack.dev instead of nitrostack.ai
Testing
npm run lintnpm testScreenshots / Recordings
Checklist
CONTRIBUTING.md