feat: add mcp-sync target to Makefile#35
Conversation
- Add MCP_SRC and MCP_TARGET_DIRS variables - Add mcp-sync target to copy .ruler/mcp.json to all CLI tool directories - Integrate mcp-sync into prepare target for automatic syncing
There was a problem hiding this comment.
Pull Request Overview
This PR adds MCP (Model Control Protocol) configuration synchronization functionality to the Makefile, enabling automatic syncing of MCP server configurations from a central source to multiple CLI tool directories.
- Adds
mcp-synctarget to copy.ruler/mcp.jsonto CLI tool configuration directories - Defines source and target directory variables for MCP configuration management
- Integrates MCP syncing into the existing
preparetarget for automatic setup
|
Warning Rate limit exceeded@shunkakinoki has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 9 minutes and 54 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe Makefile adds MCP_SRC and MCP_TARGET_DIRS variables, introduces a new phony mcp-sync target, wires prepare to run mcp-sync, and updates commands-sync to iterate over MCP_TARGET_DIRS, ensuring target directory creation and copying MCP_SRC to each as mcp.json with success/failure messaging. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant Make as make
participant mcp as mcp-sync (target)
participant sh as Shell
participant T1 as TargetDir[1..N]
Dev->>Make: make prepare
Make->>mcp: invoke as dependency
mcp->>sh: validate MCP_SRC exists
alt MCP_SRC missing
sh-->>Dev: error message
mcp-->>Make: non-zero exit
else MCP_SRC present
loop for each dir in MCP_TARGET_DIRS
mcp->>sh: mkdir -p <dir>
mcp->>sh: cp MCP_SRC -> <dir>/mcp.json
sh-->>mcp: per-target success/failure message
end
mcp-->>Make: success
end
Make-->>Dev: prepare complete (includes mcp-sync)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
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. Comment |
Reorganizes the Makefile to separate root targets from commands, improving readability and maintainability. Introduces a new `sync` target that consolidates the `commands-sync` and `mcp-sync` targets for a cleaner workflow.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
Makefile (1)
17-20: Use$(MAKE)for recursive invocations.
makespawns a fresh instance that drops MAKEFLAGS/variables;$(MAKE)preserves the caller’s context. Since we’re adding a new recursive call here, let’s switch both lines for consistency.- @make commands-copy - @make mcp-sync + @$(MAKE) commands-copy + @$(MAKE) mcp-sync
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
Makefile(2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/{Makefile*,Dockerfile*}
📄 CodeRabbit inference engine (CLAUDE.md)
Include Makefiles and Dockerfiles in lint/check pipelines as infrastructure artifacts.
Include Makefiles and Dockerfiles in lint/format checks
Files:
Makefile
Makefile*
📄 CodeRabbit inference engine (.cursor/rules/ruler_cursor_instructions.mdc)
Include Makefile* in linting/quality checks scope.
Files:
Makefile
**/Makefile*
📄 CodeRabbit inference engine (GEMINI.md)
Include Makefiles in linting/formatting scope where applicable
Files:
Makefile
{Makefile*,Dockerfile*}
📄 CodeRabbit inference engine (AGENT.md)
Include Makefiles and Dockerfiles in linting/formatting scope where applicable.
Files:
Makefile
| .PHONY: mcp-sync | ||
| mcp-sync: ## Sync MCP configuration from .ruler/mcp.json to CLI tools. | ||
| @if [ ! -f $(MCP_SRC) ]; then \ | ||
| echo "Error: $(MCP_SRC) not found"; \ | ||
| exit 1; \ | ||
| fi | ||
| @for target in $(MCP_TARGET_DIRS); do \ | ||
| if mkdir -p $$target && cp $(MCP_SRC) $$target/mcp.json; then \ | ||
| echo "Synced $(MCP_SRC) → $$target/mcp.json"; \ | ||
| else \ | ||
| echo "Failed syncing $(MCP_SRC) → $$target/mcp.json"; \ | ||
| exit 1; \ | ||
| fi; \ | ||
| done |
There was a problem hiding this comment.
Quote MCP paths to keep the sync target working in directories with spaces.
If this repo lives in a directory whose path contains spaces (common on macOS, e.g. “~/Projects/My Rules”), [ ! -f $(MCP_SRC) ] and the subsequent cp $(MCP_SRC) $$target/mcp.json will split the path and fail, causing make mcp-sync / make prepare to error. Please quote both the existence check and the copy/mkdir calls.
- @if [ ! -f $(MCP_SRC) ]; then \
+ @if [ ! -f "$(MCP_SRC)" ]; then \
@@
- if mkdir -p $$target && cp $(MCP_SRC) $$target/mcp.json; then \
+ if mkdir -p "$$target" && cp "$(MCP_SRC)" "$$target/mcp.json"; then \🤖 Prompt for AI Agents
In Makefile around lines 37 to 50, path variables are not quoted so filenames
with spaces break the existence check and copy; change the test and filesystem
commands to quote variables: use [ ! -f "$(MCP_SRC)" ] for the existence check,
mkdir -p "$$target" and cp "$(MCP_SRC)" "$$target/mcp.json" (and quote $$target
in the echo messages if you choose) so the loop and copy work when paths contain
spaces.
Changes Made
mcp-synctarget to sync MCP configurations from.ruler/mcp.jsonto CLI toolsMCP_SRCandMCP_TARGET_DIRSvariables to define source and target directoriesmcp-syncintopreparetarget for automatic syncing during project setupTechnical Details
.ruler/mcp.jsonto~/.cursor,~/.claude, and~/.codexdirectoriesTesting
make mcp-synccommandmake prepareUsage
🤖 Generated with Claude Code by Claude Sonnet 4.5
Summary by cubic
Adds a Makefile target mcp-sync that syncs .ruler/mcp.json to local CLI tool directories, and runs during make prepare to keep all tools on the same MCP config.