MCP 文档搜索服务器是一个功能强大的工具,它基于 FastMCP 构建,能让 AI 系统在多个流行框架和库的文档间进行智能搜索。通过统一接口,AI 模型可快速访问并检索相关信息。
git clone https://github.com/your-repository.git
cd mcp-docs-search-server
python -m venv env
source env/bin/activate # 在 Unix/Linux 下
# 或者
.\env\Scripts\activate # 在 Windows 下
pip install -r requirements.txt
python server.py
from mcp_search import search_document
# 搜索 Framer Motion 文档
results = search_document("framer motion", "animations")
print(results)
# 搜索 Tailwind CSS 文档
results = search_document("tailwind css", "utilities classes")
print(results)
pytest tests/
PYTEST_ARGS="-v" pytest integration_tests/
uvicorn async_server:app --reload
在 config.py 中定义文档 URL:
DOCS_URLS = {
"new-library": "https://docs.new-library.com",
# 已有条目...
}
添加别名:
LIBRARY_ALIASES = {
"new-lib": "new-library",
# 已有条目...
}
在 config.py 中调整超时和结果数量:
HTTP_TIMEOUT = 30.0 # 超时时间(秒)
MAX_SEARCH_RESULTS = 2 # 获取的结果数
DOCS_URLS 和 LIBRARY_ALIASES。HTTP_TIMEOUT 值。本项目使用 MIT 许可证,详细信息请查看 LICENSE 文件。
感谢以下项目和技术: