Skip to main content
Glama
Unity-Billal-mesloub

MCP Documentation Server

MCP Registry npm version GitHub Stars Ask DeepWiki

MCP Documentation Server

本地优先的文档管理和语义搜索,专为 AI 编码代理设计。 无需外部数据库,无需云 API,无供应商锁定。

与其他仅限命令行的 MCP 服务器不同,本服务器附带一个完整的 Web 仪表盘——你可以在浏览器中浏览、搜索、上传和管理知识库。每个 MCP 工具也都以 REST API 形式暴露,为 AI 代理提供精简、无模式的接口。

  • 🏠 完全离线运行 — Orama 向量数据库与本地 AI 嵌入(Transformers.js)

  • 🌐 内置 Web UI — 随 MCP 服务器在 3080 端口自动启动

  • 🔍 混合搜索 — 全文检索 + 向量相似度,采用父子分块

  • 🤖 可选 AI 搜索 — 使用 Google Gemini 进行高级文档分析(自带密钥)

  • 📁 拖放上传 — 支持 .txt.md.pdf

  • 📦 已发布到 MCP Registry — 可通过 npx 安装,无需克隆

快速开始

{
  "mcpServers": {
    "documentation": {
      "command": "npx",
      "args": ["-y", "@Unity-Billal-mesloub/mcp-documentation-server"]
    }
  }
}

🤖 代理技能(REST API)— 推荐给 AI 代理

每个 MCP 工具也都可以通过 `` 上的 REST API 访问。这是推荐从 AI 代理(Claude Code、OpenCode、Gemini CLI、Cursor)进行交互的方式,因为这可以避免将 MCP 工具 schema 加载到对话上下文中——只有响应 JSON 会进入上下文。


  -H "Content-Type: application/json" \
  -d '{"query": "your search", "limit": 5}'

skills/documentation-server/SKILL.md 中包含一个可直接使用的技能——它会通过示例教会你的代理每个端点。安装它:

npx skills add https://github.com/Unity-Billal-mesloub/mcp-documentation-server --skill documentation-server

基本工作流程

  1. 使用 add_document 添加文档,或将 .txt / .md / .pdf 文件放入上传文件夹,然后调用 process_uploads

  2. 使用 search_all_documents 在所有文档中搜索,或使用 search_documents 在单个文档内搜索。

  3. 使用 get_context_window 获取相邻的文本块,为 LLM 提供更广泛的上下文。

Related MCP server: OpenLMlib

Web UI

Web 界面会在 MCP 服务器启动时在 3080 端口自动启动。通过 Web UI 你可以:

  • 📊 仪表盘 — 所有文档和统计信息概览

  • 📄 文档 — 浏览、查看和删除文档

  • 添加文档 — 创建带标题、内容和元数据的文档

  • 🔍 全部搜索 — 对所有文档进行语义搜索

  • 🎯 文档内搜索 — 在特定文档中搜索

  • 🤖 AI 搜索 — 由 Gemini 驱动的分析(如果设置了 GEMINI_API_KEY

  • 📁 上传文件 — 拖放文件并将其处理到知识库中

  • 🪟 上下文窗口 — 探索特定索引周围的文本块

配置 MCP 客户端

最小配置

{
  "mcpServers": {
    "documentation": {
      "command": "npx",
      "args": ["-y", "@Unity-Billal-mesloub/mcp-documentation-server"]
    }
  }
}

使用环境变量(全部可选)

{
  "mcpServers": {
    "documentation": {
      "command": "npx",
      "args": ["-y", "@Unity-Billal-mesloub/mcp-documentation-server"],
      "env": {
        "MCP_BASE_DIR": "/path/to/workspace",
        "GEMINI_API_KEY": "your-api-key-here",
        "MCP_EMBEDDING_MODEL": "Xenova/all-MiniLM-L6-v2",
        "START_WEB_UI": "true",
        "WEB_HOST": "127.0.0.1",
        "WEB_PORT": "3080"
      }
    }
  }
}

所有环境变量都是可选的。如果没有 GEMINI_API_KEY,则只有基于本地嵌入的搜索工具可用。

MCP 工具

服务器注册了以下工具(全部使用 Zod 模式验证):

📄 文档管理

工具

描述

add_document

添加文档(标题、内容、可选元数据)

list_documents

列出所有文档,包含元数据和内容预览

get_document

按 ID 获取文档的完整内容

delete_document

删除文档及其分块、数据库记录和相关文件

📁 文件处理

工具

描述

process_uploads

处理上传文件夹中的所有文件(分块 + 嵌入)

get_uploads_path

返回上传文件夹的绝对路径

list_uploads_files

列出上传文件夹中的文件,包含大小和格式信息

get_ui_url

返回 Web UI 的 URL(例如 http://localhost:3080)— 可用于打开仪表盘或从浏览器定位上传文件夹

🔍 搜索

工具

描述

search_documents

在特定文档内进行语义向量搜索

search_all_documents

跨文档混合搜索(全文 + 向量)

get_context_window

返回给定分块索引周围的文本块窗口

search_documents_with_ai

🤖 使用 Gemini 的 AI 搜索(需要 GEMINI_API_KEY

配置

可以通过环境变量或项目根目录下的 .env 文件进行配置:

变量

默认值

描述

MCP_BASE_DIR

~/.mcp-documentation-server

数据存储的基础目录

MCP_EMBEDDING_MODEL

Xenova/all-MiniLM-L6-v2

嵌入模型名称

GEMINI_API_KEY

Google Gemini API 密钥(启用 search_documents_with_ai

MCP_CACHE_ENABLED

true

启用/禁用 LRU 嵌入缓存

START_WEB_UI

true

设为 false 可禁用内置 Web 界面

WEB_HOST

127.0.0.1

Web UI 的绑定地址(使用 0.0.0.0 可在所有接口上暴露)

WEB_PORT

3080

Web UI 的端口

MCP_STREAMING_ENABLED

true

为大型文件启用流式读取

MCP_STREAM_CHUNK_SIZE

65536

流式缓冲区大小(字节,64KB)

MCP_STREAM_FILE_SIZE_LIMIT

10485760

切换为流式读取的阈值(10MB)

存储布局

~/.mcp-documentation-server/     # Or custom path via MCP_BASE_DIR
├── data/
│   ├── orama-chunks.msp         # Orama vector DB (child chunks + embeddings)
│   ├── orama-docs.msp           # Orama document DB (full content + metadata)
│   ├── orama-parents.msp        # Orama parent chunks DB (context sections)
│   ├── migration-complete.flag   # Written after legacy JSON migration
│   └── *.md                     # Markdown copies of documents
└── uploads/                     # Drop .txt, .md, .pdf files here

嵌入模型

通过 MCP_EMBEDDING_MODEL 设置:

模型

维度

说明

Xenova/all-MiniLM-L6-v2

384

默认 — 快速,质量良好

Xenova/paraphrase-multilingual-mpnet-base-v2

768

推荐 — 质量最佳,支持多语言

模型在首次使用时下载(~80–420 MB)。向量维度由提供方自动确定。

⚠️ 重要:更改嵌入模型需要重新添加所有文档——来自不同模型的嵌入不兼容。当维度发生变化时,Orama 数据库会自动重建。

架构

Server (FastMCP, stdio)
  ├─ Web UI (Express, port 3080)
  │    └─ REST API → DocumentManager
  └─ MCP Tools
       └─ DocumentManager
            ├─ OramaStore          — Orama vector DB (chunks DB + docs DB + parents DB), persistence, migration
            ├─ IntelligentChunker  — Parent-child chunking (code, markdown, text, PDF)
            ├─ EmbeddingProvider   — Local embeddings via @xenova/transformers
            │    └─ EmbeddingCache — LRU in-memory cache
            └─ GeminiSearchService — Optional AI search via Google Gemini
  • OramaStore 管理三个 Orama 实例:一个用于文档元数据/内容,一个用于带向量嵌入的子分块,一个用于父分块(上下文段落)。所有实例都会持久化到磁盘上的二进制文件中,并在启动时恢复。

  • IntelligentChunker 实现了父子分块模式:首先将文档拆分为大型父分块以保留完整上下文(章节、段落),然后将每个父分块进一步拆分为小的子分块,以实现精确的向量搜索。查询时,结果按父分块去重,使 LLM 同时获得匹配片段和更广泛的上下文。

  • EmbeddingProvider 延迟加载 Transformers.js 模型以进行本地推理——无需 API 调用。

开发

git clone https://github.com/Unity-Billal-mesloub/mcp-documentation-server.git
cd mcp-documentation-server
npm install
npm run dev       # FastMCP dev mode with hot reload
npm run build     # TypeScript compilation
npm run inspect   # FastMCP web UI for interactive tool testing
npm start         # Direct tsx execution (MCP server + web UI)
npm run web       # Run only the web UI (development)
npm run web:build # Run only the web UI (compiled)

贡献

  1. Fork 本仓库

  2. 创建功能分支:git checkout -b feature/name

  3. 提交信息遵循 Conventional Commits

  4. 打开 Pull Request

支持


Star 历史

Star History Chart

基于 FastMCPOrama 和 TypeScript 构建

F
license - not found
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    Not graded
    quality
    B
    maintenance
    Enables any MCP-compatible AI assistant to search, filter, and retrieve information from a local document collection using a hybrid search pipeline with vector, BM25, reranking, and LLM enrichment.
    4
  • A
    license
    Not graded
    quality
    A
    maintenance
    Provides AI assistants with a local knowledge base and research library, enabling semantic and full-text retrieval, memory persistence, and multi-agent collaboration via 58 MCP tools.
    2
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides tools for ingesting documents into a local vector database and retrieving relevant information via semantic search, enabling retrieval-augmented generation for MCP clients.
    6
  • F
    license
    A
    quality
    B
    maintenance
    A local-first document retrieval engine that mounts as an MCP tool for agents to index files, search for relevant passages, and let the agent's own LLM answer.
    4

View all related MCP servers

Related MCP Connectors

  • Shared, governed long-term memory for AI agents across tools and sessions via MCP and REST.

  • Persistent memory and knowledge management for AI agents with semantic search and 50+ tools.

  • OCR, transcription, file extraction, and image generation for AI agents via MCP.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Unity-Billal-mesloub/mcp-documentation-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server