Skip to main content
Glama
bpweatherill

WebSearchAndCrawl

by bpweatherill

WebSearchAndCrawl

인증된 웹 크롤링, 검색, 문서 처리를 위한 MCP 서버

---.

🚀 목적

WebSearchAndCrawl은 다음 작업을 위해 설계된 MCP(Model Context Protocol) 서버입니다:

  1. Firefox 세션 토큰 또는 브라우저 자동화를 사용하여 웹사이트(인증이 필요한 사이트 포함)를 크롤링합니다.

  2. 크롤링된 콘텐츠에서 정규식 일치 항목을 검색하고 구조화된 색인에 결과를 저장합니다.

  3. 크롤링된 사이트에서 문서를 다운로드하고 파싱합니다(PDF, DOCX, XLSX 등).

  4. MCP 클라이언트와 통합하기 위해 HTTP를 통해 결과를 실시간으로 스트리밍합니다.

  5. robots.txt존중(준수)하고 비율 제한(초당 5회 요청, 최대 5개 스레드)을 적용합니다.

이 도구는 다음 경우에 적합합니다:

  • 인증된 웹사이트나 동적 웹사이트를 스크래핑해야 하는 연구자

  • 웹 데이터가 필요한 AI 에이전트를 구축하는 개발자

  • 반복적인 웹 작업(예: 모니터링, 데이터 추출)의 자동화


Related MCP server: Scout MCP Server

🔧 기능

기능

설명

인증 크롤링

Firefox 세션 토큰을 사용하여 로그인된 페이지에 접근합니다.

브라우저 자동화

동적 콘텐츠나 로그인 폼은 플레이라이트(Playwright)로 대체합니다.

도메인 화이트리스트

쉼표로 구분된 도메인 목록과 일치하는 URL만 크롤링합니다.

깊이 제한 크롤링

구성 가능한 크롤링 깊이(1-9 레이어).

정규식 검색

크롤링된 콘텐츠 또는 색인에서 정규식 패턴을 검색합니다.

문서 파싱

PDF, DOCX, XLSX, TXT 파일에서 텍스트를 추출합니다.

실시간 스트리밍

결과가 JSONL로 스트리밍됩니다(페이지별 청크).

색인 생성

도메인별 JSON 파일( index.json , search_results.json , metadata.json )에 결과를 저장합니다.

사후 검색

색인을 통해 크롤링된 콘텐츠 내에서 정규식 검색을 수행합니다.

다운로드

크롤링된 도메인에서 PDF 문서(*.pdf )를 다운로드합니다.

웹 검색

Firefox 검색 엔진(Firefox 기본 검색 엔진 또는 구성 가능)에서 결과를 가져옵니다.

저장

다운로드된 파일을 ./downloads(사용자 정의 가능) 디렉토리에 저장합니다.

상태 및 동작 표시

각 네트워크 작업의 상태( fetching , parsing , searching , downloading , ...) 및 작업 상태( complete , failed )를 나타냅니다.

Favicon 지원

결과 데이터에서 웹사이트 파비콘(favicon )을 가져옵니다.

검색 결과 저장

웹 검색 결과를 색인으로 저장합니다( index.json , search.json , ... ).

Gemini 통합 (선택 사항)

자동화된 콘텐츠 요약을 위해 Google Gemini API를 사용합니다(사용 시).

Firebase 통합 (선택사항)

결과를 Firebase 실시간 저장소에 저장합니다(구성).

환경 변수

.env 파일을 통한 각종 설정.

구성

로컬 구성 파일 (local/config.json ) 또는 TXT 구성 파일 (share/cfg.json ) 사용.


📦 설치

준비 사항

  1. Python 3.9+ (권장: 3.11+).

  2. Firefox (브라우저 자동화에 필요).

  3. 시스템 라이브러리 (문서 파싱용):

    • PDF: poppler-utils (Linux) 또는 pdfminer.six (크로스 플랫폼).

    • DOCX/XLSX: python-docx, openpyxl.

단계

1. 저장소 복제

git clone https://github.com/bpweatherill/WebSearchAndCrawl.git
cd WebSearchAndCrawl

2. 가상 환경 설정

python -m venv venv
source venv/bin/activate  # Linux/Mac
# OR
venv\Scripts\activate   # Windows

3. 의존성 설치

pip install -r requirements.txt

4. Playwright 브라우저 설치

playwright install firefox

5. (선택) 환경 변수 구성

프로젝트 루트에 .env 파일을 생성합니다:

# Server
MCP_PORT=8808
MCP_HOST=0.0.0.0

# Crawler
MAX_DEPTH=9
MAX_THREADS=5
RATE_LIMIT=5
REQUEST_TIMEOUT=10
MAX_MEMORY_MB=1024

# Firefox
FIREFOX_PROFILE=my_profile  # Optional: Specific Firefox profile
DEFAULT_SEARCH_ENGINE=google

# Directories
INDEX_DIR=./index
DOWNLOADS_DIR=./downloads
CHECKPOINTS_DIR=./checkpoints

🏃 사용 방법

1. MCP 서버 시작

python -m server.main

서버는 http://localhost:8808(또는 .env 에 지정된 포트)에서 시작됩니다.

2. MCP 도구(HTTP 엔드포인트)

모든 도구는 JSON 응답을 반환하며 실시간 결과를 위한 스트리밍을 지원합니다.

엔드포인트

메서드

설명

요청 본문

/crawl_website

POST

웹사이트를 크롤링하고 결과를 스트리밍합니다.

CrawlRequest

/search_index

POST

로컬 인덱스에서 정규식 일치 항목을 검색합니다.

SearchIndexRequest

/get_search_results

POST

Firefox 검색 엔진을 사용하여 결과를 가져옵니다.

WebSearchRequest

/list_domains

GET

색인된 모든 도메인 목록을 가져옵니다.

-

/crawl_status

GET

크롤링 진행 상황을 가져옵니다.

-

/health

GET

서버 상태 확인.

-


요청/응답 스키마

CrawlRequest
{
  "url": "https://www.nasa.gov",
  "whitelist_domains": "nasa.gov",
  "max_depth": 3,
  "use_token": false,
  "firefox_profile": "my_profile"
}
  • url: 크롤링할 시작 URL입니다.

  • whitelist_domains: 허용된 도메인의 쉼표로 구분된 목록 (예: "nasa.gov,spacex.com" ).

  • max_depth: 최대 크롤링 깊이(1-9).

  • use_token: 가능한 경우 Firefox 세션 토큰을 사용합니다.

  • firefox_profile: Firefox 프로필 이름 (선택 사항).

스트리밍 응답 (JSONL):

{
  "excerpt": "NASA's Perseverance Rover lands on Mars...",
  "full_text": "Full article text here...",
  "url": "https://www.nasa.gov/mars2020",
  "timestamp": "2024-05-20T12:00:00Z",
  "domain": "nasa.gov"
}

SearchIndexRequest
{
  "domain": "nasa.gov",
  "regex": ".*Mars.*",
  "max_results": 10
}
  • domain: 검색할 도메인 (예: "nasa.gov" ).

  • regex: 일치시킬 정규식 패턴.

  • max_results: 반환할 최대 결과 수.

  • omit_url: 응답에서 URL을 생략할지 여부 (false로 설정 시 결과 포함).

응답:

[
  {
    "url": "https://www.nasa.gov/mars2020",
    "excerpt": "NASA's Perseverance Rover lands on Mars...",
    "timestamp": "2024-05-20T12:00:00Z"
  }
]

WebSearchRequest
{
  "domain": "nasa.gov",
  "regex": ".*\\.pdf$",
  "output_dir": "./downloads/nasa.gov"
}
  • query: 검색어.

  • search_engine: 검색할 검색 엔진 (Firefox를 기본값으로 사용).

  • use_token: 가능한 경우 Firefox 세션 토큰을 사용합니다.

  • firefox_profile: Firefox 프로필 이름 (선택 사항).

  • style: 검색 스타일 (예: german , english ) – 독일어 및 영어를 포함한 여러 언어 지원.

  • cores: 다중 코어를 사용한 병렬 검색 (선택 사항).

스트리밍 응답 (JSONL):

{
  "filename": "./downloads/nasa.gov/mars_rover.pdf",
  "url": "https://www.nasa.gov/pdf/mars_rover.pdf",
  "parsed_text": "Extracted text from PDF..."
}

DownloadRequest
{
  "query": "NASA Mars missions",
  "search_engine": "google",
  "use_token": false,
  "firefox_profile": "my_profile"
}
  • domain: 다운로드할 도메인.

  • regex: 다운로드할 파일 형식 패턴 (예: "*.pdf" ).

  • output_dir: 사용자 정의 출력 디렉터리 (선택 사항).

스트리밍 응답 (JSONL):

{
  "title": "Mars 2020 Mission - NASA",
  "url": "https://www.nasa.gov/mars2020",
  "snippet": "Learn about the Perseverance Rover..."
}

🔍 사용 예시

1. NASA.gov 크롤링 및 결과 인덱싱

curl -X POST http://localhost:8808/crawl_website \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://www.nasa.gov",
    "whitelist_domains": "nasa.gov",
    "max_depth": 2,
    "use_token": false
  }'

2. 'Mars'에 대한 인덱싱된 콘텐츠 검색

curl -X POST http://localhost:8808/search_index \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "nasa.gov",
    "regex": ".*Mars.*",
    "max_results": 5
  }'

3. NASA.gov에서 PDF 파일 다운로드

curl -X POST http://localhost:8808/download_documents \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "nasa.gov",
    "regex": ".*\\.pdf$"
  }'

4. Firefox를 사용하여 Google 검색

curl -X POST http://localhost:8808/get_search_results \
  -H "Content-Type: application/json" \
  -d '{
    "query": "NASA Mars missions",
    "search_engine": "google"
  }'
WebSearchAndCrawl/
│
├── server/                          # Core server logic
│   ├── __init__.py
│   ├── main.py                       # FastAPI app + MCP tools
│   ├── config.py                     # Configuration settings
│   ├── schemas.py                    # Pydantic request/response models
│   │
│   ├── firefox/                      # Firefox browser automation
│   │   ├── __init__.py
│   │   ├── controller.py              # Playwright Firefox management
│   │   └── token_manager.py           # Session token handling
│   │
│   ├── crawler/                     # Web crawling logic
│   │   ├── __init__.py
│   │   ├── crawler.py                # Main crawling logic
│   │   └── rate_limiter.py            # Thread/rate limiting
│   │
│   ├── indexer/                     # Indexing and search
│   │   ├── __init__.py
│   │   ├── indexer.py                 # JSON index management
│   │   └── search_engine.py           # Regex search
│   │
│   ├── downloader/                  # Document downloading and parsing
│   │   ├── __init__.py
│   │   ├── downloader.py              # Download logic
│   │   └── parsers/                  # File type parsers
│   │       ├── __init__.py
│   │       ├── pdf_parser.py
│   │       ├── docx_parser.py
│   │       └── xlsx_parser.py
│   │
│   └── streamer.py                   # Chunked JSON streaming
│
├── tests/                           # Unit and integration tests
│   ├── __init__.py
│   ├── test_firefox.py
│   └── test_crawler.py
│
├── index/                           # Index files (auto-generated)
│   ├── nasa.gov.json
│   └── ...
│
├── downloads/                       # Downloaded documents (auto-generated)
│   ├── nasa.gov/
│   │   ├── document1.pdf
│   │   └── ...
│   └── ...
│
├── checkpoints/                     # Crawl checkpoints (auto-generated)
│   └── ...
│
├── requirements.txt                 # Python dependencies
├── .env.example                     # Example environment variables
└── README.md                        # This file

⚙️ 설정

환경 변수

구분

기본값

설명

MCP_PORT

8808

HTTP 서버 포트

MCP_HOST

0.0.0.0

HTTP 서버 호스트

MAX_DEPTH

9

최대 크롤링 깊이(1-9).

MAX_THREADS

5

최대 동시 스레드 수

RATE_LIMIT

5

초당 최대 요청 수

REQUEST_TIMEOUT

10

요청 타임아웃 (초)

MAX_MEMORY_MB

1024

최대 메모리 사용량 (MB)?

FIREFOX_PROFILE

None

Firefox 프로필 이름 (선택 사항)

DEFAULT_SEARCH_ENGINE

google

기본 검색 엔진

INDEX_DIR

./index

인덱스 파일 저장 디렉터리

DOWNLOADS_DIR

./downloads

다운로드 파일 저장 디렉터리

CHECKPOINTS_DIR

./checkpoints

크롤링 체크포인트 저장 디렉터리


