From 17e7571639971f443e76da1daacafaeaa82ed27d Mon Sep 17 00:00:00 2001 From: writinwaters <93570324+writinwaters@users.noreply.github.com> Date: Fri, 9 May 2025 09:37:05 +0800 Subject: [PATCH] Updated MCP (#7533) ### What problem does this PR solve? ### Type of change - [x ] Documentation Update --- docs/develop/launch_mcp_server.md | 23 ++++++++++++++++++----- docs/release_notes.md | 2 +- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/docs/develop/launch_mcp_server.md b/docs/develop/launch_mcp_server.md index de4806a00..e2f593373 100644 --- a/docs/develop/launch_mcp_server.md +++ b/docs/develop/launch_mcp_server.md @@ -62,9 +62,9 @@ Where: #### 1. Enable MCP server -The MCP server is designed as an optional, component that complements the RAGFlow server and is disable by default. To enable MCP server: +The MCP server is designed as an optional component that complements the RAGFlow server and disabled by default. To enable MCP server: -1. Navigate to `docker/docker-compose.yml`. +1. Navigate to **docker/docker-compose.yml**. 2. Uncomment the `services.ragflow.command` section as shown below: ```yaml {6-13} @@ -189,9 +189,9 @@ async with sse_client("http://localhost:9382/sse", headers={"api_key": "YOUR_KEY ``` ::: -## API +## Tools -The MCP server currently offers an API to assist users in searching for relevant information powered by RAGFlow DeepDoc technology: +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. @@ -199,4 +199,17 @@ The MCP server currently offers an API to assist users in searching for relevant 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`). -For further guidance, see the [official MCP documentation](https://modelcontextprotocol.io/docs/concepts/transports#security-considerations). \ No newline at end of file +For further guidance, see the [official MCP documentation](https://modelcontextprotocol.io/docs/concepts/transports#security-considerations). + +## Frequently asked questions + +### When to use an API key for authentication? + +The use of an API key depends on the operating mode of your MCP server. + +- **Self-host mode** (default): + When starting the MCP server in self-host mode, you should provide an API key when launching it to authenticate it with the RAGFlow server: + - If launching from source, include the API key in the command. + - If launching from Docker, update the API key in **docker/docker-compose.yml**. +- **Host mode**: + If your RAGFlow MCP server is working in host mode, include the API key in the `headers` of your client requests to authenticate your client with the RAGFlow server. An example is available [here](https://github.com/infiniflow/ragflow/blob/main/mcp/client/client.py). \ No newline at end of file diff --git a/docs/release_notes.md b/docs/release_notes.md index 853d5a750..6614a0fcb 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/mcp.md) +- [RAGFlow MCP server overview](./develop/launch_mcp_server.md) ## v0.17.2