Skip to content

fix: install scripts/mcp/ for external research tools#95

Merged
parcadei merged 1 commit intoparcadei:mainfrom
MiaoDX-fork-and-pruning:fix/install-mcp-scripts
Jan 14, 2026
Merged

fix: install scripts/mcp/ for external research tools#95
parcadei merged 1 commit intoparcadei:mainfrom
MiaoDX-fork-and-pruning:fix/install-mcp-scripts

Conversation

@MiaoDX
Copy link
Copy Markdown
Contributor

@MiaoDX MiaoDX commented Jan 14, 2026

The setup wizard (claude_integration.py) and update wizard (update.py) install scripts from opc/scripts/ to ~/.claude/scripts/, but mcp/ was missing. This directory contains essential external API tools used by skills like /perplexity-search, /research-external, /firecrawl-scrape.

Scripts in mcp/:

  • perplexity_search.py - AI web search/research
  • firecrawl_scrape.py - Web scraping
  • github_search.py - GitHub search
  • nia_docs.py - Documentation search
  • morph_apply.py, morph_search.py - Code search/apply

This was an oversight from commit f36ce28 which added other script directories (core/, cc_math/, tldr/) but missed mcp/.

Changes

  1. Add .claude/scripts/mcp as symlink to ../../opc/scripts/mcp (avoids duplication since mcp/ scripts are standalone)

  2. Update claude_integration.py to copy opc/scripts/mcp/ during install

  3. Update update.py to include scripts/mcp in the checks list

Before (fails from any project except CC)

$ cd ~/my-project && claude
> /perplexity-search --search "test"
Error: scripts/mcp/perplexity_search.py not found

After (works from anywhere)

$ cd ~/my-project && claude
> /perplexity-search --search "test"
✓ Works - uses ~/.claude/scripts/mcp/perplexity_search.py

Architecture note

Unlike core/ scripts which have separate opc/ (development) and .claude/ (distribution) versions, mcp/ scripts are standalone with no opc-specific dependencies. Using a symlink avoids maintaining duplicate files.

Summary by CodeRabbit

  • New Features

    • Enabled new research and API tooling capabilities including search, web scraping, documentation access, and data transformation features.
  • Chores

    • Updated system installation and update processes to manage new script integrations.

✏️ Tip: You can customize this high-level summary in your review settings.

The setup wizard (claude_integration.py) and update wizard (update.py)
install scripts from opc/scripts/ to ~/.claude/scripts/, but mcp/ was
missing. This directory contains essential external API tools used by
skills like /perplexity-search, /research-external, /firecrawl-scrape.

Scripts in mcp/:
- perplexity_search.py - AI web search/research
- firecrawl_scrape.py - Web scraping
- github_search.py - GitHub search
- nia_docs.py - Documentation search
- morph_apply.py, morph_search.py - Code search/apply

This was an oversight from commit f36ce28 which added other script
directories (core/, cc_math/, tldr/) but missed mcp/.

## Changes

1. Add .claude/scripts/mcp as symlink to ../../opc/scripts/mcp
   (avoids duplication since mcp/ scripts are standalone)

2. Update claude_integration.py to copy opc/scripts/mcp/ during install

3. Update update.py to include scripts/mcp in the checks list

## Before (fails from any project except CC)
```
$ cd ~/my-project && claude
> /perplexity-search --search "test"
Error: scripts/mcp/perplexity_search.py not found
```

## After (works from anywhere)
```
$ cd ~/my-project && claude
> /perplexity-search --search "test"
✓ Works - uses ~/.claude/scripts/mcp/perplexity_search.py
```

## Architecture note

Unlike core/ scripts which have separate opc/ (development) and
.claude/ (distribution) versions, mcp/ scripts are standalone with
no opc-specific dependencies. Using a symlink avoids maintaining
duplicate files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Jan 14, 2026

Skipped: This PR was not opened by one of your configured authors: (dependabot[bot], renovate[bot], parcadei, ...)

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 14, 2026

📝 Walkthrough

Walkthrough

The pull request introduces MCP (Model Context Protocol) script integration into the Claude setup process. A reference file is added, along with installation logic to copy MCP scripts from the OPC directory and update checking to track script changes.

Changes

Cohort / File(s) Summary
MCP Script Integration Setup
.claude/scripts/mcp, opc/scripts/setup/claude_integration.py, opc/scripts/setup/update.py
Added reference file pointing to OPC MCP scripts directory; extended install_opc_integration() to copy MCP scripts (research/API tooling) to target location and count installed Python files; added update check entry for scripts/mcp subdirectory to track script changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Through scripts of MCP we now shall roam,
To bring research tools safely home,
From OPC's vault to Claude's embrace,
Each file copied in its place—
Integration blooms like clover in spring! 🍀

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: install scripts/mcp/ for external research tools' accurately and specifically describes the main change: installing the previously omitted mcp/ directory containing external research tool scripts.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@MiaoDX
Copy link
Copy Markdown
Contributor Author

MiaoDX commented Jan 14, 2026

@parcadei

To be honest, it's really strange that we have so many files with the same name but mirror diffs in this repo.
Why is this?

