Skip to content

Commit 1aa9760

Browse files
yiminghub2024yongtengleiKevinHuSh
authored
Fix mcp server startup failure (#7329)
### What problem does this PR solve? 0.18.0 mcp server can not start with upgrade from 0.17.2 or new install except rebuild all docker Close #7321 mcp server can not start auto from docker : 2025-04-25 17:30:44,512 INFO 25 task_executor_2a9f3e2de99a_0 reported heartbeat: {"name": "task_executor_2a9f3e2de99a_0", "now": "2025-04-25T17:30:44.509+08:00", "boot_at": "2025-04-25T16:43:33.038+08:00", "pending": 0, "lag": 0, "done": 0, "failed": 0, "current": {}} usage: server.py [-h] [--base_url BASE_URL] [--host HOST] [--port PORT] [--mode MODE] [--api_key API_KEY] server.py: error: unrecognized arguments: problem: server.py in docker start arguments not correct , so mcp server start fail reason: ``` 1. docker-copose.yaml example - --mcp-host-api-key="ragflow-12345678" is wrong. do not add "" to key or it says:"api-key wrong" 2.docker file entrypoint.sh can not translate config to exec command , we need mapping file from host to docker - ./entrypoint.sh:/ragflow/entrypoint.sh 3.just add one code raw fix all probelm ``` ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) - [x] Documentation Update - [x] Performance Improvement --------- Co-authored-by: Yongteng Lei <[email protected]> Co-authored-by: Kevin Hu <[email protected]>
1 parent 969c596 commit 1aa9760

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

.gitattributes

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
*.sh text eol=lf
1+
*.sh text eol=lf
2+
docker/entrypoint.sh text eol=lf executable

docker/docker-compose.yml

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ services:
3232
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
3333
- ../history_data_agent:/ragflow/history_data_agent
3434
- ./service_conf.yaml.template:/ragflow/conf/service_conf.yaml.template
35+
- ./entrypoint.sh:/ragflow/entrypoint.sh
3536

3637
env_file: .env
3738
environment:

docker/entrypoint.sh

100644100755
File mode changed.

docs/develop/mcp.md

+19-3
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Here are three augments required, the first two,`host` and `port`, are self-expl
6363

6464
Building a standalone MCP server image is straightforward and easy, so we just proposed a way to launch it with RAGFlow server here.
6565

66-
#### Alongside RAGFlow
66+
#### Alongside RAGFlow {#alongside_ragflow}
6767

6868
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.
6969
To enable it, simply find `docker/docker-compose.yml` to uncomment `services.ragflow.command` section.
@@ -81,10 +81,26 @@ services:
8181
- --mcp-base-url=http://127.0.0.1:9380
8282
- --mcp-script-path=/ragflow/mcp/server/server.py
8383
- --mcp-mode=self-host # `self-host` or `host`
84-
- --mcp-host-api-key="ragflow-xxxxxxx" # only need to privide when mode is `self-host`
84+
- --mcp-host-api-key=ragflow-xxxxxxx # only need to privide when mode is `self-host` and use bare string without quotation marks here.
8585
```
8686

87-
Then launch it normally `docker compose -f docker-compose.yml`.
87+
To troubleshoot, launch the service in the foreground using `docker compose -f docker-compose.yml`.
88+
89+
### For those upgrading from versions before v0.18.0
90+
91+
1. Get all MCP related files ready.
92+
1. copy `mcp/` directory to local.
93+
1. copy `docker/docker-compose.yml` to local.
94+
1. copy `docker/entrypoint.sh` to local.
95+
1. resolve necessary dependencies via `uv`.
96+
- simply run `uv add mcp` if it works for you. Or:
97+
- copy `pyproject.toml` and run `uv sync --python 3.10 --all-extras`.
98+
1. Change `docker-compose.yml` to enable MCP as it is disable by default, [see last section](#alongside_ragflow).
99+
1. Launch the service with `docker compose -f docker-compose.yml up -d`
100+
101+
### Check the MCP server status
102+
103+
Checking logs of RAGFlow server with `docker logs ragflow-server`. If you see the MCP server ASCII art there, it means all is OK!
88104

89105
```bash
90106
ragflow-server | Starting MCP Server on 0.0.0.0:9382 with base URL http://127.0.0.1:9380...

0 commit comments

Comments
 (0)