Mpc Sintific Search By Ai For Ai

Mpc Sintific Search By Ai For Ai

🚀 科学搜索 MCP for Cursor

这是一个专为 Cursor 实现的 Model Control Protocol (MCP),它能借助多个学术搜索引擎开展科学搜索,有效解决在编码过程中查找学术资料的难题,为开发者提供了极大的便利。

⚠️ 重要提示

由 AI 编码实现振动。

🚀 快速开始

要使用科学搜索 MCP for Cursor,您可以按以下步骤操作:

  1. 克隆此仓库:
git clone https://github.com/yourusername/cursor-scientific-search.git
cd cursor-scientific-search
  1. 安装所需的依赖项:
pip install -r requirements.txt
  1. 启动 MCP 服务器:
python scientific_search_mcp.py
  1. 在 Cursor 中连接到 MCP 服务器。

✨ 主要特性

  • 集成到 Cursor 使用 MCP 协议:无缝集成到 Cursor 中,方便在编码环境中直接使用。
  • 跨多引擎科学搜索
    • DuckDuckGo:通用网络搜索,提供广泛的信息。
    • Google Scholar:专注于论文搜索,涵盖众多学术领域。
    • PubMed:专门用于生物医学文献搜索,为相关领域的研究提供支持。
    • arXiv:物理、数学、计算机科学等领域的预印本服务器,能获取最新的研究成果。
    • Semantic Scholar:通过 Tor 代理的 AI 驱动研究论文搜索,可绕过部分限制。

📦 安装指南

安装基础依赖

git clone https://github.com/yourusername/cursor-scientific-search.git
cd cursor-scientific-search
pip install -r requirements.txt

特定搜索引擎的额外依赖

# 用于 arXiv 搜索
pip install arxiv

# 用于 Google Scholar
pip install scholarly

# 用于 PubMed
pip install pymed

# 用于 Semantic Scholar(需要 Tor)
pip install requests[socks]

Tor 设置用于 Semantic Scholar

Semantic Scholar 的搜索使用 Tor 来绕过速率限制和 IP 封锁。要使用此功能:

  1. 安装 Tor:
    • Linuxsudo apt install tor(Debian/Ubuntu)或 sudo pacman -S tor(Arch)
    • macOSbrew install tor
    • Windows:下载并安装 Tor 浏览器,其中包含 Tor 服务
  2. 启动 Tor 服务:
    • Linuxsudo systemctl start torsudo service tor start
    • macOSbrew services start tor
    • Windows:Tor 浏览器包括服务,或您可以使用 Tor Expert Bundle
  3. 验证 Tor 是否在 9050 端口上运行(默认):
    nc -z localhost 9050 && echo "Tor 正在运行"
    
  4. scientific search MCP 将自动将 Semantic Scholar 请求通过 Tor 路由。

💻 使用示例

基础用法

搜索科学

在不同引擎上搜索科学论文:

# 在 arXiv 上搜索量子计算论文
results = await mcp_scientific_search_search_scientific(
query="quantum computing",
engine="arxiv"
)

# 在 PubMed 上搜索 COVID-19 研究
results = await mcp_scientific_search_search_scientific(
query="COVID-19 treatment",
engine="pubmed"
)

# 在 Google Scholar 上搜索人工智能论文
results = await mcp_scientific_search_search_scientific(
query="artificial intelligence",
engine="gScholar"
)

# 在 Semantic Scholar 上搜索自然语言处理
results = await mcp_scientific_search_search_scientific(
query="natural language processing",
engine="semScholar"
)

提取元数据

from typing import Dict, Any
def print_result(result: Dict[str, Any]) -> None:
"""打印搜索结果的元数据."""
print(f"标题:{result['title']}")
print(f"作者:{result['authors']}")
print(f"摘要:{result['abstract']}")
print(f"出版物:{result.get('publication', 'N/A')}")
print(f"DOI:{result.get('doi', 'N/A')}")
print(f"链接:{result['url']}\n")

# 示例用法
results = await mcp_scientific_search_search_scientific(
query="machine learning",
engine="arxiv"
)
for result in results:
print_result(result)

高级用法

运行以下代码获取搜索结果并打印:

from mcpScientificSearch import MPSSearcher
import asyncio

async def main():
async with MPSSearcher() as searcher:
# 在 arXiv 上搜索量子计算论文
arxiv_results = await searcher.search(
query="quantum computing",
engine="arxiv"
)
print("arXiv 结果:")
for result in arxiv_results:
print(f"标题:{result['title']}")
print(f"作者:{result['authors']}\n")

# 在 Google Scholar 上搜索人工智能论文
gscholar_results = await searcher.search(
query="artificial intelligence",
engine="gScholar"
)
print("Google Scholar 结果:")
for result in gscholar_results:
print(f"标题:{result['title']}")
print(f"作者:{result['authors']}\n")

if __name__ == "__main__":
asyncio.run(main())

注意事项

⚠️ 重要提示

  • Google Scholar 速率限制:请勿在短时间内进行大量请求,以免触发 Google 的速率限制。
  • Tor 稳定性:确保 Tor 服务正在运行,否则 Semantic Scholar 请求可能会失败。

🔧 故障排除

问题:无法连接到 Semantic Scholar

解决方法

  1. 检查 Tor 是否已安装并正确配置。
  2. 验证 Tor 是否在 9050 端口上监听。
  3. 确保网络连接正常。

问题:搜索结果为空

可能原因

  • 请求的参数有误(例如,查询字符串无效或引擎名称不正确)。
  • 网络连接中断。
  • 0 关注
  • 0 收藏,17 浏览
  • system 提出于 2025-09-22 21:21

相似服务问题

相关AI产品