Skip to main content
Glama
hephaistools

ragifix-mcp

Official
by hephaistools

ragifix-mcp

MCP 服务器(Model Context Protocol,Streamable HTTP 传输),它将 ragifix 数据库暴露给兼容的聊天客户端(文档的搜索、添加、删除、列出)。

目录


Related MCP server: docrag

通过 Docker 安装

git clone <url-du-dépôt> ragifix-mcp && cd ragifix-mcp

cp config.example.yaml config.yaml              # puis l'adapter
cp deploy/ragifix-mcp.env.example ragifix-mcp.env # puis renseigner les secrets

docker build -f deploy/docker/Dockerfile -t ragifix-mcp .

docker run -d \
  --name ragifix-mcp \
  --network host \
  --env-file ragifix-mcp.env \
  -v "$(pwd)/config.yaml:/etc/ragifix/config.yaml:ro" \
  ragifix-mcp

--network host:默认情况下(server.host: 127.0.0.1),服务器必须保持可在本地访问,且所在机器同时也承载 ragifix 和聊天客户端。

检查服务是否在运行(没有令牌时预期返回 401——这是服务器正在响应的标志):

curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:8422/mcp \
  -X POST -H "Content-Type: application/json" -d '{}'

通过 .deb 包安装

git clone <url-du-dépôt> ragifix-mcp && cd ragifix-mcp

sudo apt-get install -y devscripts debhelper python3-venv python3-pip
dpkg-buildpackage -us -uc -b

sudo apt install -y ../ragifix-mcp_0.1.0-1_all.deb

安装(postinst)会在 /opt/ragifix-mcp/venv 中构建一个 Python 虚拟环境,并从 PyPI 安装依赖项(轻量级:mcphttpxstarletteuvicornpydantic——在 apt install 时需要网络访问,之后服务可离线运行)。

该包会创建一个专用系统用户、/etc/ragifix-mcp/config.yamlragifix-mcp.env(来自示例),以及一个 systemd 单元 ragifix-mcp.service

sudo nano /etc/ragifix-mcp/config.yaml
sudo nano /etc/ragifix-mcp/ragifix-mcp.env
sudo systemctl enable --now ragifix-mcp
journalctl -u ragifix-mcp -f
sudo apt remove ragifix-mcp    # conserve la config
sudo apt purge ragifix-mcp     # supprime tout

在开发环境中安装

git clone <url-du-dépôt> ragifix-mcp && cd ragifix-mcp

python3 -m venv venv
source venv/bin/activate
pip install -e .

cp config.example.yaml config.yaml   # reste à côté du code, hors /etc

export RAGIFIX_MCP_TOKEN=dev-mcp-token
export RAGIFIX_API_TOKEN=dev-token    # le token de l'API ragifix visée

ragifix-mcp --config ./config.yaml

要粘贴到聊天客户端中的配置

服务器启动后,在客户端配置中按当前标准格式声明一个远程 MCP 服务器(HTTP 传输):

{
  "mcpServers": {
    "ragifix": {
      "url": "http://127.0.0.1:8422/mcp",
      "headers": {
        "Authorization": "Bearer <RAGIFIX_MCP_TOKEN>"
      }
    }
  }
}

<RAGIFIX_MCP_TOKEN> 替换为 ragifix-mcp.env 中配置的值(开发环境中为 RAGIFIX_MCP_TOKEN),如果服务器实际地址与 127.0.0.1:8422 不同,请将 URL 替换为实际地址。

一些较旧的客户端还无法直接连接到远程 HTTP 服务器,只接受本地命令(command/args);在这种情况下,可以通过像 mcp-remote 这样的桥接工具:

{
  "mcpServers": {
    "ragifix": {
      "command": "npx",
      "args": [
        "-y", "mcp-remote",
        "http://127.0.0.1:8422/mcp",
        "--header", "Authorization: Bearer <RAGIFIX_MCP_TOKEN>"
      ]
    }
  }
}

请参阅所用聊天客户端的文档,以了解在哪里粘贴此配置(MCP 配置文件,或连接器/MCP 服务器管理界面)。

暴露的工具

工具

描述

rag_query(query, top_k=5)

搜索最相关的段落。

rag_list_documents(prefix=None)

列出 ragifix 中索引的文档。

rag_get_document(doc_id)

文档详情。

rag_add_document(doc_id, content, extension, content_encoding="utf8", metadata=None)

添加/更新文档(content_encoding"utf8" 表示纯文本,"base64" 表示二进制内容——pdf/docx/pptx/xlsx/html)。

rag_delete_document(doc_id)

删除文档(幂等)。

rag_health()

检查 ragifix 是否可达。

远程访问

默认情况下(server.host: 127.0.0.1),服务器只能从本机访问——适合与聊天客户端在同一台机器上运行(例如:本地 Claude Desktop)。

对于远程聊天客户端,需要做两处更改:

  1. server.host(在 config.yaml 中):改为 0.0.0.0(所有接口)或相关网络接口的 IP。只要 host 不是本地地址,启动时就会记录一条警告,以提醒这一点。

  2. TLS:该服务器本身不终止 TLS。请在其前面放置一个反向代理(nginx、Caddy、Traefik...),由它管理证书并在内部转发到 http://127.0.0.1:<port>/mcp。以下是使用 Caddy 的最小示例:

    mcp.exemple.fr {
        reverse_proxy 127.0.0.1:8422
    }

    聊天客户端一侧声明的 url 随之变为 https://mcp.exemple.fr/mcp

在这两种情况下,专用令牌(RAGIFIX_MCP_TOKEN)仍然是应用层保护——TLS 保护传输层,令牌保护访问。

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides semantic search over markdown documentation using RAG, allowing natural language queries and integration with MCP clients.
    1
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides RAG (Retrieval Augmented Generation) access to technical documentation through MCP, enabling LLMs to search and retrieve relevant documentation on-demand.
    4
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Exposes an existing RAG API as MCP tools, enabling health checks and document-based question answering with source evidence.
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to query and manage a document knowledge base via MCP, with RAG-powered search and grounded answers with citations.
    MIT