Skip to content

Ensure MCP config files end with a trailing newline - #990

Merged
pushpak1300 merged 2 commits into
laravel:mainfrom
iitenkida7:fix/mcp-json-trailing-newline
Sep 2, 2026
Merged

Ensure MCP config files end with a trailing newline#990
pushpak1300 merged 2 commits into
laravel:mainfrom
iitenkida7:fix/mcp-json-trailing-newline

Conversation

@iitenkida7

Copy link
Copy Markdown
Contributor

boost:install writes MCP config files (.mcp.json, .cursor/mcp.json, .vscode/mcp.json, etc.) without a trailing newline, so the file ends right after the closing }. As a result:

  • GitHub shows the \ No newline at end of file marker in diffs whenever the config file is committed.
  • Editors and formatters that enforce a final newline (EditorConfig's insert_final_newline, Prettier, etc.) re-add it, producing a noisy one-line diff after every boost:install run.

This is the same class of issue previously fixed for guideline files in #113 and for skill files in #790Install\Mcp\FileWriter was the remaining writer without the guard.

Changes

  • FileWriter::writeFile() now ensures the written content ends with a newline, reusing the exact ensureTrailingNewline() implementation from SkillWriter (Fix path separators and trailing newlines in install output #790). Since every write path (new file creation, plain JSON update, JSON5 in-place update) goes through writeFile(), all generated configs are covered.
  • The newline is only appended when missing, so user-edited JSON5 files that already end with a newline are left untouched — no double newline.
  • Added tests for all three write paths and updated the exact-match expectation in AgentTest accordingly.

There is no behavioral change beyond the final byte of the written file — existing configs are parsed and re-written exactly as before.

@pushpak1300
pushpak1300 merged commit 4f6d5fc into laravel:main Sep 2, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants