Metadata-Version: 2.5
Name: parhelyx-mcp
Version: 0.1.0
Summary: Official MCP server for the Parhelyx scraping API: turn any URL into clean, LLM-ready Markdown.
Project-URL: Homepage, https://parhelyx.com
License: MIT
License-File: LICENSE
Keywords: ai-agents,llm,markdown,mcp,model-context-protocol,web-scraping
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27.0
Requires-Dist: mcp<2,>=1.2.0
Description-Content-Type: text/markdown

# parhelyx-mcp

Official [Model Context Protocol](https://modelcontextprotocol.io) server for the **Parhelyx** scraping API. It gives your AI agent the ability to read any web page as clean Markdown and to discover links to navigate a site.

## Tools

| Tool | Description |
| --- | --- |
| `scrape_url(url, only_main_content=True, proxy_tier="datacenter")` | Returns the page as clean Markdown. |
| `extract_links(url)` | Returns every link on the page so the agent can crawl. |

## Install & run

```bash
# Zero-install (recommended)
uvx parhelyx-mcp

# or with pip
pip install parhelyx-mcp
parhelyx-mcp
```

From a local checkout: `uvx --from . parhelyx-mcp` or `pip install -e .`.

## Configuration

| Variable | Required | Default |
| --- | --- | --- |
| `PARHELYX_API_KEY` | yes | - |
| `PARHELYX_API_URL` | no | `https://parhelyx.com` |

The legacy names `WEB2LLM_API_KEY` and `WEB2LLM_API_URL` are still accepted as a fallback when the `PARHELYX_*` variables are not set.

## Example MCP client config

```json
{
  "mcpServers": {
    "parhelyx": {
      "command": "uvx",
      "args": ["parhelyx-mcp"],
      "env": { "PARHELYX_API_KEY": "YOUR_API_KEY" }
    }
  }
}
```

The same block works in any MCP client (Claude Desktop, Cursor, Windsurf, ...): add it to the client's MCP configuration and restart the client. Get a free API key at [parhelyx.com/register](https://parhelyx.com/register).

## Errors

Failures are returned to the agent as readable text starting with `Error:`, with a hint for each case: 401 (invalid key), 402 (no credits), 403 (plan does not allow the request, e.g. residential proxies), 422 (rejected URL or parameters), 429 (rate limit, with `Retry-After`) and 5xx (service unavailable).

## Development

```bash
pip install -e . pytest
pytest tests                       # offline, HTTP is mocked, no credits spent

# Live check against a deployment (PowerShell: $env:PARHELYX_API_KEY = "...")
python scripts/smoke_test.py --no-spend   # key-less checks only
python scripts/smoke_test.py              # + one scrape_url and one extract_links (~2 credits)
```
