Skip to main content
Glama
yorikhu
by yorikhu

Phloem

Phloem 是一个企业级、自托管的基于 RAGFlow 构建的知识库平台。它通过类型化的 Node.js API 网关和 MCP 服务器封装引擎,实现与 Agent 的无缝集成。

Phloem(韧皮部)——植物中运输养分的维管组织。知识也应如此流动。

为什么选择 Phloem

  • 自托管 — 您的文档、您的基础设施、您的控制权。数据不会离开您的环境。

  • 面向 Agent — 通过 REST API 或 MCP 服务器公开知识库,让 AI 代理获得基于检索增强的可靠答案。

  • 端到端类型安全 — 一个 OpenAPI 契约驱动网关路由、客户端 SDK 和模拟层。减少集成意外。

  • 可替换后端 — 适配器层隔离 RAGFlow;无需修改业务代码即可更换或升级引擎。

  • 可扩展 — 扩展点注册表(中间件、路由、MCP 工具、Web 模块),支持插件式定制,无需分叉。

Related MCP server: Qurio MCP Server

架构

┌────────────┐   REST    ┌─────────────┐            ┌──────────────┐
│  Web UI    │──────────▶│   Gateway   │──adapter──▶│   RAGFlow    │
│  (Next.js) │           │  (NestJS)   │            │  (submodule) │
└────────────┘           └──────┬──────┘            └──────────────┘
                                │
                         ┌──────┴──────┐
                         │ MCP Server  │  ◀── Claude Desktop, Cursor, custom agents
                         └─────────────┘

包

包

描述

@phloem/shared

类型、Zod 模式、API 契约

@phloem/gateway

带适配器层的 NestJS (Fastify) API 网关

@phloem/mcp

暴露知识工具的 MCP 服务器

@phloem/web

Next.js 15 App Router 控制台,静态导出

@phloem/eslint-config

共享 ESLint 扁平配置

快速开始

前提条件

  • Node.js ≥ 22

  • pnpm ≥ 9

  • Docker(用于 RAGFlow 后端)

安装

git clone --recurse-submodules https://github.com/phytul/phloem.git
cd phloem
pnpm install
cp deploy/docker/.env.example deploy/docker/.env

运行(开发)

# Gateway
pnpm --filter @phloem/gateway dev

# Web console (Next.js dev server, port 5273)
pnpm --filter @phloem/web dev

运行(使用 RAGFlow)

# Build and start RAGFlow (Lite profile, Infinity engine)
docker compose -f deploy/docker/docker-compose.yml -f deploy/docker/docker-compose.lite.yml up -d

pnpm --filter @phloem/gateway dev
pnpm --filter @phloem/web dev

验证

curl http://localhost:3000/healthz

API

REST 契约是唯一事实来源:openapi.yaml。

核心资源:

  • POST /v1/retrieval — 跨数据集混合检索

  • GET/POST /v1/datasets — 知识库管理

  • POST /v1/datasets/{id}/documents — 文档上传

  • GET /healthz — 存活探针

MCP 工具

工具

描述

retrieve_knowledge

跨知识库混合检索

list_datasets

列出可用的知识库

开发

pnpm run build        # build all packages
pnpm run typecheck    # strict TS check across the monorepo
pnpm run lint         # ESLint + Prettier

提交遵循 Conventional Commits。Hooks(lint-staged + commitlint)会自动强制执行。

许可证

Apache-2.0

链接

  • RAGFlow — 底层引擎

  • MCP — Model Context Protocol

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    A
    quality
    D
    maintenance
    Enables AI agents to query a local knowledge graph built from document collections using hybrid search (BM25 + vector fusion) and entity-relationship extraction. Supports privacy-first, offline operation with tools for semantic search, entity graph exploration, and corpus statistics.
    3
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI coding assistants to search and retrieve information from a locally ingested knowledge base using hybrid search, grounded in user-curated documentation.
    17
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Exposes knowledge base retrieval tools for AI agents via the Model Context Protocol, enabling hybrid search across datasets and dataset listing.
    0
    Apache 2.0