Can we make one refactor to clean them all?

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@opc/scripts/setup/claude_integration.py`:
- Around line 522-527: The copy of opc_scripts_mcp to target_scripts_mcp can
fail if target_dir / "scripts" doesn't exist; before calling shutil.copytree for
opc_scripts_mcp (variables opc_scripts_mcp and target_scripts_mcp), ensure the
parent directory (target_scripts_mcp.parent or target_dir / "scripts") is
created with mkdir(parents=True, exist_ok=True); keep the existing logic that
removes an existing target with shutil.rmtree if present, then create the parent
and call shutil.copytree.

In `@opc/scripts/setup/update.py`:
- Around line 247-250: The parent "scripts" tuple currently overlaps with the
"scripts/mcp" tuple causing potential duplicate reports when compare_directories
uses recursive rglob; either remove the redundant ("scripts/mcp", claude_dir /
"scripts" / "mcp", {".py"}) tuple from the list if you don’t need separate
reporting, or alter the parent entry to only scan top-level files (e.g., change
the parent scan to non-recursive glob or add an exclusion for "scripts/mcp") so
compare_directories won’t double-count files.
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 8ffcefc and 4a86e63.

📒 Files selected for processing (3)
  • .claude/scripts/mcp
  • opc/scripts/setup/claude_integration.py
  • opc/scripts/setup/update.py
🔇 Additional comments (2)
opc/scripts/setup/claude_integration.py (1)

519-528: LGTM! MCP script copying follows established patterns.

The implementation correctly mirrors the existing patterns for core, cc_math, and tldr script directories. Path resolution, directory cleanup, and script counting are all consistent.

.claude/scripts/mcp (1)

1-1: Symlink approach is correct. The relative path properly resolves from .claude/scripts/mcp to opc/scripts/mcp, and the target directory with all expected script files exists. This avoids maintaining duplicate script files.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment on lines +522 to +527
opc_scripts_mcp = opc_source.parent / "opc" / "scripts" / "mcp"
target_scripts_mcp = target_dir / "scripts" / "mcp"
if opc_scripts_mcp.exists():
if target_scripts_mcp.exists():
shutil.rmtree(target_scripts_mcp)
shutil.copytree(opc_scripts_mcp, target_scripts_mcp)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Edge case: Parent directory may not exist if scripts/core is absent.

The target_dir / "scripts" parent directory is only created at line 492-493 when opc_scripts_core.exists(). If scripts/core doesn't exist but scripts/mcp does, shutil.copytree will fail because the parent directory doesn't exist.

This is a pre-existing pattern issue, but since you're adding a new script directory, consider adding the parent mkdir here for robustness:

Proposed fix
         opc_scripts_mcp = opc_source.parent / "opc" / "scripts" / "mcp"
         target_scripts_mcp = target_dir / "scripts" / "mcp"
         if opc_scripts_mcp.exists():
+            target_scripts_mcp.parent.mkdir(parents=True, exist_ok=True)
             if target_scripts_mcp.exists():
                 shutil.rmtree(target_scripts_mcp)
             shutil.copytree(opc_scripts_mcp, target_scripts_mcp)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
opc_scripts_mcp = opc_source.parent / "opc" / "scripts" / "mcp"
target_scripts_mcp = target_dir / "scripts" / "mcp"
if opc_scripts_mcp.exists():
if target_scripts_mcp.exists():
shutil.rmtree(target_scripts_mcp)
shutil.copytree(opc_scripts_mcp, target_scripts_mcp)
opc_scripts_mcp = opc_source.parent / "opc" / "scripts" / "mcp"
target_scripts_mcp = target_dir / "scripts" / "mcp"
if opc_scripts_mcp.exists():
target_scripts_mcp.parent.mkdir(parents=True, exist_ok=True)
if target_scripts_mcp.exists():
shutil.rmtree(target_scripts_mcp)
shutil.copytree(opc_scripts_mcp, target_scripts_mcp)
🤖 Prompt for AI Agents
In `@opc/scripts/setup/claude_integration.py` around lines 522 - 527, The copy of
opc_scripts_mcp to target_scripts_mcp can fail if target_dir / "scripts" doesn't
exist; before calling shutil.copytree for opc_scripts_mcp (variables
opc_scripts_mcp and target_scripts_mcp), ensure the parent directory
(target_scripts_mcp.parent or target_dir / "scripts") is created with
mkdir(parents=True, exist_ok=True); keep the existing logic that removes an
existing target with shutil.rmtree if present, then create the parent and call
shutil.copytree.

Comment on lines 247 to 250
("scripts", claude_dir / "scripts", {".py", ".sh"}),
("scripts/core", claude_dir / "scripts" / "core", {".py"}),
("scripts/mcp", claude_dir / "scripts" / "mcp", {".py"}),
]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Potential overlap between scripts and scripts/mcp checks.

The generic ("scripts", ...) entry at line 247 already scans for .py and .sh files recursively via rglob("*") in compare_directories. Adding scripts/mcp separately may cause files to be reported twice—once from the parent scripts check and once from the scripts/mcp check.

Consider whether this is intentional (for more granular status output) or if scripts/mcp should be excluded from the parent scan.

Option: Exclude subdirectories from parent scripts check

If you want separate reporting without double-counting, you could modify the scripts entry to exclude subdirectories that have their own entries, or remove the parent scripts entry entirely if all script subdirectories are listed individually.

🤖 Prompt for AI Agents
In `@opc/scripts/setup/update.py` around lines 247 - 250, The parent "scripts"
tuple currently overlaps with the "scripts/mcp" tuple causing potential
duplicate reports when compare_directories uses recursive rglob; either remove
the redundant ("scripts/mcp", claude_dir / "scripts" / "mcp", {".py"}) tuple
from the list if you don’t need separate reporting, or alter the parent entry to
only scan top-level files (e.g., change the parent scan to non-recursive glob or
add an exclusion for "scripts/mcp") so compare_directories won’t double-count
files.

@parcadei parcadei merged commit a604949 into parcadei:main Jan 14, 2026
1 check 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