🛡️ 보안 고려 사항

  1. 세션 토큰:

    • 토큰은 메모리에만 저장됩니다 (디스크에 저장되지 않음).

    • 토큰 범위는 검증되어 오용을 방지합니다 (예: nasa.gov에 대한 토큰을 evil.com에 사용할 수 없음).

  2. 입력 무결성 검사:

    • 모든 입력 (URL, 정규식 등)은 검증되어 주입 공격을 방지합니다.

  3. 요청 속도 제한:

    • 초당 5건의 요청최대 5개의 스레드를 적용하여 서버 과부하를 방지합니다.

  4. robots.txt 준수:

    • 크롤러는 robots.txt 를 존중하며 허용되지 않은 URL을 건너뜁니다.

  5. 화이트리스트:

    • 화이트리스트 도메인과 일치하는 URL만 크롤링합니다.


🚀 향후 개선 사항 (로드맵)

개선 사항

설명

우선순위

영구 토큰

토큰을 암호화된 파일에 저장하여 재시작 후에도 유지합니다.

중간

전체 robots.txt 디코딩

간단한 검사 대신 robots.txt 규칙을 올바르게 파싱합니다.

중간

고급 페이지 네비게이션

고급 페이지를 감지하고 추적합니다 (예: '다음' 버튼).

높음

지연 로드 지원

지연 로드 콘텐츠를 감지하고 트리거합니다 (무한 스크롤 등).

높음

체크포인트

크롤링 상태를 저장하여 중단된 크롤링을 재개합니다.

높음

전체 텍스트 검색

정규식 기반 외에 전체 텍스트 검색도 지원합니다.

낮음

DB백엔드

확장을 위해 JSON 파일을 SQLite/PostgreSQL로 대체합니다.

낮음

분산 크롤링

여러 작업자로 수평 확장을 지원합니다.

낮음

Docker 지원

컨테이너 배포용 Dockerfile 추가.

중간

인증 헬퍼

일반적인 인증 방식(OAuth, SAML)에 대한 지원을 기본 제공합니다.

중간

프록시 지원

방화벽 뒤의 크롤링을 위한 프록시를 지원합니다.

낮음

사용자 정의 헤더

사용자가 요청에 대한 사용자 정의 헤더를 지정할 수 있게 하십시오.

중간

사용자 정의 헤더

사용자가 요청에 대한 사용자 지정 헤더를 지정할 수 있게 합니다.

중간

  • 그 밖에도 WebSearchAndCrawl 확장하는 기능을 추가해 주십시오.


🤝 기여 방법

  1. 저장소를 포크하세요.

  2. 기능 브랜치를 만드세요 (git checkout -b feature/your-feature ).

  3. 변경 사항을 커밋하세요 (git commit -m "Add your feature").

  4. 브랜치에 푸시하세요 (git push origin feature/your-feature).

  5. Pull Request를 제출하세요.


📜 라이선스

이 프로젝트는 MIT 라이선스를 따릅니다. 자세한 내용은 LICENSE 참조하세요.


📞 지원

  • 이슈: 버그를 신고하거나 기능을 요청하려면 GitHub Issues 를 방문하세요.

  • 토론: 질문과 답변은 GitHub Discussions 에 참여하세요.


🏆 감사의 말

  • Playwright: 브라우저 자동화

  • FastAPI: HTTP 서버

  • pdfminer.six: PDF 파싱

  • python-docx/openpyxl: Office 파일 파싱

F
license - not found
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    C
    quality
    C
    maintenance
    Provides browser automation and web scraping as MCP tools, enabling autonomous URL ingestion, crawling, extraction, and anti-bot handling with interactive browser control.
    62
    5
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    A read-only Python MCP server for authorized website research, structured data extraction, downloadable-document analysis, and content auditing inside OpenCode. It crawls authorized public domains with safety constraints including robots.txt respect, SSRF defenses, bounded concurrency, and content-type allowlists.
    MIT

View all related MCP servers

Related MCP Connectors

  • Stealth web browser for agents: search, fetch, click and type through persistent sessions over MCP.

  • Browser MCP for logged-in tasks. Uses your Chrome — credentials stay local. Zero-token replay.

  • Hosted real Google Chrome MCP with per-user persistent state. Navigate, click, type, screenshot.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bpweatherill/WebSearchAndCrawl'

If you have feedback or need assistance with the MCP directory API, please join our Discord server