Skip to content

Fix/mcp server bugs - #16

Open
Tazovsky wants to merge 2 commits into
aniketkarne:mainfrom
Tazovsky:fix/mcp-server-bugs
Open

Fix/mcp server bugs#16
Tazovsky wants to merge 2 commits into
aniketkarne:mainfrom
Tazovsky:fix/mcp-server-bugs

Conversation

@Tazovsky

Copy link
Copy Markdown

Summary

  • Fix MCP server reading PID/log files from plugin install directory instead of the project directory where the daemon actually writes them
  • Fix plugin.json hooks path (./hooks.json./hooks/hooks.json)
  • Fix MCP stdio protocol compliance: compact NDJSON output, dynamic response IDs matching request IDs, and proper string type for content[].text
  • Handle notifications/initialized and empty lines gracefully

Test plan

  • Install plugin and verify it loads without hook path errors
  • Start daemon via MCP tool, verify get_daemon_status reports "running"
  • Check get_logs returns actual log content
  • Verify MCP responses are single-line JSON with correct request IDs

Tazovsky and others added 2 commits February 13, 2026 00:39
Three bugs prevented the MCP stdio server from working with Claude Code:

1. plugin.json hooks path pointed to ./hooks.json but the file lives at
   ./hooks/hooks.json, causing plugin load failure.

2. Handler functions output pretty-printed multi-line JSON, but MCP stdio
   transport expects NDJSON (one complete JSON object per line). Added
   send_response helper that pipes all output through jq -c for compaction.

3. Response IDs were hardcoded (1, 2, 3...) instead of echoing the request
   ID back. JSON-RPC requires response.id to match request.id. The
   send_response helper now sets the correct ID via --argjson.

4. get_daemon_status embedded a raw JSON object as the text field value,
   but MCP content[].text must be a string. Changed to use jq tojson to
   serialize the object into a JSON string.

Also: handle notifications/initialized silently (no response needed),
skip empty input lines to avoid parse errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The daemon and manager write PID and log files to the project's logs/
directory (via CLAUDE_NIGHTS_WATCH_DIR or CWD), but the MCP server was
reading from PLUGIN_ROOT/logs/ (the plugin install directory). This
caused get_daemon_status and get_logs to report the daemon as stopped
and logs as missing even when the daemon was running.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant