Scrapling MCP로 로그인 세션 유지하며 웹 스크래핑하기

Scrapling MCP의 4가지 방법(CDP 연결·real_chrome·쿠키 전달·additional_args)으로 로그인 세션을 유지하며 스크래핑하는 실무 비교 가이드

2026-08-12 · 최초 발행 2026-03-13

Scrapling MCP는 3가지 수준의 Fetcher를 제공하고, 이 중 브라우저 기반 Fetcher(fetch, stealthy_fetch)에서 로그인 세션을 유지할 수 있다.

Fetcher 도구명 브라우저 세션 유지 방법
Fetcher get 없음 (HTTP 요청) cookies 파라미터만 가능
PlayWrightFetcher fetch Playwright 브라우저 cookies, real_chrome, cdp_url
StealthyFetcher stealthy_fetch Camoufox (스텔스) cookies, real_chrome, cdp_url, additional_args

방법 1: CDP 연결 (권장)

실행 중인 Chrome 브라우저에 CDP(Chrome DevTools Protocol)로 연결해서 기존 로그인 세션을 그대로 사용하는 방법이다.

먼저 Chrome을 디버깅 모드로 실행한다.

# 기본 프로필로 실행
google-chrome --remote-debugging-port=9222

# 특정 프로필로 실행
google-chrome --remote-debugging-port=9222 --profile-directory="Profile 1"

이미 Chrome이 실행 중이었다면 닫고 위 명령어로 다시 실행해야 한다.

그 다음 Claude Code에서 cdp_url로 접근하면 된다.

# fetch 도구 사용
→ fetch: url="https://redmine.example.com", cdp_url="http://localhost:9222"

# stealthy_fetch 도구 사용
→ stealthy_fetch: url="https://redmine.example.com", cdp_url="http://localhost:9222"

이 방식의 장점은 Chrome에 로그인된 모든 사이트의 세션이 유지된다는 점이다. 쿠키를 수동으로 복사할 필요가 없고, 확장 프로그램·localStorage 등도 모두 그대로 사용할 수 있다.

다만 Chrome을 반드시 --remote-debugging-port 옵션과 함께 실행해야 하고, 보안상 로컬에서만 사용하는 게 좋다(외부 노출 금지).

방법 2: real_chrome 옵션

로컬에 설치된 Chrome 브라우저를 직접 실행해서 쓰는 방법이다.

# fetch 도구
→ fetch: url="https://example.com", real_chrome=true

# stealthy_fetch 도구
→ stealthy_fetch: url="https://example.com", real_chrome=true

로컬 Chrome 바이너리를 사용하므로 실제 브라우저 핑거프린트가 제공되고 봇 탐지 우회에 유리하다. 다만 새 프로필로 실행되기 때문에 기존 로그인 세션은 유지되지 않는다. 세션이 필요하면 방법 1(CDP)이나 방법 3(쿠키 전달)과 병행해야 한다.

방법 3: 쿠키 수동 전달

Chrome DevTools에서 쿠키를 복사해 직접 전달하는 방법이다.

1. Chrome에서 대상 사이트에 로그인
2. F12 → Application 탭 → Cookies → 해당 도메인
3. 필요한 쿠키 이름과 값을 복사

get 도구에서는 이런 식으로 전달한다.

{
  "url": "https://redmine.example.com",
  "cookies": {
    "_redmine_session": "abc123...",
    "autologin": "xyz789..."
  }
}

fetch·stealthy_fetch 도구는 Playwright 형식의 쿠키 배열을 받는다.

{
  "url": "https://redmine.example.com",
  "cookies": [
    {
      "name": "_redmine_session",
      "value": "abc123...",
      "domain": "redmine.example.com",
      "path": "/"
    },
    {
      "name": "autologin",
      "value": "xyz789...",
      "domain": "redmine.example.com",
      "path": "/",
      "httpOnly": true,
      "secure": true
    }
  ]
}

세션 쿠키는 만료될 수 있어서 주기적으로 갱신해야 하고, httpOnly 쿠키는 DevTools에서만 확인할 수 있다는 점도 감안해야 한다.

방법 4: additional_args (stealthy_fetch 전용)

stealthy_fetchadditional_args를 쓰면 Playwright 컨텍스트 설정을 직접 전달할 수 있다.

Playwright의 storageState를 쓰면 쿠키와 localStorage를 한 번에 전달할 수 있다.

{
  "url": "https://example.com/dashboard",
  "additional_args": {
    "storageState": {
      "cookies": [
        {
          "name": "session",
          "value": "abc123",
          "domain": "example.com",
          "path": "/"
        }
      ],
      "origins": [
        {
          "origin": "https://example.com",
          "localStorage": [{ "name": "token", "value": "eyJhbG..." }]
        }
      ]
    }
  }
}

매번 값을 직접 채워 넣는 대신 storageState를 파일로 저장해 재사용할 수도 있다.

# 1. Playwright로 로그인 후 상태 저장 (Python 스크립트)
python3 -c "
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
    browser = p.chromium.launch(headless=False)
    context = browser.new_context()
    page = context.new_page()
    page.goto('https://example.com/login')
    # 수동 로그인 후...
    input('로그인 완료 후 Enter를 누르세요...')
    context.storage_state(path='storage-state.json')
    browser.close()
"

# 2. 저장된 파일을 additional_args에서 참조
{
  "url": "https://example.com/dashboard",
  "additional_args": {
    "storageState": "/path/to/storage-state.json"
  }
}

방법 비교

네 가지 방법을 한 번에 비교하면 다음과 같다.

항목 CDP 연결 real_chrome 쿠키 전달 additional_args
사용 도구 fetch, stealthy_fetch fetch, stealthy_fetch get, fetch, stealthy_fetch stealthy_fetch만
기존 세션 유지 O X 수동 수동
설정 난이도
모든 사이트 적용 O X 사이트별 사이트별
세션 갱신 자동 - 수동 수동
봇 탐지 우회 높음 높음 낮음 (get) 매우 높음

상황별로는 이렇게 나눠서 쓰면 된다.

상황 추천 방법
로그인된 사이트 크롤링 방법 1: CDP 연결
봇 탐지 우회 + 세션 필요 방법 1 + stealthy_fetch
간단한 API 호출 (인증 필요) 방법 3: 쿠키 전달 (get)
복잡한 SPA 사이트 방법 4: additional_args

OpenChrome과의 비교

같은 목적으로 쓸 수 있는 OpenChrome과 비교하면 역할이 갈린다.

항목 OpenChrome Scrapling
프로필 연결 --profile-directory 옵션 (간편) CDP 또는 수동 쿠키 전달
세션 동기화 자동 (쿠키 동기화) CDP 시 자동, 그 외 수동
페이지 조작 navigate, interact, find 등 읽기 전용 (스크래핑 특화)
봇 탐지 우회 보통 높음 (StealthyFetcher)
Cloudflare 우회 X O (stealthy_fetch)
용도 웹 자동화, 인터랙션 데이터 수집, 스크래핑

페이지 조작이 필요하면 OpenChrome, 데이터 수집이 목적이면 Scrapling을 쓴다. 둘 다 로그인 세션 유지가 가능하지만, 프로필 연결 자체는 OpenChrome이 더 간편하다.

빠른 시작: Chrome CDP 연결

가장 빠르게 시작하는 방법은 CDP 연결이다.

# 1. Chrome을 디버깅 모드로 실행 (로그인된 프로필 사용)
google-chrome --remote-debugging-port=9222 --profile-directory="Profile 1"
# 2. Claude Code에서 Scrapling으로 접근
→ stealthy_fetch:
    url="https://target-site.com/dashboard"
    cdp_url="http://localhost:9222"

이것만으로 Chrome에 로그인된 모든 사이트에 인증 상태로 접근할 수 있다.

ScraplingMCP웹 스크래핑CDPPlaywright