Python SDK for the Dataify MCP API — access web unlocker, search engines, and platform scrapers.
Project description
Dataify MCP Python SDK
Python 客户端库,用于通过 MCP (Model Context Protocol) 访问 Dataify 数据采集平台。
功能
- 🌐 网页解锁器 — 绕过 CAPTCHA、JS 渲染,返回 HTML 或 PNG 截图
- 🔍 搜索引擎 — Google(17 种搜索类型)、Bing(6 种)、Yandex、DuckDuckGo
- 🛒 平台抓取器 — Amazon、YouTube、TikTok、Facebook、Instagram、Reddit、Twitter/X、LinkedIn、Glassdoor、Indeed 等 35+ 平台
- ⚡ 异步优先 — 基于
httpx的现代异步 API - 🛡️ 类型安全 — 完整的类型注解,支持
mypy --strict - 🔌 双传输模式 — 支持 Streamable HTTP 和 SSE
安装
pip install dataify-mcp
要求 Python >= 3.10。
快速开始
import asyncio
from dataify_mcp import DataifyClient
async def main():
async with DataifyClient(
base_url="http://localhost:7780",
token="your-api-token",
) as client:
# 列出可用工具
tools = await client.list_tools()
print(f"可用工具: {len(tools)} 个")
# 调用 Google 搜索
result = await client.call_tool("google_search", {
"q": "今天天气",
"gl": "cn",
"hl": "zh-cn",
})
print(result)
asyncio.run(main())
连接方式
Streamable HTTP(默认)
client = DataifyClient(
base_url="http://localhost:7780",
token="your-token",
transport="http", # 默认值
)
SSE(Server-Sent Events)
client = DataifyClient(
base_url="http://localhost:7780",
token="your-token",
transport="sse",
)
工具权限过滤
# 只使用指定的工具类别
client = DataifyClient(
base_url="http://localhost:7780",
token="your-token",
tool_codes="serp,google", # 多个用逗号分隔
)
错误处理
from dataify_mcp import (
DataifyClient,
AuthenticationError,
ToolError,
ConnectionError,
)
try:
async with DataifyClient("http://localhost:7780", "token") as client:
result = await client.call_tool("google_search", {"q": "test"})
except AuthenticationError:
print("Token 无效,请检查 https://dashboard.dataify.com")
except ToolError as e:
print(f"工具执行失败: {e}")
except ConnectionError:
print("无法连接服务器")
开发
# 安装开发依赖
pip install -e ".[dev]"
# 代码检查
ruff check src/dataify_mcp/
mypy src/dataify_mcp/
# 运行测试
pytest
# 生成工具封装代码
python scripts/codegen.py --server http://localhost:7780 --token YOUR_TOKEN
许可
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dataify_mcp-0.1.0.tar.gz
(35.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dataify_mcp-0.1.0.tar.gz.
File metadata
- Download URL: dataify_mcp-0.1.0.tar.gz
- Upload date:
- Size: 35.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76d15da9eb682498a19d21481c84d4ea2537c9f9bae09e563a702e2d48494f8f
|
|
| MD5 |
fbe8fbfdc0a67ba07a4b9e95a1f7a72c
|
|
| BLAKE2b-256 |
39649fd1b314d80a7a2cc549ec18267bd6f3d330ea3c2eceb2a5a35c39ee7ae6
|
File details
Details for the file dataify_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dataify_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 41.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3c831406ca16d8ae7c31b1dcf5f22f4e7e8f1654333d9940b6d41df9591de17
|
|
| MD5 |
a56ad0c2494a03627c835173a14efb8b
|
|
| BLAKE2b-256 |
1ea8bea466476fd4f1f97c6c11a6e56a6a69741c8a2eecae10e1f8ae965f20e3
|