文档检索服务

MCP是一个基于模型上下文协议的文档检索服务,支持从多个来源获取文档内容,适用于开发者在本地或远程环境中快速检索和处理文档。

  • by binoyjayan
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 binoyjayan/mcp-py

使用说明

主控程序

构建npm项目

npm install
npm run build

安装uv

curl -LsSf https://astral.sh/uv/install.sh | sh

mcpdoc

https://github.com/langchain-ai/mcpdoc

使用安装依赖项 uv

uv venv
source .venv/bin/activate
uv pip install .

检查uvx路径

source .venv/bin/activate
which uvx

本地测试服务器

使用相同 uvx 如上述venv中获得的。

uvx --from mcpdoc mcpdoc \
    --urls "LangGraph:https://langchain-ai.github.io/langgraph/llms.txt" "LangChain:https://python.langchain.com/llms.txt" \
    --transport sse \
    --port 8082 \
    --host localhost

MCP检查员

npx @modelcontextprotocol/inspector

连接到 mcpdoc 从MCP Inspector的WebUI界面。

单击工具->列出工具

运行list_doc_sources工具。

复制URL:https://python.langchain.com/llms.txt

使用此URL运行工具fetch_docs。

用claude测试mcpdoc

注意:使用venv中使用的uvx二进制路径。

{
  "mcpServers": {
    "langgraph-docs-mcp": {
      "command": "uvx",
      "args": [
        "--from",
        "mcpdoc",
        "mcpdoc",
        "--urls",
        "LangGraph:https://langchain-ai.github.io/langgraph/llms.txt",
        "--transport",
        "stdio",
        "--port",
        "8082",
        "--host",
        "localhost"
      ]
    }
  }
}

故障排除

错误:

langgraph-docs-mcp] [error] spawn uvx ENOENT

Python项目和初始化venv

uv init shellserver
cd shellserver
uv python pin 3.11
uv venv
source .venv/bin/activate

参考文献

https://github.com/punkpeye/awesome-mcp-servers https://modelcontextprotocol.io/docs/getting-started/intro https://docs.cursor.com/en/context/mcp https://github.com/modelcontextprotocol/quickstart-resources https://github.com/emarco177/mcp-crash-course