Skip to content

Refactor/402 래퍼스크립트를 만들어 커맨드명 유지하도록 도커파일 수정#403

Merged
HeeMang-Lee merged 1 commit intodevfrom
refactor/402
Aug 12, 2025
Merged

Refactor/402 래퍼스크립트를 만들어 커맨드명 유지하도록 도커파일 수정#403
HeeMang-Lee merged 1 commit intodevfrom
refactor/402

Conversation

@HeeMang-Lee
Copy link
Copy Markdown
Member

@HeeMang-Lee HeeMang-Lee commented Aug 12, 2025

🔎 작업 내용

  • @brave/brave-search-mcp-server + 래퍼 스크립트로 교체

Summary by CodeRabbit

  • 신규 기능
    • 없음
  • 유지 관리(Chores)
    • 런타임을 Node.js 22로 업데이트했습니다.
    • Brave 검색 MCP 서버를 공식 패키지로 교체하고 실행 방식을 스크립트로 표준화했습니다.
    • server-brave-search 명령어를 STDIO 전송 방식으로 실행하도록 보장하고, 가용성/도움말 확인을 추가했습니다.
    • 불필요한 패키지 정리 절차를 조정해 빌드 정리를 유지했습니다.
  • 문서화
    • 설치 및 실행 방식 관련 주석을 최신 권장 사항에 맞게 업데이트했습니다.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Aug 12, 2025

Walkthrough

cs25-service/Dockerfile updates Node.js to 22.x, switches the Brave Search MCP server package to @brave/brave-search-mcp-server, replaces a symlink with a Node.js wrapper script enforcing stdio transport, adjusts path handling, updates validation steps, and refines cleanup commands.

Changes

Cohort / File(s) Summary
Docker build and MCP server setup
cs25-service/Dockerfile
Bump Node setup to 22.x; install @brave/brave-search-mcp-server globally; set NPM_PREFIX and SRCDIR; add /usr/local/bin/server-brave-search wrapper executing dist/index.js with --transport stdio; make executable; validate with which and --help; remove gnupg purge; update comments.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Wrapper as /usr/local/bin/server-brave-search
    participant Node as Node.js
    participant Module as @brave/brave-search-mcp-server (dist/index.js)

    User->>Wrapper: server-brave-search [args]
    Wrapper->>Node: node dist/index.js --transport stdio [args]
    Node->>Module: Load and execute
    Module-->>User: Runs MCP server over stdio
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • jong-0126
  • Ksr-ccb
  • crocusia
  • Kimyoonbeom

Poem

토끼는 도커 속 점프를 해
노드 스물둘로 깡총 업그레이드해 🐇
심볼릭 링크 대신 래퍼가 출동!
STDIO로 척척, 도움말도 콩콩
용감한 검색, 경로는 곧게—빌드도 OK!

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/402

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@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: 1

🧹 Nitpick comments (5)
cs25-service/Dockerfile (5)

25-30: Node.js 22 설치 플로우 적절

NodeSource 스크립트 기반 설치와 단일 RUN 레이어 병합이 깔끔합니다. 이후 단계에서 이미지 슬림화만 보완하면 좋겠습니다.


34-37: npm prefix 의존 경로 대신 require.resolve 기반 경로 계산 제안

환경마다 npm prefix -g 결과가 달라질 수 있습니다. Node가 제공하는 require.resolve를 이용하면 더 견고합니다.

아래처럼 SRCDIR 계산만 대체해 주세요.

- && SRCDIR="${NPM_PREFIX}/lib/node_modules/@brave/brave-search-mcp-server" \
+ && SRCDIR="$(node -p 'require(\"path\").dirname(require.resolve(\"@brave/brave-search-mcp-server/package.json\"))')" \

38-40: 래퍼 스크립트에서 --transport 중복 방지 로직 제안

현재 스크립트는 항상 --transport stdio를 추가합니다. 호출자가 이미 --transport를 넘긴 경우 중복될 수 있으므로, 인자에 존재하면 그대로 통과하고 없을 때만 기본값을 추가하는 편이 안전합니다(의도적으로 강제하려는 경우라면 그대로 유지해도 무방).

아래처럼 간단한 체크를 추가한 1-liner 대체안을 제안합니다.

