Skip to main content
Glama
FoundZiGu

ragflow-mcp-server-fixed

by FoundZiGu

ragflow-mcp-server-fixed

中文说明

A fixed RAGFlow MCP server for stdio MCP clients.

It keeps the executable name ragflow-mcp-server, so clients can switch from the original package by changing only the package source.

What This Fixes

Some RAGFlow deployments return errors from the legacy chat endpoint, for example:

'NoneType' object is not subscriptable
required argument are missing: messages

This server handles that by:

  • calling RAGFlow HTTP APIs directly;

  • parsing stream responses defensively;

  • falling back to the OpenAI-compatible RAGFlow endpoint when needed;

  • returning clearer error messages from RAGFlow.

Tools

Tool

Purpose

list_datasets

List RAGFlow datasets.

create_chat

Create a chat assistant and session for a dataset.

chat

Ask a question in a session returned by create_chat.

ask_configured_chat

Ask a server-configured RAGFlow chat assistant directly.

retrieve

Retrieve matching chunks directly from a dataset.

For most usage, configure --default-chat-name or --default-chat-id, then use ask_configured_chat.

Quick Start

{
  "command": "uvx",
  "args": [
    "--from",
    "git+https://github.com/FoundZiGu/ragflow-mcp-server-fixed.git@v0.1.2",
    "ragflow-mcp-server",
    "--api-key",
    "ragflow-REPLACE_WITH_YOUR_KEY",
    "--base-url",
    "http://<RAGFLOW_HOST>:9380",
    "--default-chat-name",
    "<CHAT_NAME>"
  ]
}

If your MCP client supports environment variables:

{
  "command": "uvx",
  "args": [
    "--from",
    "git+https://github.com/FoundZiGu/ragflow-mcp-server-fixed.git@v0.1.2",
    "ragflow-mcp-server"
  ],
  "env": {
    "RAGFLOW_API_KEY": "ragflow-REPLACE_WITH_YOUR_KEY",
    "RAGFLOW_BASE_URL": "http://<RAGFLOW_HOST>:9380",
    "RAGFLOW_DEFAULT_CHAT_NAME": "<CHAT_NAME>"
  }
}

Use chat ID instead of name when possible:

{
  "command": "uvx",
  "args": [
    "--from",
    "git+https://github.com/FoundZiGu/ragflow-mcp-server-fixed.git@v0.1.2",
    "ragflow-mcp-server",
    "--api-key",
    "ragflow-REPLACE_WITH_YOUR_KEY",
    "--base-url",
    "http://<RAGFLOW_HOST>:9380",
    "--default-chat-id",
    "<CHAT_ID>"
  ]
}

Server Options

Option

Environment variable

Description

--api-key

RAGFLOW_API_KEY

RAGFlow API key.

--base-url

RAGFLOW_BASE_URL

RAGFlow base URL.

--default-chat-id

RAGFLOW_DEFAULT_CHAT_ID

Existing RAGFlow chat assistant ID for ask_configured_chat.

--default-chat-name

RAGFLOW_DEFAULT_CHAT_NAME

Existing RAGFlow chat assistant name for ask_configured_chat.

--default-session-name

RAGFLOW_DEFAULT_SESSION_NAME

Session name created for the configured chat.

Local Development

uv run ragflow-mcp-server --help
export RAGFLOW_API_KEY="ragflow-REPLACE_WITH_YOUR_KEY"
export RAGFLOW_BASE_URL="http://<RAGFLOW_HOST>:9380"
export RAGFLOW_DEFAULT_CHAT_NAME="<CHAT_NAME>"
uv run python tests/smoke_test.py

Security

  • Do not commit API keys.

  • Prefer environment variables for secrets.

  • Rotate keys that have appeared in logs, screenshots, public issues, or chat transcripts.

Available Tools

5 tools
ask_configured_chatAsk configured chatA

Preferred one-step QA tool. Ask a question in the RAGFlow chat assistant configured on server startup. No dataset_id, chat_id, or session_id is required.

ParametersJSON Schema
NameRequiredDescriptionDefault
questionYesQuestion
streamNoUse RAGFlow streaming first. Default true.
new_sessionNoCreate a new configured chat session for this question.
session_nameNoOptional session name when new_session is true.

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions streaming default true but does not disclose whether the tool creates sessions (though 'new_session' parameter hints at it) or any other side effects. Basic information is present but lacks depth.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise, with two short sentences that front-load the core purpose and key differentiator. Every word serves a purpose without unnecessary detail.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema and no annotations, the description provides adequate context for basic usage but fails to specify the return format or behavior of streaming. It covers the tool's role but leaves some practical questions unanswered.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already defines parameters well. The description adds no additional meaning beyond the schema, placing it at the baseline of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it is a one-step QA tool that asks a question in the preconfigured RAGFlow chat assistant. It differentiates itself from siblings by explicitly noting no dataset_id, chat_id, or session_id is required, making its purpose and scope very clear.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description positions this as the 'preferred one-step QA tool' and implies it is for users who do not have specific IDs, guiding when to use it. However, it does not explicitly state when to use alternative siblings like 'chat' or 'create_chat'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

chatChatC

Ask a question in a created RAGFlow chat session.

ParametersJSON Schema
NameRequiredDescriptionDefault
session_idYesSession id returned by create_chat
questionYesQuestion
streamNoUse RAGFlow streaming first. Default true.

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It only states the tool's function without revealing traits like error handling, streaming behavior, or authentication needs. The minimal text does not sufficiently inform the agent about side effects or constraints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. However, it is so brief that it sacrifices useful context, placing it slightly below a perfect score.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of output schema and annotations, the description should compensate but does not. It omits details about return values, error states, or streaming nuances, leaving the agent underinformed for a chat interaction tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, providing descriptions for all three parameters. The tool description adds no extra meaning beyond the schema, so it meets the baseline but does not enhance understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly specifies the action ('Ask a question') and the resource ('created RAGFlow chat session'), making the tool's purpose evident. However, it does not explicitly differentiate from sibling tools like 'ask_configured_chat' or 'create_chat', which slightly diminishes clarity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, such as 'ask_configured_chat' or 'create_chat'. It also lacks any prerequisites or exclusions, leaving the agent without context for appropriate invocation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

create_chatCreate chatB

Create a RAGFlow chat assistant and session for one dataset.

ParametersJSON Schema
NameRequiredDescriptionDefault
dataset_idYesDataset id
nameNoChat name
llm_idNoOptional RAGFlow LLM id
prompt_configNoOptional RAGFlow prompt_config
llm_settingNoOptional RAGFlow llm_setting

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It only states creation, but does not disclose side effects (e.g., whether it modifies existing data, what happens if the dataset doesn't exist, or if the operation is idempotent).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It front-loads the core action, but could be slightly expanded without losing conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description is too brief given the complexity: 5 parameters (including nested objects), no output schema, and no mention of what the tool returns or how to use the created chat. Additional context on success behavior and error cases is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with descriptions for each parameter, though they are minimal. The tool description does not add additional meaning beyond the schema, such as clarifying the role of 'prompt_config' or 'llm_setting'. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Create a RAGFlow chat assistant and session for one dataset,' which is a specific verb+resource. It distinguishes from sibling tools like 'ask_configured_chat' (for asking questions) and 'chat' (for general chatting).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives, such as when to create a new chat vs using an existing one. The description does not mention prerequisites or conditions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_datasetsList datasetsB

List RAGFlow datasets. Returns dataset id and name.

ParametersJSON Schema
NameRequiredDescriptionDefault
idNoOptional dataset id
nameNoOptional dataset name

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description should explicitly state that the tool is read-only and disclose any side effects. It only says 'List' which implies read-only but does not clarify auth requirements or rate limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, short sentence that is easy to parse. It could be improved by structuring return fields, but it is not verbose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple list tool with optional filters, the description is minimally adequate. It lacks mention of output format, pagination, or behavior when no parameters are provided.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with descriptions for both parameters. The description adds no extra meaning beyond what the schema provides, so baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'List RAGFlow datasets' with a specific verb and resource. It distinguishes itself from siblings like 'chat' and 'retrieve' which are not listing datasets.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like 'ask_configured_chat' or how to handle optional parameters. Missing context about prerequisites or scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

retrieveRetrieve chunksB

Retrieve relevant chunks directly from a RAGFlow dataset.

ParametersJSON Schema
NameRequiredDescriptionDefault
dataset_idYesDataset id
questionYesRetrieval query
page_sizeNoMax chunks, default 8

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must disclose behavioral traits. It only states 'retrieve relevant chunks directly,' implying a read-only operation, but does not mention what happens on invalid dataset_id, whether it modifies data, or any error handling.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence with no wasted words. However, it could be slightly expanded to improve clarity without sacrificing conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of output schema and annotations, the description is too minimal. It does not explain the return format, what 'chunks' are, or any pagination details, leaving the agent underinformed for a retrieval tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the input schema already describes each parameter. The description adds no additional meaning beyond what is in the schema, meeting the baseline for high coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'retrieve' and the resource 'chunks directly from a RAGFlow dataset'. It distinguishes from sibling tools like 'ask_configured_chat' and 'chat', which involve conversational interactions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for retrieving chunks, but it does not provide guidance on when to use this tool over siblings (e.g., when to use 'ask_configured_chat' instead). No explicit when-not or alternatives are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 5 tool updatesv0.1.2
    • First observedask_configured_chat
    • First observedchat
    • First observedcreate_chat
    • First observedlist_datasets
    • First observedretrieve

TDQS

B3.1/5.0

Scored across 5 tools

Disambiguation4/5

Most tools have distinct purposes: listing datasets, retrieving chunks, and creating chat sessions are clear. However, ask_configured_chat and chat both serve QA functions, which could lead to confusion if the agent does not carefully read the descriptions.

Naming Consistency2/5

Tool names are inconsistent: some are verb_noun (list_datasets, create_chat), others are single verbs (chat, retrieve), and one includes an adjective (ask_configured_chat). This mixed pattern can confuse an agent.

Tool Count4/5

With 5 tools, the surface is slightly lean but still covers essential RAGFlow operations: listing datasets, creating chats, retrieving chunks, and QA. It does not feel bloated, though a few more tools could enhance completeness.

Completeness2/5

The tool set lacks update and delete operations for both chats and datasets, and there is no tool to manage documents within datasets. This leaves significant gaps for a production RAG system, potentially causing agent failures.

Maintenance

ActivityMaintained
ResponsivenessSyncing

Related MCP Connectors