MCP 서버 레퍼런스 — 4 tool + 페어링
MCP tool 스키마, 인증, 보안 모델.
아키텍처
MCP WebSocket 서버(ws://127.0.0.1:12307)는 크롬 확장이 아닌 CLI(@codelifter/cli)가 호스팅합니다. MV3 서비스 워커는 WebSocket 서버를 직접 바인딩할 수 없기 때문입니다. 확장은 WebSocket 클라이언트로 ws://127.0.0.1:12307에 연결합니다.
Claude Code / Cursor→@codelifter/cli (ws:12307)→Chrome Extension
필수: MCP는 단독으로 동작하지 않습니다. 크롬 확장 + CLI(@codelifter/cli) 가 모두 실행 중이어야 합니다.
인증 (Pairing Token)
확장 설정 → Developer integrations → MCP 토글 ON → 토큰 복사
요청 헤더
x-codelifter-token: <YOUR_64_HEX_TOKEN>MCP Tools
codelifter_extract웹 요소/페이지 추출 + 코드 생성codelifter_list_tabs열린 Chrome 탭 목록 조회codelifter_get_result이전 추출 결과 조회 (ID 기반)codelifter_statusMCP 서버 및 확장 연결 상태 확인⚠️ 사용 전 필수 동작
codelifter_extract 를 호출하기 전, 대상 브라우저 탭에서 Codelifter 확장 아이콘을 한 번 클릭해주세요. 프라이버시 보호(activeTab 권한 모델)를 위해, 확장은 사용자가 명시적으로 활성화한 탭의 DOM에만 접근합니다. 아이콘 클릭 없이 호출하면 ACTIVATION_REQUIRED (-32006) 에러가 반환됩니다.
codelifter_extract
입력 스키마
json
{
"name": "codelifter_extract",
"description": "Extract and convert a web page element or full page to React/Vue/Svelte code.",
"inputSchema": {
"type": "object",
"properties": {
"tabId": {
"type": "number",
"description": "Chrome tab ID to extract from. Omit to use active tab."
},
"url": {
"type": "string",
"description": "URL to extract from (mutually exclusive with tabId)."
},
"selector": {
"type": "string",
"description": "CSS selector for element extraction. Omit for full-page mode."
},
"framework": {
"type": "string",
"enum": ["react", "vue", "svelte"],
"description": "Output framework. Defaults to react."
},
"cssMode": {
"type": "string",
"enum": ["tailwind"],
"description": "CSS output mode. Currently only tailwind is supported."
},
"detectionMode": {
"type": "string",
"enum": ["off", "static", "full"],
"description": "Tier 2 detection mode. 'full' includes MAIN world probe + snapshot-diff."
}
}
}
}응답 예시
json
{
"pipelineMode": "extension",
"extractionResult": { /* CompactExtractionResult */ },
"generatedFiles": [
{ "path": "components/HeroSection.tsx", "content": "..." },
{ "path": "components/HeroSection.module.css", "content": "..." }
],
"meta": {
"durationMs": 3420,
"tokensUsed": 4812,
"modelUsed": "claude-sonnet-4-5"
}
}codelifter_list_tabs
json
{
"name": "codelifter_list_tabs",
"description": "List open Chrome tabs accessible to Codelifter.",
"inputSchema": {
"type": "object",
"properties": {}
}
}codelifter_get_result
json
{
"name": "codelifter_get_result",
"description": "Retrieve a previous extraction result by ID.",
"inputSchema": {
"type": "object",
"properties": {
"resultId": {
"type": "string",
"description": "Extraction result ID returned by codelifter_extract."
}
},
"required": ["resultId"]
}
}보안 모델
- localhost:12307 바인딩 — 외부 네트워크 접근 불가
- x-codelifter-token 헤더로만 인증 (shared secret)
- 웹 페이지의 CORS 직접 호출 차단 (브라우저 보호)
- 전송 데이터는 기존 /api/transform 경로와 동일
- 토큰은 언제든지 확장 설정에서 재발급 가능
- 로컬 MCP 서버는 pairing token으로 보호되며, 올바른 token 없이는 어떤 로컬 프로세스도 codelifter_extract 등 tool을 호출할 수 없습니다.
- Extension ↔ CLI 연결과 MCP client ↔ CLI 연결 모두 동일한 pairing token 체계로 검증됩니다.
- 3회 이상 인증 실패 시 해당 origin은 10분간 차단됩니다.
- token은 ~/.config/codelifter/token.json에 600 퍼미션으로 저장됩니다.
호환 MCP 클라이언트
Claude Code
Cursor
Windsurf
VS Code Copilot