Conversation
WalkthroughDockerfile에 Node.js 20.x와 전역 npm 패키지 Changes
Sequence Diagram(s)sequenceDiagram
participant Service as cs25-service
participant STDIO as server-brave-search (MCP)
participant Brave as Brave Search API
Service->>STDIO: 실행: "server-brave-search" (STDIO 프로세스 시작)
STDIO->>Brave: BRAVE_API_KEY로 검색 요청 전송
Brave-->>STDIO: 검색 결과 반환
STDIO-->>Service: STDIO를 통해 결과 스트림 전달
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
cs25-service/Dockerfile(1 hunks)cs25-service/src/main/resources/application.properties(1 hunks)
🔇 Additional comments (2)
cs25-service/src/main/resources/application.properties (1)
71-71: 검증 완료: 브레이브 CLI 전환 잔여 설정 없음
npx호출 검색 결과 없음spring.ai.mcp.client.stdio.connections.brave.args설정 없음- Dockerfile에서 전역 설치(
npm install -g @modelcontextprotocol/server-brave-search) 및which server-brave-search확인- application.properties에서
spring.ai.mcp.client.stdio.connections.brave.command=server-brave-search로 정상 설정(선택) PATH 이슈 우려 시 절대 경로 지정 적용 가능:
-spring.ai.mcp.client.stdio.connections.brave.command=server-brave-search +spring.ai.mcp.client.stdio.connections.brave.command=/usr/local/bin/server-brave-searchcs25-service/Dockerfile (1)
23-29: 환경 일관성 검증 요약
Dockerfile에서
npm install -g @modelcontextprotocol/server-brave-search후
which server-brave-search로 글로벌 설치 및 PATH 노출이 확인되었습니다.
(cs25-service/Dockerfile:27–28)
application.properties에서
spring.ai.mcp.client.stdio.connections.brave.command=server-brave-search
spring.ai.mcp.client.stdio.connections.brave.env.BRAVE_API_KEY=${BRAVE_API_KEY}
로 BRAVE_API_KEY를 환경변수로 참조하도록 설정되어 있습니다.
(cs25-service/src/main/resources/application.properties:71–72)배포 매니페스트/시크릿에 실제로
BRAVE_API_KEY환경변수가 주입되는지는 코드베이스만으로는 확인되지 않습니다.
해당 부분은 쿠버네티스/도커 컴포즈 등 배포 설정에서 수동 검증이 필요합니다.
| # Node.js + npm 설치 후, MCP 서버 전역 설치 | ||
| RUN apt-get update && apt-get install -y curl ca-certificates gnupg \ | ||
| && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ | ||
| && apt-get install -y nodejs \ | ||
| && npm install -g @modelcontextprotocol/server-brave-search \ | ||
| && node -v && npm -v && which server-brave-search \ | ||
| && apt-get clean && rm -rf /var/lib/apt/lists/* |
There was a problem hiding this comment.
🛠️ Refactor suggestion
런타임에 Node+MCP CLI 설치는 목적에 부합합니다. 재현성(버전 고정)·이미지 슬림화 개선 제안
- 버전 고정: 최신으로 깔리는 nodejs/npm/CLI는 재현성을 해칩니다. server-brave-search에 버전 핀 권장(@x.y.z 또는 ARG 사용).
- 이미지 슬림화: apt에 --no-install-recommends, npm cache clean, 사용 후 gnupg purge로 공격면/용량 축소.
- 디버그 출력(node -v 등)은 일시적 점검엔 유용하나, 불필요하면 제거 가능.
상단(ENTRYPOINT 이전) 어딘가에 다음 ARG를 추가:
ARG MCP_BRAVE_VERSION=0.1.x변경 구간에 대한 제안 Diff:
-RUN apt-get update && apt-get install -y curl ca-certificates gnupg \
- && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
- && apt-get install -y nodejs \
- && npm install -g @modelcontextprotocol/server-brave-search \
- && node -v && npm -v && which server-brave-search \
- && apt-get clean && rm -rf /var/lib/apt/lists/*
+RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates gnupg \
+ && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
+ && apt-get install -y --no-install-recommends nodejs \
+ && npm install -g @modelcontextprotocol/server-brave-search@${MCP_BRAVE_VERSION} \
+ && npm cache clean --force \
+ && node -v && npm -v && which server-brave-search \
+ && apt-get purge -y gnupg && apt-get autoremove -y --purge \
+ && apt-get clean && rm -rf /var/lib/apt/lists/*필요 시 디버그 출력(node -v, npm -v, which …)은 빌드 안정화 후 제거 가능.
🤖 Prompt for AI Agents
In cs25-service/Dockerfile around lines 23 to 29, pin the MCP CLI version and
slim the image: add an ARG (e.g. MCP_BRAVE_VERSION) near the top and change the
npm install to use that ARG (install
@modelcontextprotocol/server-brave-search@${MCP_BRAVE_VERSION}); install apt
packages with --no-install-recommends, run npm cache clean --force after npm
install, and remove gnupg via apt-get purge -y gnupg (or rm -rf its data) before
cleaning apt lists; remove or comment out transient debug prints (node -v, npm
-v, which ...) unless needed for debugging.
* chore: MCP 도입할 때 필요한 npx 패키지 적용 (#367) * chore: MCP 도입할 때 필요한 npx 패키지 적용 * chore: 부팅 시 외부 프로세스 미실행 (요청 시 연결) * chore: 런타임베이스이미지를 Ubuntu 계열로 변경하여 apt-get 명령어가 동작할 수 있게 변경 (#369) --------- Co-authored-by: Ksr-ccb <harang4282@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: baegjonghyeon <baek011226@naver.com> Co-authored-by: Baek jonghyun <69610809+jong-0126@users.noreply.github.com> Co-authored-by: crocusia <132359536+crocusia@users.noreply.github.com> Co-authored-by: Kimyoonbeom <101162650+Kimyoonbeom@users.noreply.github.com> Co-authored-by: HeeMang-Lee <hemsej018@naver.com> Co-authored-by: Kimyoonbeom <kimybeom@naver.com> Co-authored-by: crocusia <rainbowsubin0522@gmail.com>
🔎 작업 내용
@modelcontextprotocol/server-brave-search전역 설치server-brave-search직접 호출spring.ai.mcp.client.initialized=false설정 추가→ 앱 기동 실패가 다시 발생될 수 있기 때문에
🛠️ 변경 사항
node/npm설치 +@modelcontextprotocol/server-brave-search전역 설치server-brave-search를 직접 실행🧩 트러블 슈팅
기존 application.properties
변경 application.properties
추가 Dockerfile
🙏 코드 리뷰 전 확인 체크리스트
type :)Summary by CodeRabbit