dataxapi-mcp 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ node_modules/
2
+ __pycache__/
3
+ *.egg-info/
4
+ dist/
5
+ .venv/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DataXAPI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,121 @@
1
+ Metadata-Version: 2.5
2
+ Name: dataxapi-mcp
3
+ Version: 0.1.0
4
+ Summary: DataXAPI's MCP server on stdio: public data from Douyin, Xiaohongshu (RedNote), WeChat Official Accounts and Channels, Weibo, Bilibili, Zhihu, Kuaishou, TikTok, X, YouTube and more for Claude, Cursor and any MCP client. 抖音、小红书、公众号、视频号数据 MCP. Paid per call, errors are not charged.
5
+ Project-URL: Homepage, https://dataxapi.com/?ref=pypi-dataxapi-mcp
6
+ Project-URL: Source, https://github.com/data-x-api/dataxapi-mcp
7
+ Project-URL: Documentation, https://dataxapi.com/mcp/
8
+ Author-email: DataXAPI <support@dataxapi.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: bilibili,dataxapi,douyin,mcp,mcp-server,rednote,social-media-api,tiktok,wechat,weibo,xiaohongshu,zhihu,公众号,小红书,抖音
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Internet
15
+ Requires-Python: >=3.10
16
+ Requires-Dist: anyio>=4
17
+ Requires-Dist: mcp<2,>=1.9
18
+ Description-Content-Type: text/markdown
19
+
20
+ # DataXAPI MCP server
21
+
22
+ Public data from Douyin, Xiaohongshu (RedNote), WeChat Official Accounts and Channels, WeChat Search, Weibo, Bilibili, Zhihu and Kuaishou, plus Douyin's trend index, Xiaohongshu PGY and Douyin Xingtu creator data, TikTok, X, YouTube, Instagram, Reddit and more, for Claude, Cursor, Cherry Studio, Cline, Gemini CLI and any MCP client.
23
+
24
+ - **No platform account, cookie or QR login.** One DataXAPI key.
25
+ - **Pay per call, errors are not charged.** Every result states what it cost and the balance left. `find`, `describe` and `account` are free, and `find` and `describe` need no key, so an agent can check whether the data exists and what it costs before anyone signs up.
26
+ - **Free trial: up to 333 calls, no card.** Top up from $10; the balance does not expire.
27
+
28
+ Two ways to connect: the hosted server directly (no install), or this package, for clients that only start local servers.
29
+
30
+ 中文说明在下面:[中文](#中文)
31
+
32
+ ## Hosted server (no install)
33
+
34
+ ```
35
+ https://api.dataxapi.com/mcp
36
+ ```
37
+
38
+ Send `Authorization: Bearer <your key>`, or sign in with OAuth (ChatGPT, Claude). Claude Code:
39
+
40
+ ```bash
41
+ claude mcp add --transport http --scope user dataxapi https://api.dataxapi.com/mcp --header "Authorization: Bearer $DATAXAPI_API_KEY"
42
+ ```
43
+
44
+ ## This package: the same server on stdio
45
+
46
+ ```json
47
+ {
48
+ "mcpServers": {
49
+ "dataxapi": {
50
+ "command": "npx",
51
+ "args": ["-y", "@dataxapi/mcp"],
52
+ "env": { "DATAXAPI_API_KEY": "dx_..." }
53
+ }
54
+ }
55
+ }
56
+ ```
57
+
58
+ Python instead of Node: `"command": "uvx", "args": ["--from", "git+https://github.com/data-x-api/dataxapi-mcp#subdirectory=python", "dataxapi-mcp"]`.
59
+
60
+ The PyPI package is not out yet; until it is, the Python command runs the same code straight from this repository.
61
+
62
+ That block goes in:
63
+
64
+ | Client | Where |
65
+ |---|---|
66
+ | Claude Desktop | Settings → Developer → Edit Config (`claude_desktop_config.json`) |
67
+ | Cursor | `~/.cursor/mcp.json` |
68
+ | Cherry Studio | Settings → MCP servers → Add → Import from JSON |
69
+ | Cline, Roo Code | MCP Servers → Configure → `cline_mcp_settings.json` |
70
+ | Windsurf | `~/.codeium/windsurf/mcp_config.json` |
71
+ | VS Code | `.vscode/mcp.json`, under `"servers"` |
72
+ | Gemini CLI | `gemini extensions install https://github.com/data-x-api/dataxapi-mcp` |
73
+ | Codex | `~/.codex/config.toml`: `[mcp_servers.dataxapi]` with `command = "npx"`, `args = ["-y", "@dataxapi/mcp"]`, `env = { DATAXAPI_API_KEY = "dx_..." }` |
74
+
75
+ Get a key: <https://dataxapi.com/console/keys/?ref=dataxapi-mcp>. Without one, `find`, `describe` and `account` status still work; a paid call answers with how to add a key, and nothing is charged.
76
+
77
+ The package only forwards: tools, their descriptions and every answer come from the hosted server, so it never falls behind the catalog. A `call` without an `idempotency_key` gets one, so an answer lost on the way can be fetched again without paying twice.
78
+
79
+ ## Tools
80
+
81
+ | Tool | What it does | Cost |
82
+ |---|---|---|
83
+ | `find` | The endpoint for a need in plain words, English or Chinese, with its parameters, price and a ready call | free, no key |
84
+ | `describe` | One to five endpoints in full: every parameter and value, fields, paging, price, examples | free, no key |
85
+ | `call` | One page of data from one endpoint | that endpoint's price; errors are not charged |
86
+ | `read_more` | The rest of a long result, or it in another view | free |
87
+ | `account` | Balance, receipts, usage by day or endpoint, which endpoints are up | free |
88
+
89
+ Ask in plain words, for example:
90
+
91
+ - “这个小红书关键词最近一周最火的 20 篇笔记,按点赞排,列出标题、作者和链接”
92
+ - “Get the comments on this Douyin video and sort them into praise and complaints”
93
+ - “比较这三个公众号最近 10 篇文章的阅读数”
94
+ - “What has this keyword's Douyin search index done over the last 90 days?”
95
+
96
+ Every endpoint and its price: <https://dataxapi.com/apis/>. Recorded answers and runnable scripts per platform: [douyin-api](https://github.com/data-x-api/douyin-api), [wechat-api](https://github.com/data-x-api/wechat-api).
97
+
98
+ ## 中文
99
+
100
+ 在 Claude、Cursor、Cherry Studio、Cline、Gemini CLI 等任何 MCP 客户端里,取抖音(含巨量算数、星图)、小红书(含蒲公英)、公众号、视频号、微信搜一搜、微博、B站、知乎、快手,以及 TikTok、X、YouTube 等平台的公开数据。
101
+
102
+ - **不用平台账号、不用 Cookie、不用扫码**,一把 DataXAPI Key。
103
+ - **按次付费,出错不收费。**每次结果写明扣了多少、还剩多少。`find`、`describe`、`account` 免费,前两个不用 Key。
104
+ - **免费试用,最多 333 次,不用绑卡。**最低充 $10,余额不过期;支付宝、微信支付、银行卡都能付。
105
+
106
+ 能直接连远程地址的客户端,用 `https://api.dataxapi.com/mcp` 加 `Authorization: Bearer <你的 Key>` 就行,不用装任何东西。只能启动本地服务的客户端,把上面那段 `mcpServers` 配置贴进去(Node 用 `npx -y @dataxapi/mcp`,Python 用 `uvx --from "git+https://github.com/data-x-api/dataxapi-mcp#subdirectory=python" dataxapi-mcp`;PyPI 包还没发布,发布前 Python 这条直接从本仓库运行同一份代码)。
107
+
108
+ 拿 Key:<https://dataxapi.com/zh/console/keys/?ref=dataxapi-mcp>。全部接口和价格:<https://dataxapi.com/zh/apis/>。
109
+
110
+ ## Develop
111
+
112
+ ```bash
113
+ npm install
114
+ npm test # starts the package over stdio against the hosted server with no key; spends nothing
115
+ ```
116
+
117
+ ## License
118
+
119
+ MIT
120
+
121
+ <!-- mcp-name: com.dataxapi/mcp -->
@@ -0,0 +1,102 @@
1
+ # DataXAPI MCP server
2
+
3
+ Public data from Douyin, Xiaohongshu (RedNote), WeChat Official Accounts and Channels, WeChat Search, Weibo, Bilibili, Zhihu and Kuaishou, plus Douyin's trend index, Xiaohongshu PGY and Douyin Xingtu creator data, TikTok, X, YouTube, Instagram, Reddit and more, for Claude, Cursor, Cherry Studio, Cline, Gemini CLI and any MCP client.
4
+
5
+ - **No platform account, cookie or QR login.** One DataXAPI key.
6
+ - **Pay per call, errors are not charged.** Every result states what it cost and the balance left. `find`, `describe` and `account` are free, and `find` and `describe` need no key, so an agent can check whether the data exists and what it costs before anyone signs up.
7
+ - **Free trial: up to 333 calls, no card.** Top up from $10; the balance does not expire.
8
+
9
+ Two ways to connect: the hosted server directly (no install), or this package, for clients that only start local servers.
10
+
11
+ 中文说明在下面:[中文](#中文)
12
+
13
+ ## Hosted server (no install)
14
+
15
+ ```
16
+ https://api.dataxapi.com/mcp
17
+ ```
18
+
19
+ Send `Authorization: Bearer <your key>`, or sign in with OAuth (ChatGPT, Claude). Claude Code:
20
+
21
+ ```bash
22
+ claude mcp add --transport http --scope user dataxapi https://api.dataxapi.com/mcp --header "Authorization: Bearer $DATAXAPI_API_KEY"
23
+ ```
24
+
25
+ ## This package: the same server on stdio
26
+
27
+ ```json
28
+ {
29
+ "mcpServers": {
30
+ "dataxapi": {
31
+ "command": "npx",
32
+ "args": ["-y", "@dataxapi/mcp"],
33
+ "env": { "DATAXAPI_API_KEY": "dx_..." }
34
+ }
35
+ }
36
+ }
37
+ ```
38
+
39
+ Python instead of Node: `"command": "uvx", "args": ["--from", "git+https://github.com/data-x-api/dataxapi-mcp#subdirectory=python", "dataxapi-mcp"]`.
40
+
41
+ The PyPI package is not out yet; until it is, the Python command runs the same code straight from this repository.
42
+
43
+ That block goes in:
44
+
45
+ | Client | Where |
46
+ |---|---|
47
+ | Claude Desktop | Settings → Developer → Edit Config (`claude_desktop_config.json`) |
48
+ | Cursor | `~/.cursor/mcp.json` |
49
+ | Cherry Studio | Settings → MCP servers → Add → Import from JSON |
50
+ | Cline, Roo Code | MCP Servers → Configure → `cline_mcp_settings.json` |
51
+ | Windsurf | `~/.codeium/windsurf/mcp_config.json` |
52
+ | VS Code | `.vscode/mcp.json`, under `"servers"` |
53
+ | Gemini CLI | `gemini extensions install https://github.com/data-x-api/dataxapi-mcp` |
54
+ | Codex | `~/.codex/config.toml`: `[mcp_servers.dataxapi]` with `command = "npx"`, `args = ["-y", "@dataxapi/mcp"]`, `env = { DATAXAPI_API_KEY = "dx_..." }` |
55
+
56
+ Get a key: <https://dataxapi.com/console/keys/?ref=dataxapi-mcp>. Without one, `find`, `describe` and `account` status still work; a paid call answers with how to add a key, and nothing is charged.
57
+
58
+ The package only forwards: tools, their descriptions and every answer come from the hosted server, so it never falls behind the catalog. A `call` without an `idempotency_key` gets one, so an answer lost on the way can be fetched again without paying twice.
59
+
60
+ ## Tools
61
+
62
+ | Tool | What it does | Cost |
63
+ |---|---|---|
64
+ | `find` | The endpoint for a need in plain words, English or Chinese, with its parameters, price and a ready call | free, no key |
65
+ | `describe` | One to five endpoints in full: every parameter and value, fields, paging, price, examples | free, no key |
66
+ | `call` | One page of data from one endpoint | that endpoint's price; errors are not charged |
67
+ | `read_more` | The rest of a long result, or it in another view | free |
68
+ | `account` | Balance, receipts, usage by day or endpoint, which endpoints are up | free |
69
+
70
+ Ask in plain words, for example:
71
+
72
+ - “这个小红书关键词最近一周最火的 20 篇笔记,按点赞排,列出标题、作者和链接”
73
+ - “Get the comments on this Douyin video and sort them into praise and complaints”
74
+ - “比较这三个公众号最近 10 篇文章的阅读数”
75
+ - “What has this keyword's Douyin search index done over the last 90 days?”
76
+
77
+ Every endpoint and its price: <https://dataxapi.com/apis/>. Recorded answers and runnable scripts per platform: [douyin-api](https://github.com/data-x-api/douyin-api), [wechat-api](https://github.com/data-x-api/wechat-api).
78
+
79
+ ## 中文
80
+
81
+ 在 Claude、Cursor、Cherry Studio、Cline、Gemini CLI 等任何 MCP 客户端里,取抖音(含巨量算数、星图)、小红书(含蒲公英)、公众号、视频号、微信搜一搜、微博、B站、知乎、快手,以及 TikTok、X、YouTube 等平台的公开数据。
82
+
83
+ - **不用平台账号、不用 Cookie、不用扫码**,一把 DataXAPI Key。
84
+ - **按次付费,出错不收费。**每次结果写明扣了多少、还剩多少。`find`、`describe`、`account` 免费,前两个不用 Key。
85
+ - **免费试用,最多 333 次,不用绑卡。**最低充 $10,余额不过期;支付宝、微信支付、银行卡都能付。
86
+
87
+ 能直接连远程地址的客户端,用 `https://api.dataxapi.com/mcp` 加 `Authorization: Bearer <你的 Key>` 就行,不用装任何东西。只能启动本地服务的客户端,把上面那段 `mcpServers` 配置贴进去(Node 用 `npx -y @dataxapi/mcp`,Python 用 `uvx --from "git+https://github.com/data-x-api/dataxapi-mcp#subdirectory=python" dataxapi-mcp`;PyPI 包还没发布,发布前 Python 这条直接从本仓库运行同一份代码)。
88
+
89
+ 拿 Key:<https://dataxapi.com/zh/console/keys/?ref=dataxapi-mcp>。全部接口和价格:<https://dataxapi.com/zh/apis/>。
90
+
91
+ ## Develop
92
+
93
+ ```bash
94
+ npm install
95
+ npm test # starts the package over stdio against the hosted server with no key; spends nothing
96
+ ```
97
+
98
+ ## License
99
+
100
+ MIT
101
+
102
+ <!-- mcp-name: com.dataxapi/mcp -->
@@ -0,0 +1,104 @@
1
+ """DataXAPI's MCP server on stdio: forwards to the hosted server at https://api.dataxapi.com/mcp.
2
+
3
+ Run it with ``uvx dataxapi-mcp`` (or ``pipx run dataxapi-mcp``). The key comes from DATAXAPI_API_KEY;
4
+ find, describe and account status work without one. Paid per call; errors are not charged.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import os
10
+ import sys
11
+ import uuid
12
+ from contextlib import AsyncExitStack
13
+
14
+ import anyio
15
+ import mcp.types as types
16
+ from mcp.client.session import ClientSession
17
+ from mcp.client.streamable_http import streamablehttp_client
18
+ from mcp.server.lowlevel import NotificationOptions, Server
19
+ from mcp.server.models import InitializationOptions
20
+ from mcp.server.stdio import stdio_server
21
+
22
+ __version__ = "0.1.0"
23
+ DEFAULT_MCP_URL = "https://api.dataxapi.com/mcp"
24
+ KEYS_URL = "https://dataxapi.com/console/keys/?ref=dataxapi-mcp-pypi"
25
+ CALL_TIMEOUT_SECONDS = 180
26
+
27
+
28
+ def _key_needed(tool: str) -> str:
29
+ return (
30
+ f"{tool} needs a DataXAPI API key, and dataxapi-mcp was started without one: nothing was charged. "
31
+ f'Add DATAXAPI_API_KEY to the "env" of the dataxapi server in your MCP client\'s config (make a key at {KEYS_URL}; '
32
+ "free trial: up to 333 calls, no card), then restart the client. find, describe and account status work without a key."
33
+ )
34
+
35
+
36
+ def _error(text: str) -> types.CallToolResult:
37
+ return types.CallToolResult(content=[types.TextContent(type="text", text=text)], isError=True)
38
+
39
+
40
+ async def _serve() -> None:
41
+ url = os.environ.get("DATAXAPI_MCP_URL", "").strip() or DEFAULT_MCP_URL
42
+ key = os.environ.get("DATAXAPI_API_KEY", "").strip()
43
+ headers = {"User-Agent": f"dataxapi-mcp/{__version__} python", "X-Source": "dataxapi-mcp-pypi"}
44
+ if key:
45
+ headers["Authorization"] = f"Bearer {key}"
46
+
47
+ async with AsyncExitStack() as stack:
48
+ read, write, _ = await stack.enter_async_context(streamablehttp_client(url, headers=headers))
49
+ remote = await stack.enter_async_context(ClientSession(read, write))
50
+ hello = await remote.initialize()
51
+
52
+ server: Server = Server(hello.serverInfo.name, version=hello.serverInfo.version, instructions=hello.instructions)
53
+
54
+ @server.list_tools()
55
+ async def list_tools() -> list[types.Tool]:
56
+ return (await remote.list_tools()).tools
57
+
58
+ @server.call_tool(validate_input=False)
59
+ async def call_tool(name: str, arguments: dict) -> types.CallToolResult:
60
+ args = dict(arguments or {})
61
+ # The hosted server answers these with 401 when there is no key, and the Python client's transport ends
62
+ # the whole session on a 401; say what to do here instead, before anything is sent.
63
+ if not key and (name in ("call", "read_more") or (name == "account" and args.get("what") != "status")):
64
+ return _error(_key_needed(name))
65
+ if name == "call" and "idempotency_key" not in args:
66
+ args["idempotency_key"] = str(uuid.uuid4()) # resend with it to get a lost answer, charged once
67
+ try:
68
+ with anyio.fail_after(CALL_TIMEOUT_SECONDS):
69
+ return await remote.call_tool(name, args)
70
+ except Exception as error: # the hosted server refused or did not answer
71
+ text = str(error)
72
+ if "401" in text and not key:
73
+ return _error(_key_needed(name))
74
+ if name != "call":
75
+ return _error(f"dataxapi-mcp got no usable answer ({text}). {name} is free: try again.")
76
+ return _error(
77
+ f"dataxapi-mcp got no usable answer ({text}). The call may have run. To get its result without "
78
+ f"paying twice, send the same call again with idempotency_key \"{args['idempotency_key']}\"."
79
+ )
80
+
81
+ async with stdio_server() as (stdin, stdout):
82
+ await server.run(
83
+ stdin,
84
+ stdout,
85
+ InitializationOptions(
86
+ server_name=hello.serverInfo.name,
87
+ server_version=hello.serverInfo.version,
88
+ capabilities=server.get_capabilities(NotificationOptions(), {}),
89
+ instructions=hello.instructions,
90
+ ),
91
+ )
92
+
93
+
94
+ def main() -> None:
95
+ if len(sys.argv) > 1 and sys.argv[1] in ("--version", "-v"):
96
+ print(__version__)
97
+ return
98
+ if len(sys.argv) > 1:
99
+ print(__doc__)
100
+ return
101
+ try:
102
+ anyio.run(_serve)
103
+ except KeyboardInterrupt:
104
+ pass
@@ -0,0 +1,3 @@
1
+ from dataxapi_mcp import main
2
+
3
+ main()
@@ -0,0 +1,23 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "dataxapi-mcp"
7
+ version = "0.1.0"
8
+ description = "DataXAPI's MCP server on stdio: public data from Douyin, Xiaohongshu (RedNote), WeChat Official Accounts and Channels, Weibo, Bilibili, Zhihu, Kuaishou, TikTok, X, YouTube and more for Claude, Cursor and any MCP client. 抖音、小红书、公众号、视频号数据 MCP. Paid per call, errors are not charged."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ authors = [{ name = "DataXAPI", email = "support@dataxapi.com" }]
13
+ keywords = ["mcp", "mcp-server", "dataxapi", "douyin", "xiaohongshu", "rednote", "wechat", "weibo", "bilibili", "zhihu", "tiktok", "social-media-api", "抖音", "小红书", "公众号"]
14
+ classifiers = ["Programming Language :: Python :: 3", "Operating System :: OS Independent", "Topic :: Internet"]
15
+ dependencies = ["mcp>=1.9,<2", "anyio>=4"]
16
+
17
+ [project.urls]
18
+ Homepage = "https://dataxapi.com/?ref=pypi-dataxapi-mcp"
19
+ Source = "https://github.com/data-x-api/dataxapi-mcp"
20
+ Documentation = "https://dataxapi.com/mcp/"
21
+
22
+ [project.scripts]
23
+ dataxapi-mcp = "dataxapi_mcp:main"