Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 1.0.0 instead.
Reason given by maintainers: 废弃

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

Download files

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

Source Distribution

dataify_sdk-0.1.0.tar.gz (36.3 kB view details)

Uploaded Source

Built Distribution

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

dataify_sdk-0.1.0-py3-none-any.whl (42.1 kB view details)

Uploaded Python 3

File details

Details for the file dataify_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: dataify_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 36.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.12

File hashes

Hashes for dataify_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c71112a77c54fcc8f20d3e9b6424be7f63b8d44210ed6969e3da925ae70ffbaa
MD5 87cef777203ab75ef23ec46b20a7b0bb
BLAKE2b-256 c9297ee011b7dc1bc3cca3b96d0da1c67426e73247444336c86ad56051809817

See more details on using hashes here.

File details

Details for the file dataify_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dataify_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 42.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.12

File hashes

Hashes for dataify_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 41f801fa890cc249f4521dfe22aed990def328fd12bdd340579f10515d1022c9
MD5 d6d1a30c1401dedfbd78e803b1a3072c
BLAKE2b-256 f1e7c2881dbea3994ec5e63c8ad3890bda3f2d21cd2110502aedd8766118a083

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.0

2 files

This release

0.1.0 This release

2 files

Supported by

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