Self Checks
RAGFlow workspace code commit ID
32c5cb1
RAGFlow image version
v0.26.3
Other environment information
- RAGFlow version: **v0.26.3**
- ragflow-mcp-server: **1.19.0** (from `serverInfo` on `initialize`)
- Deployment: Docker, `--enable-mcpserver --mcp-mode=host`, doc engine = elasticsearch
Actual behavior
Describe the bug
The MCP server crashes on every tools/list call, so no MCP client can load any tools. initialize succeeds, but tools/list returns:
MCP error 0: 'str' object has no attribute 'get'
Server log:
ERROR:mcp.server.streamable_http:Error in message router
...
AttributeError: 'str' object has no attribute 'get'
Root cause
list_tools() in mcp/server/server.py builds its tool descriptions by calling both list_datasets() and list_chats():
@app.list_tools()
async def list_tools(*, connector, api_key):
dataset_description = await connector.list_datasets(api_key=api_key)
chat_description = await connector.list_chats(api_key=api_key) # <-- crashes
list_chats() iterates the REST response's data as if it were a list of chat dicts:
chat_count = len(res_json.get("data", []))
for data in res_json.get("data", []):
d = {"id": data.get("id"), "name": data.get("name"), "description": data.get("description", "")}
But GET /api/v1/chats returns data as an object, not a list:
{"code": 0, "data": {"chats": [], "total": 0}, "message": "success"}
So the loop iterates the dict's keys ("chats", "total" — strings) and data.get("id") raises 'str' object has no attribute 'get'. Since list_tools() always calls list_chats(), tools/list fails entirely and the MCP server is unusable (host and self-host modes). list_datasets() is unaffected because GET /api/v1/datasets returns data as a list.
Expected behavior
No response
Steps to reproduce
1. Run RAGFlow v0.26.3 with the MCP server enabled (`--enable-mcpserver --mcp-mode=host`).
2. Connect any MCP client (e.g. Claude Code) and request `tools/list`.
3. `initialize` succeeds; `tools/list` fails with the error above.
Additional information
Proposed fix
In list_chats(), read chats from data["chats"]:
chats = res_json.get("data", {}).get("chats", [])
chat_count = len(chats)
for data in chats:
d = {"id": data.get("id"), "name": data.get("name"), "description": data.get("description", "")}
Self Checks
RAGFlow workspace code commit ID
32c5cb1
RAGFlow image version
v0.26.3
Other environment information
Actual behavior
Describe the bug
The MCP server crashes on every
tools/listcall, so no MCP client can load any tools.initializesucceeds, buttools/listreturns:Server log:
Root cause
list_tools()inmcp/server/server.pybuilds its tool descriptions by calling bothlist_datasets()andlist_chats():list_chats()iterates the REST response'sdataas if it were a list of chat dicts:But
GET /api/v1/chatsreturnsdataas an object, not a list:{"code": 0, "data": {"chats": [], "total": 0}, "message": "success"}So the loop iterates the dict's keys (
"chats","total"— strings) anddata.get("id")raises'str' object has no attribute 'get'. Sincelist_tools()always callslist_chats(),tools/listfails entirely and the MCP server is unusable (host and self-host modes).list_datasets()is unaffected becauseGET /api/v1/datasetsreturnsdataas a list.Expected behavior
No response
Steps to reproduce
Additional information
Proposed fix
In
list_chats(), read chats fromdata["chats"]: