MCP-doc定制服务器
一个定制的MCP服务器,它 enables 集成于LLM应用和文档源之间,提供对LangGraph和模型上下文协议文档的人工智能辅助访问。 (注:原文中的“enables”在翻译中保持了其功能含义,若需更通顺的中文表达,可调整为:“实现……之间的集成”。) 优化版: 一个定制的MCP服务器,实现LLM应用与文档源之间的集成,并提供对LangGraph和模型上下文协议文档的人工智能辅助访问。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"mcp-doc": {
"args": [
"--from",
"mcpdoc",
"mcpdoc",
"--urls",
"LangGraph:https://raw.githubusercontent.com/esakrissa/mcp-doc/main/docs/langgraph.txt",
"ModelContextProtocol:https://raw.githubusercontent.com/esakrissa/mcp-doc/main/docs/mcp.txt",
"--allowed-domains",
"*",
"--transport",
"stdio"
],
"command": "uvx"
}
}
}
服务介绍
MCP 文档服务器
这是一个定制版本的MCP文档服务器,通过模型上下文协议(Model Context Protocol)实现LLM应用程序(如Cursor、Claude Desktop、Windsurf)与文档源之间的集成。
概述
该服务器为MCP宿主应用程序提供:
- 访问特定的文档文件(langgraph.txt 和 mcp.txt)
- 从这些文件中的URL获取文档的工具
支持的文档
目前设置支持以下文档:
- LangGraph 文档 (来自 https://raw.githubusercontent.com/esakrissa/mcp-doc/main/docs/langgraph.txt)
- MCP 文档 (来自 https://raw.githubusercontent.com/esakrissa/mcp-doc/main/docs/mcp.txt)
快速开始
设置与运行
# Clone the repository
git clone https://github.com/esakrissa/mcp-doc.git
cd mcp-doc
# Create and activate a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install the package in development mode
pip install -e .
运行服务器
你可以使用已安装的命令来运行服务器:
# Run the server with the config file
mcpdoc \
--json config.json \
--transport sse \
--port 8082 \
--host localhost
或者如果你更喜欢使用UV:
# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Run the server with UV
uvx --from mcpdoc mcpdoc \
--json config.json \
--transport sse \
--port 8082 \
--host localhost
IDE 集成
Cursor
添加到 ~/.cursor/mcp.json
{
"mcpServers": {
"mcp-doc": {
"command": "uvx",
"args": [
"--from",
"mcpdoc",
"mcpdoc",
"--urls",
"LangGraph:https://raw.githubusercontent.com/esakrissa/mcp-doc/main/docs/langgraph.txt",
"ModelContextProtocol:https://raw.githubusercontent.com/esakrissa/mcp-doc/main/docs/mcp.txt",
"--allowed-domains",
"*",
"--transport",
"stdio"
]
}
}
}
然后将这些指令添加到Cursor的自定义指令中:
for ANY question about LangGraph and Model Context Protocol (MCP), use the mcp-doc server to help answer --
+ call list_doc_sources tool to get the available documentation files
+ call fetch_docs tool to read the langgraph.txt or mcp.txt file
+ reflect on the urls in langgraph.txt or mcp.txt
+ reflect on the input question
+ call fetch_docs on any urls relevant to the question
+ use this to answer the question
要测试集成是否工作正常,请向Cursor询问有关LangGraph或MCP的问题,并检查它是否使用了文档服务器工具来获取信息。
安全须知
出于安全考虑,实施了严格的域名访问控制:
- 远程文档文件:仅自动允许特定的域名
- 本地文档文件:没有域名被自动允许
- 使用
--allowed-domains明确添加域名,或使用--allowed-domains '*'允许所有(谨慎使用)
参考资料
此项目基于原始的 mcpdoc by LangChain AI 修改而成,旨在为LangGraph和MCP提供集中的文档访问。