Skip to main content

LionScraper bridge daemon, thin MCP stdio, and CLI — local HTTP + WebSocket to Chrome extension (Python)

Project description

LionScraper (Python)

Python edition of LionScraper: a local HTTP + WebSocket daemon that talks to the Chrome/Edge LionScraper extension, plus a thin MCP server over stdio that forwards tool calls to the daemon. Behavior is intended to match the npm/packages/node implementation in this repository.

Requirements

  • Python 3.10+
  • The LionScraper browser extension installed and configured to use the same PORT as the daemon (default 13808).

Install

From PyPI (when published):

pip install lionscraper

From a checkout of this repo:

cd packages/python
pip install -e ".[dev]"

Commands

Command Role
lionscraper Full CLI (daemon, stop, scrape, ping, …).
lionscraper-mcp If no extra arguments: thin MCP over stdio. Any extra argument delegates to the same CLI as lionscraper.

Equivalent module entry:

python -m lionscraper --help
python -m lionscraper daemon

MCP client configuration

Use lionscraper-mcp as the MCP server command (no arguments) so the host spawns thin MCP stdio:

{
  "mcpServers": {
    "lionscraper": {
      "command": "lionscraper-mcp",
      "env": {
        "PORT": "13808",
        "LANG": "en-US"
      }
    }
  }
}

To run the same routing as lionscraper-mcp via Python (stdio MCP when there are no extra arguments after the module name):

"command": "python",
"args": ["-m", "lionscraper"]

Thin stdio mode is selected only when sys.argv after the program entry has length 0 (same as Node). Any extra token (including --debug) selects the CLI path instead.

Environment variables

Variable Meaning
PORT HTTP + WebSocket listen port (default 13808). Must match the extension bridge port.
TOKEN Optional bearer token for Authorization on loopback HTTP.
DAEMON Set to 0 to disable auto-start of the daemon from CLI / thin MCP.
TIMEOUT Default timeout hints (see root repo docs).
LANG Locale for log and tool metadata (en-US / zh-CN).

PyPI release (maintainers)

cd packages/python
python -m pip install build twine
python -m build
python -m twine upload dist/*

Project name on PyPI: lionscraper (single package providing both console scripts).

Parity with Node

This package mirrors packages/node: bridge protocol, daemon HTTP API (/v1/health, /v1/daemon/shutdown, /v1/tools/call with optional NDJSON progress), port probing, and tool input validation (Pydantic vs Zod). Locale JSON is copied under src/locale/ so the Python wheel does not depend on the Node tree.

Development tests

cd packages/python
pytest

Manual smoke test

  1. Start the daemon: lionscraper daemon (or let CLI / lionscraper-mcp auto-spawn with default DAEMON).
  2. Connect the extension to ws://127.0.0.1:<PORT> (same as HTTP).
  3. curl -s http://127.0.0.1:13808/v1/health — expect JSON with "ok": true and identity lionscraper when ready.
  4. Run lionscraper-mcp with no args under an MCP host and list tools — expect ping, scrape, scrape_article, etc.

Chinese documentation: README_cn.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lionscraper-1.0.2.tar.gz (57.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lionscraper-1.0.2-py3-none-any.whl (67.9 kB view details)

Uploaded Python 3

File details

Details for the file lionscraper-1.0.2.tar.gz.

File metadata

  • Download URL: lionscraper-1.0.2.tar.gz
  • Upload date:
  • Size: 57.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for lionscraper-1.0.2.tar.gz
Algorithm Hash digest
SHA256 a3ddf51b145c3387d9aa8393b6d5dc75ac218f063ba1f93fec9f6e2a5d6e6643
MD5 d7d635ba36ee7e5dab3b21e053ed6b3b
BLAKE2b-256 01ca19676edb910d138a385be1eaaf67f1a07158430425581d4602bc7d948872

See more details on using hashes here.

File details

Details for the file lionscraper-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: lionscraper-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 67.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for lionscraper-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 28525f36069208dfb5e9d31d089e03eddbbc86da6c4541da94bf558c81b10613
MD5 76af9f13963ab44a3773ee395c976ea6
BLAKE2b-256 fbc2857c78db2cf6f40d2fff0bdf57377a4f804b976cbfdf6e619a11f376ff47

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page