From 473aa284223270aa01d1ce7fbf7f309293d462aa Mon Sep 17 00:00:00 2001 From: writinwaters <93570324+writinwaters@users.noreply.github.com> Date: Mon, 12 May 2025 09:49:54 +0800 Subject: [PATCH] Docs: Restructured MCP-specific documents (#7565) ### What problem does this PR solve? ### Type of change - [x] Documentation Update --- docs/develop/mcp/_category_.json | 8 ++++++++ docs/develop/{ => mcp}/launch_mcp_server.md | 20 +------------------ docs/develop/mcp/mcp_client_example.md | 16 +++++++++++++++ docs/develop/mcp/mcp_tools.md | 12 +++++++++++ .../dataset/construct_knowledge_graph.md | 2 +- docs/release_notes.md | 2 +- 6 files changed, 39 insertions(+), 21 deletions(-) create mode 100644 docs/develop/mcp/_category_.json rename docs/develop/{ => mcp}/launch_mcp_server.md (91%) create mode 100644 docs/develop/mcp/mcp_client_example.md create mode 100644 docs/develop/mcp/mcp_tools.md diff --git a/docs/develop/mcp/_category_.json b/docs/develop/mcp/_category_.json new file mode 100644 index 000000000..73ff6805b --- /dev/null +++ b/docs/develop/mcp/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "MCP", + "position": 4, + "link": { + "type": "generated-index", + "description": "Guides and references on accessing RAGFlow's knowledge bases via MCP." + } +} diff --git a/docs/develop/launch_mcp_server.md b/docs/develop/mcp/launch_mcp_server.md similarity index 91% rename from docs/develop/launch_mcp_server.md rename to docs/develop/mcp/launch_mcp_server.md index e2f593373..1decf1dfd 100644 --- a/docs/develop/launch_mcp_server.md +++ b/docs/develop/mcp/launch_mcp_server.md @@ -1,5 +1,5 @@ --- -sidebar_position: 4 +sidebar_position: 1 slug: /launch_mcp_server --- @@ -177,24 +177,6 @@ Run the following to check the logs the RAGFlow server and the MCP server: docker logs ragflow-server ``` -## MCP client example - -We provide a *prototype* MCP client example for testing [here](https://github.com/infiniflow/ragflow/blob/main/mcp/client/client.py). - -:::danger IMPORTANT -If your MCP server is running in host mode, include your acquired API key in your client's `headers` as shown below: -```python -async with sse_client("http://localhost:9382/sse", headers={"api_key": "YOUR_KEY_HERE"}) as streams: - # Rest of your code... -``` -::: - -## Tools - -The MCP server currently offers a specialized tool to assist users in searching for relevant information powered by RAGFlow DeepDoc technology: - -- **retrieve**: Fetches relevant chunks from specified `dataset_ids` and optional `document_ids` using the RAGFlow retrieve interface, based on a given question. Details of all available datasets, namely, `id` and `description`, are provided within the tool description for each individual dataset. - ## Security considerations As MCP technology is still at early stage and no official best practices for authentication or authorization have been established, RAGFlow currently uses [API key](./acquire_ragflow_api_key.md) to validate identity for the operations described earlier. However, in public environments, this makeshift solution could expose your MCP server to potential network attacks. Therefore, when running a local SSE server, it is recommended to bind only to localhost (`127.0.0.1`) rather than to all interfaces (`0.0.0.0`). diff --git a/docs/develop/mcp/mcp_client_example.md b/docs/develop/mcp/mcp_client_example.md new file mode 100644 index 000000000..40b38b039 --- /dev/null +++ b/docs/develop/mcp/mcp_client_example.md @@ -0,0 +1,16 @@ +--- +sidebar_position: 3 +slug: /mcp_client +--- + +# RAGFlow MCP client example + +We provide a *prototype* MCP client example for testing [here](https://github.com/infiniflow/ragflow/blob/main/mcp/client/client.py). + +:::danger IMPORTANT +If your MCP server is running in host mode, include your acquired API key in your client's `headers` as shown below: +```python +async with sse_client("http://localhost:9382/sse", headers={"api_key": "YOUR_KEY_HERE"}) as streams: + # Rest of your code... +``` +::: \ No newline at end of file diff --git a/docs/develop/mcp/mcp_tools.md b/docs/develop/mcp/mcp_tools.md new file mode 100644 index 000000000..a087de62c --- /dev/null +++ b/docs/develop/mcp/mcp_tools.md @@ -0,0 +1,12 @@ +--- +sidebar_position: 2 +slug: /mcp_tools +--- + +# RAGFlow MCP tools + +The MCP server currently offers a specialized tool to assist users in searching for relevant information powered by RAGFlow DeepDoc technology: + +- **retrieve**: Fetches relevant chunks from specified `dataset_ids` and optional `document_ids` using the RAGFlow retrieve interface, based on a given question. Details of all available datasets, namely, `id` and `description`, are provided within the tool description for each individual dataset. + +For more information, see our Python implementation of the [MCP server](https://github.com/infiniflow/ragflow/blob/main/mcp/server/server.py). \ No newline at end of file diff --git a/docs/guides/dataset/construct_knowledge_graph.md b/docs/guides/dataset/construct_knowledge_graph.md index d60bc397a..83f0b9b3f 100644 --- a/docs/guides/dataset/construct_knowledge_graph.md +++ b/docs/guides/dataset/construct_knowledge_graph.md @@ -85,7 +85,7 @@ Yes, you can. Just one graph is generated per knowledge base. The smaller graphs ### Does the knowledge graph automatically update when I remove a related file? -Nope. The knowledge graph does *not* automatically update *until* a newly uploaded graph is parsed. +Nope. The knowledge graph does *not* automatically update *until* a newly uploaded document is parsed. ### How to remove a generated knowledge graph? diff --git a/docs/release_notes.md b/docs/release_notes.md index 6614a0fcb..29b5fdf02 100644 --- a/docs/release_notes.md +++ b/docs/release_notes.md @@ -44,7 +44,7 @@ From this release onwards, built-in rerank models have been removed because they - [Set page rank](./guides/dataset/set_page_rank.md) - [Enable RAPTOR](./guides/dataset/enable_raptor.md) - [Set variables for your chat assistant](./guides/chat/set_chat_variables.md) -- [RAGFlow MCP server overview](./develop/launch_mcp_server.md) +- [Launch RAGFlow MCP server](./develop/mcp/launch_mcp_server.md) ## v0.17.2