- && printf '#!/usr/bin/env bash\nexec node "%s/dist/index.js" --transport stdio "$@"\n' "$SRCDIR" > /usr/local/bin/server-brave-search \
+ && printf '#!/usr/bin/env bash\nfor a in "$@"; do [[ "$a" == --transport* ]] && exec node "%s/dist/index.js" "$@"; done\nexec node "%s/dist/index.js" --transport stdio "$@"\n' "$SRCDIR" "$SRCDIR" > /usr/local/bin/server-brave-search \

42-44: which 대신 shell 내장 command -v 사용 및 오류 처리 그룹화

일부 슬림 이미지에는 which가 없을 수 있습니다. command -v는 쉘 내장이라 추가 패키지 없이 동작합니다. 또한 || 블록을 {}로 명시적으로 감싸면 가독성과 의도가 분명해집니다.

아래로 교체를 제안합니다.

- && echo "=== which server-brave-search ===" && which server-brave-search \
- && echo "=== server-brave-search --help ===" && server-brave-search --help || (echo "[ERROR] server-brave-search 실행 실패" && exit 1) \
+ && echo "=== command -v server-brave-search ===" && command -v server-brave-search >/dev/null \
+ && echo "=== server-brave-search --help ===" && ( server-brave-search --help ) || { echo "[ERROR] server-brave-search 실행 실패"; exit 1; } \

46-50: 이미지 슬림화: gnupg 제거 추가 제안

gnupg는 NodeSource 키 추가 후 더 이상 필요 없습니다. 명시적으로 purge하면 이미지가 더 작아집니다. autoremove만으로는 직접 설치한 패키지는 제거되지 않습니다.

아래처럼 정리 단계에 purge를 추가해 주세요.

  # 정리
- && npm cache clean --force \
+ && npm cache clean --force \
+ && apt-get purge -y gnupg \
  && apt-get autoremove -y --purge \
  && apt-get clean \
  && rm -rf /var/lib/apt/lists/*
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 76a15b3 and fa77844.

📒 Files selected for processing (1)
  • cs25-service/Dockerfile (1 hunks)

Comment on lines +31 to 33
# 공식 패키지 설치 (deprecated 패키지 제거)
&& npm install -g @brave/brave-search-mcp-server \
\
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

패키지 전환 OK. 다만 버전 고정 권장

@brave/brave-search-mcp-server 로의 전환 방향성은 적절합니다. 빌드 재현성을 위해 major/minor 버전 고정을 권장합니다(예: @brave/brave-search-mcp-server@^x.y). 최신 버전/존재 여부도 한 번 확인해 주세요.

아래 스크립트로 NPM 레지스트리에서 패키지 메타를 확인할 수 있습니다.


🏁 Script executed:

#!/bin/bash
# @brave/brave-search-mcp-server 패키지 최신 버전/타깃 존재 확인
set -euo pipefail
url="https://registry.npmjs.org/@brave%2Fbrave-search-mcp-server"
curl -fsSL "$url" | jq -r '.["dist-tags"].latest, .name'

Length of output: 234


버전 고정 적용 필요: @brave/brave-search-mcp-server@^1.3 지정 권장

최신 버전(1.3.4) 확인 완료했습니다. 빌드 재현성을 위해 major.minor 단위로 버전 고정하세요.

• 위치: cs25-service/Dockerfile (31–33행)
• 변경 예시:

- && npm install -g @brave/brave-search-mcp-server \
+ && npm install -g @brave/brave-search-mcp-server@^1.3 \
📝 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
# 공식 패키지 설치 (deprecated 패키지 제거)
&& npm install -g @brave/brave-search-mcp-server \
\
# 공식 패키지 설치 (deprecated 패키지 제거)
- && npm install -g @brave/brave-search-mcp-server \
+ && npm install -g @brave/brave-search-mcp-server@^1.3 \
\
🤖 Prompt for AI Agents
In cs25-service/Dockerfile around lines 31–33, the global npm install for
@brave/brave-search-mcp-server lacks a version pin; update that install to pin
the package to the 1.3 minor series (e.g. @brave/brave-search-mcp-server@^1.3)
to ensure build reproducibility, adjust the Dockerfile line accordingly, and
rebuild/check the image so the pinned version (current 1.3.x) is used
consistently.

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.

@modelcontextprotocol/server-brave-search 패키지에 따른 도커파일 수정

1 participant