微信公众号内容搜索工具 (Weixin Search MCP)
这是一个基于MCP (Multimodal Capability Provider)的工具,用于搜索和获取微信公众号文章内容。通过搜狗微信搜索接口,可以方便地获取公众号文章并提取内容。
功能特点
- 通过关键词在搜狗微信搜索中查找公众号文章
- 自动获取文章的真实链接(从搜狗跳转链接转为微信原始链接)
- 提取文章的完整正文内容
- 支持批量获取多篇文章
安装方法
环境要求
- Python 3.12 或更高版本
- uv 包管理工具
安装步骤
使用 uv 创建虚拟环境并安装:
# 创建虚拟环境
uv venv
# 激活虚拟环境
source .venv/bin/activate # Linux/Mac
# 或者在Windows上:
# .venv\Scripts\activate
# 安装项目
uv pip install -e .
使用方法
启动服务
启动HTTP服务器:
weixin_search_mcp --transport http --port 8809 --host 0.0.0.0
或者使用标准输入/输出模式(用于与其他应用集成):
weixin_search_mcp --transport stdio
通过 PyPI / uvx 直接运行:
uvx --from weixin-search-mcp weixin_search_mcp --transport stdio
4. 配置MCP服务
有两种方式可以配置和启动MCP服务:
方式一:使用stdio协议(直接连接)
在Claude配置中添加以下内容:
{
"mcpServers": {
"weixin_search_mcp": {
"command": "uvx",
"args": ["--from", "weixin-search-mcp", "weixin_search_mcp", "--transport", "stdio"]
}
}
}
方式二:使用HTTP协议
- 启动HTTP服务:
uvx --from weixin-search-mcp weixin_search_mcp --transport http --port 8809
- 在Claude配置中添加以下内容:
{
"mcpServers": {
"weixin_search_mcp": {
"type": "http",
"url": "http://localhost:8809/mcp"
}
}
}
工具使用说明
本项目提供了以下工具来搜索和获取微信公众号内容:
微信搜索工具
- weixin_search: 在搜狗微信搜索中搜索指定关键词并返回结果列表
- 参数:
query- 搜索关键词page- 可选,页码,默认1
- 返回: 包含标题、链接、真实URL、发布时间、页码的文章列表
- 参数:
多页搜索工具
- weixin_search_all: 自动翻页搜索多页微信公众号文章
- 参数:
query- 搜索关键词max_pages- 可选,最大页数,默认10
- 返回: 聚合后的多页结果列表
- 参数:
内容获取工具
- get_weixin_article_content: 获取微信公众号文章的正文内容
- 参数:
real_url- 真实微信公众号文章链接referer- 可选,请求来源,通常为weixin_search返回的链接
- 返回: 文章正文内容
- 参数:
使用示例
- 搜索关键词相关的微信公众号文章:
results = weixin_search("人工智能")
按指定页搜索:
results = weixin_search("人工智能", page=2)
自动翻页抓取:
all_results = weixin_search_all("人工智能", max_pages=3)
- 获取文章内容:
article_content = get_weixin_article_content(real_url="https://mp.weixin.qq.com/...", referer="https://weixin.sogou.com/...")
注意事项
- 该工具依赖于搜狗微信搜索接口,如果接口变更可能会影响工具功能
- 请合理控制请求频率,避免被搜狗或微信官方限制访问
- 获取的内容仅供学习研究使用,请遵守相关法律法规
许可证
MIT
Metadata
Release files for weixin-search-mcp 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| weixin_search_mcp-0.2.1.tar.gz | 8.8 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| weixin_search_mcp-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.1 kB
Release files / weixin_search_mcp-0.2.1.tar.gz
| Download URL | weixin_search_mcp-0.2.1.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
983d05e9598122832e8d3a5932bcb944df3d6bb9b9711efe40bd588bd5820efb
|
|
BLAKE2b-256 checksum How to use checksums |
0559c4de5cec5b30acd5318e59d6463f32bb3364aed8bd8b86f7f5115160a13e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.
Transparency logRelease files / weixin_search_mcp-0.2.1-py3-none-any.whl
| Download URL | weixin_search_mcp-0.2.1-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b5d5934aa589079ff64b98e328909202a420fe85c1849717820107c9ef05833
|
|
BLAKE2b-256 checksum How to use checksums |
84e633caf48b208ac20e61ac52c934596a9a69af733bb72ada702373cbbdc332
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.
Transparency logSecurity for weixin-search-mcp 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for weixin_search_mcp-0.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.