Skip to content

feat: sync enabledMcpjsonServers from mcp.json#75

Merged
shunkakinoki merged 1 commit intomainfrom
feat/mcp-sync-enabled-servers
Feb 17, 2026
Merged

feat: sync enabledMcpjsonServers from mcp.json#75
shunkakinoki merged 1 commit intomainfrom
feat/mcp-sync-enabled-servers

Conversation

@shunkakinoki
Copy link
Owner

@shunkakinoki shunkakinoki commented Feb 17, 2026

Summary

  • Derives enabledMcpjsonServers in settings.local.json from the keys in .ruler/mcp.json during mcp-sync
  • Prevents stale server references (e.g. Linear, Figma, Beeper) from lingering after removal from mcp.json

Test plan

  • Run make mcp-sync and verify ~/.claude/settings.local.json enabledMcpjsonServers matches mcp.json keys
  • Verify no changes when settings.local.json doesn't exist in a target dir

🤖 Generated with Claude Code


Summary by cubic

mcp-sync now sets enabledMcpjsonServers in settings.local.json from the server keys in .ruler/mcp.json to keep local settings aligned and clean up removed servers. If a target dir has no settings.local.json, the sync skips it without changes.

Written for commit 48c605e. Summary will update on new commits.

Derives enabledMcpjsonServers in settings.local.json from the keys in
.ruler/mcp.json so removed servers (e.g. Linear, Figma, Beeper) are
automatically cleaned up on `make sync`.
Copilot AI review requested due to automatic review settings February 17, 2026 00:05
@coderabbitai
Copy link

coderabbitai bot commented Feb 17, 2026

Warning

Rate limit exceeded

@shunkakinoki has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 21 minutes and 34 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/mcp-sync-enabled-servers

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@shunkakinoki shunkakinoki merged commit 0db8f49 into main Feb 17, 2026
8 checks passed
@shunkakinoki shunkakinoki deleted the feat/mcp-sync-enabled-servers branch February 17, 2026 00:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the mcp-sync Make target to keep Claude CLI settings.local.json in sync with .ruler/mcp.json, specifically ensuring enabledMcpjsonServers reflects the current set of MCP servers and avoids stale entries.

Changes:

  • Extracts .mcpServers keys from .ruler/mcp.json via jq.
  • Updates enabledMcpjsonServers in each target directory’s settings.local.json (when present) during mcp-sync.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +139 to +141
jq --argjson keys "$$keys" '.enabledMcpjsonServers = $$keys' "$$settings" > "$$settings.tmp" && \
mv "$$settings.tmp" "$$settings"; \
echo "Updated enabledMcpjsonServers in $$settings"; \
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The jq ... > "$settings.tmp" && mv ...; echo "Updated..." sequence will print the success message even when jq fails (because echo runs unconditionally after the && list), and the recipe will still exit 0. Consider making the echo conditional on success and failing the target on error (e.g., include the echo in the && chain or use an if ...; then ...; else ...; exit 1; fi block; also clean up the temp file on failure).

Suggested change
jq --argjson keys "$$keys" '.enabledMcpjsonServers = $$keys' "$$settings" > "$$settings.tmp" && \
mv "$$settings.tmp" "$$settings"; \
echo "Updated enabledMcpjsonServers in $$settings"; \
if jq --argjson keys "$$keys" '.enabledMcpjsonServers = $$keys' "$$settings" > "$$settings.tmp" && \
mv "$$settings.tmp" "$$settings"; then \
echo "Updated enabledMcpjsonServers in $$settings"; \
else \
echo "Failed updating enabledMcpjsonServers in $$settings"; \
rm -f "$$settings.tmp"; \
exit 1; \
fi; \

Copilot uses AI. Check for mistakes.
exit 1; \
fi; \
done
@keys=$$(jq -c '.mcpServers | keys' $(MCP_SRC)); \
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keys=$$(jq ...) will not cause the recipe to fail if jq errors (shell assignment returns success), which can lead to enabledMcpjsonServers being set to an empty/invalid value. Add explicit error handling for the jq invocation (e.g., ... || exit 1) and consider using jq -e/-c with a safe default like .mcpServers // {} | keys if mcpServers might be absent.

Suggested change
@keys=$$(jq -c '.mcpServers | keys' $(MCP_SRC)); \
@tmp_keys_file=$$(mktemp); \
if jq -e -c '.mcpServers // {} | keys' $(MCP_SRC) > "$$tmp_keys_file"; then \
keys=$$(cat "$$tmp_keys_file"); \
rm -f "$$tmp_keys_file"; \
else \
echo "Error: failed to parse .mcpServers from $(MCP_SRC)"; \
rm -f "$$tmp_keys_file"; \
exit 1; \
fi; \

Copilot uses AI. Check for mistakes.
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