Next.js DevTools은(는) 무엇을 하나요?
MCP 서버를 통해 Next.js 애플리케이션을 검사하고 디버깅합니다.
빠른 시작
# 서버 시작 (필요 시에만 실행)
bash scripts/start-server.sh
# 또는 mcp-client를 통해 직접 사용
python3 scripts/mcp-client.py call \
-s "npx next-devtools-mcp@latest" \
-t list-routes
사용 가능한 도구
| 도구 | 설명 |
|---|---|
list-routes | 모든 앱 라우트 가져오기 |
get-route-info | 특정 라우트의 세부 정보 |
list-components | 앱 내 React 컴포넌트 목록 |
get-build-info | 빌드 구성 확인 |
get-config | next.config.js 설정 확인 |
워크플로 패턴
패턴 1: 라우트 검사
# 모든 라우트 나열
python3 scripts/mcp-client.py call \
-s "npx next-devtools-mcp@latest" \
-t list-routes
# 특정 라우트 세부 정보 가져오기
python3 scripts/mcp-client.py call \
-s "npx next-devtools-mcp@latest" \
-t get-route-info \
-p '{"route": "/api/auth"}'
패턴 2: 빌드 문제 디버깅
# 빌드 구성 확인
python3 scripts/mcp-client.py call \
-s "npx next-devtools-mcp@latest" \
-t get-build-info
# next.config.js 확인
python3 scripts/mcp-client.py call \
-s "npx next-devtools-mcp@latest" \
-t get-config
패턴 3: 컴포넌트 검색
python3 scripts/mcp-client.py call \
-s "npx next-devtools-mcp@latest" \
-t list-components
스크립트
start-server.sh
지속적인 서버 실행 (여러 호출):
bash scripts/start-server.sh
# 서버가 기본 포트에서 실행됩니다.
# mcp-client.py에 -s 대신 -u 플래그를 사용하세요.
온디맨드 (권장)
단일 호출의 경우 -s 플래그를 사용하면 호출마다 서버가 실행됩니다:
python3 scripts/mcp-client.py call \
-s "npx next-devtools-mcp@latest" \
-t <도구-이름>
문제 해결
| 문제 | 해결 방법 |
|---|---|
| 서버가 시작되지 않음 | npx next-devtools-mcp@latest가 수동으로 작동하는지 확인하세요 |
| 라우트를 찾을 수 없음 | Next.js 프로젝트 루트에서 실행 중인지 확인하세요 |
| 빌드 정보가 비어 있음 | 먼저 next build를 실행하세요 |