From 8ed09462a77d1522cee9ebe920f1786b71fb513a Mon Sep 17 00:00:00 2001 From: yiminghub2024 <482890@qq.com> Date: Sat, 26 Apr 2025 03:13:33 +0800 Subject: [PATCH 1/6] Update docker-compose.yml fix mcp server can not auto start or upgrade --- docker/docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index b9e41df394e..8c2d52634e2 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -32,6 +32,8 @@ services: - ./nginx/nginx.conf:/etc/nginx/nginx.conf - ../history_data_agent:/ragflow/history_data_agent - ./service_conf.yaml.template:/ragflow/conf/service_conf.yaml.template + # 添加新的卷挂载来覆盖entrypoint.sh,老的不生效。 + - ./entrypoint.sh:/ragflow/entrypoint.sh env_file: .env environment: From 0611a24d39e502fec51a59c3ccd1dffe5c645a21 Mon Sep 17 00:00:00 2001 From: yiminghub2024 <482890@qq.com> Date: Sat, 26 Apr 2025 03:33:35 +0800 Subject: [PATCH 2/6] Update mcp.md --- docs/develop/mcp.md | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/docs/develop/mcp.md b/docs/develop/mcp.md index e13ac15fc51..188c9da4aaf 100644 --- a/docs/develop/mcp.md +++ b/docs/develop/mcp.md @@ -59,13 +59,13 @@ For testing purposes, there is an [MCP client example](#example_mcp_client) prov Here are three augments required, the first two,`host` and `port`, are self-explained. The`base_url` is the address of the ready-to-serve RAGFlow server to actually perform the task. -### Launching from Docker +### Launching from Docker(new install) Building a standalone MCP server image is straightforward and easy, so we just proposed a way to launch it with RAGFlow server here. #### Alongside RAGFlow -As MCP server is an extra and optional component of RAGFlow server, we consume that not everybody going to use it. Thus, it is disable by default. +1.As MCP server is an extra and optional component of RAGFlow server, we consume that not everybody going to use it. Thus, it is disable by default. To enable it, simply find `docker/docker-compose.yml` to uncomment `services.ragflow.command` section. ```yaml @@ -81,11 +81,40 @@ services: - --mcp-base-url=http://127.0.0.1:9380 - --mcp-script-path=/ragflow/mcp/server/server.py - --mcp-mode=self-host # `self-host` or `host` - - --mcp-host-api-key="ragflow-xxxxxxx" # only need to privide when mode is `self-host` -``` + - --mcp-host-api-key=ragflow-xxxxxxx # only need to privide when mode is `self-host`& !!! do not add "" or it says:"api-key is wrong"!!! + +2.docker compose -f docker-compose.yml up -d + +### Launching from Docker(upgrade from old version) -Then launch it normally `docker compose -f docker-compose.yml`. +Building a standalone MCP server image is straightforward and easy, so we just proposed a way to launch it with RAGFlow server here. + +#### Alongside RAGFlow +1.As MCP server is an extra and optional component of RAGFlow server, we consume that not everybody going to use it. Thus, it is disable by default. +To enable it, simply find `docker/docker-compose.yml` to uncomment `services.ragflow.command` section. + +```yaml +services: + ragflow: + ... + image: ${RAGFLOW_IMAGE} + # example to setup MCP server + command: + - --enable-mcpserver + - --mcp-host=0.0.0.0 + - --mcp-port=9382 + - --mcp-base-url=http://127.0.0.1:9380 + - --mcp-script-path=/ragflow/mcp/server/server.py + - --mcp-mode=self-host # `self-host` or `host` + - --mcp-host-api-key=ragflow-xxxxxxx # only need to privide when mode is `self-host`& !!! do not add "" or it says:"api-key is wrong"!!! +2.cp mcp directory to local +3.cp docker/docker-compose.yml to local +4.cp docker/entrypoint.sh to local +5.docker compose -f docker-compose.yml up -d + +### check mcp server status +docker logs ragflow-server(if see mcp server ,it means all ok!) ```bash ragflow-server | Starting MCP Server on 0.0.0.0:9382 with base URL http://127.0.0.1:9380... ragflow-server | Starting 1 task executor(s) on host 'dd0b5e07e76f'... From b15c11872bf7b029881c8ac7b3b06ba2ab2b03ea Mon Sep 17 00:00:00 2001 From: yiminghub2024 <482890@qq.com> Date: Sat, 26 Apr 2025 10:25:06 +0800 Subject: [PATCH 3/6] Update .gitattributes add docker/entrypoint.sh exec --- .gitattributes | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 526c8a38d4a..199ea9a55b6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ -*.sh text eol=lf \ No newline at end of file +*.sh text eol=lf +docker/entrypoint.sh text eol=lf executable From 9bc955946572b2a6b6535f21fbb4d45b133784b7 Mon Sep 17 00:00:00 2001 From: Yongteng Lei Date: Sat, 26 Apr 2025 10:48:59 +0800 Subject: [PATCH 4/6] Update mcp.md --- docs/develop/mcp.md | 49 +++++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/docs/develop/mcp.md b/docs/develop/mcp.md index 188c9da4aaf..82e624050ce 100644 --- a/docs/develop/mcp.md +++ b/docs/develop/mcp.md @@ -59,13 +59,13 @@ For testing purposes, there is an [MCP client example](#example_mcp_client) prov Here are three augments required, the first two,`host` and `port`, are self-explained. The`base_url` is the address of the ready-to-serve RAGFlow server to actually perform the task. -### Launching from Docker(new install) +### Launching from Docker Building a standalone MCP server image is straightforward and easy, so we just proposed a way to launch it with RAGFlow server here. -#### Alongside RAGFlow +#### Alongside RAGFlow {#alongside_ragflow} -1.As MCP server is an extra and optional component of RAGFlow server, we consume that not everybody going to use it. Thus, it is disable by default. +As MCP server is an extra and optional component of RAGFlow server, we consume that not everybody going to use it. Thus, it is disable by default. To enable it, simply find `docker/docker-compose.yml` to uncomment `services.ragflow.command` section. ```yaml @@ -81,40 +81,27 @@ services: - --mcp-base-url=http://127.0.0.1:9380 - --mcp-script-path=/ragflow/mcp/server/server.py - --mcp-mode=self-host # `self-host` or `host` - - --mcp-host-api-key=ragflow-xxxxxxx # only need to privide when mode is `self-host`& !!! do not add "" or it says:"api-key is wrong"!!! + - --mcp-host-api-key=ragflow-xxxxxxx # only need to privide when mode is `self-host` and use bare string without quotation marks here. +``` -2.docker compose -f docker-compose.yml up -d +To troubleshoot, launch the service in the foreground using `docker compose -f docker-compose.yml`. -### Launching from Docker(upgrade from old version) +### For those upgrading from versions before v0.18.0 -Building a standalone MCP server image is straightforward and easy, so we just proposed a way to launch it with RAGFlow server here. +1. Get all MCP related files ready. + 1. copy `mcp/` directory to local. + 1. copy `docker/docker-compose.yml` to local. + 1. copy `docker/entrypoint.sh` to local. + 1. resolve necessary dependencies via `uv`. + - simply run `uv add mcp` if it works for you. Or: + - copy `pyproject.toml` and run `uv sync --python 3.10 --all-extras`. +1. Change `docker-compose.yml` to enable MCP as it is disable by default, [see last section](#alongside_ragflow). +1. Launch the service with `docker compose -f docker-compose.yml up -d` -#### Alongside RAGFlow +### Check the MCP server status -1.As MCP server is an extra and optional component of RAGFlow server, we consume that not everybody going to use it. Thus, it is disable by default. -To enable it, simply find `docker/docker-compose.yml` to uncomment `services.ragflow.command` section. +Checking logs of RAGFlow server with `docker logs ragflow-server`. If you see the MCP server ASCII art there, it means all is OK! -```yaml -services: - ragflow: - ... - image: ${RAGFLOW_IMAGE} - # example to setup MCP server - command: - - --enable-mcpserver - - --mcp-host=0.0.0.0 - - --mcp-port=9382 - - --mcp-base-url=http://127.0.0.1:9380 - - --mcp-script-path=/ragflow/mcp/server/server.py - - --mcp-mode=self-host # `self-host` or `host` - - --mcp-host-api-key=ragflow-xxxxxxx # only need to privide when mode is `self-host`& !!! do not add "" or it says:"api-key is wrong"!!! -2.cp mcp directory to local -3.cp docker/docker-compose.yml to local -4.cp docker/entrypoint.sh to local -5.docker compose -f docker-compose.yml up -d - -### check mcp server status -docker logs ragflow-server(if see mcp server ,it means all ok!) ```bash ragflow-server | Starting MCP Server on 0.0.0.0:9382 with base URL http://127.0.0.1:9380... ragflow-server | Starting 1 task executor(s) on host 'dd0b5e07e76f'... From 5f113cc7af200823fb00ec88bb5ff67e512470af Mon Sep 17 00:00:00 2001 From: yiminghub2024 <482890@qq.com> Date: Sat, 26 Apr 2025 13:53:59 +0800 Subject: [PATCH 5/6] Add executable permission to entrypoint.sh --- docker/entrypoint.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 docker/entrypoint.sh diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh old mode 100644 new mode 100755 From 856708ba8144cca9d5ddd618311b3338e0b43bbd Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Sun, 27 Apr 2025 17:10:32 +0800 Subject: [PATCH 6/6] Update docker-compose.yml --- docker/docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 8c2d52634e2..f73d7c031d9 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -32,7 +32,6 @@ services: - ./nginx/nginx.conf:/etc/nginx/nginx.conf - ../history_data_agent:/ragflow/history_data_agent - ./service_conf.yaml.template:/ragflow/conf/service_conf.yaml.template - # 添加新的卷挂载来覆盖entrypoint.sh,老的不生效。 - ./entrypoint.sh:/ragflow/entrypoint.sh env_file: .env