m

mcp文档问答库

@ryanjoachim/mcp-rtfm
2 Stars 595 次浏览 ryanjoachim 更新于 2026-08-23

将您不存在或无法读取的文档转化为一个智能的、可搜索的知识库,它可以在问题被提出之前就回答那些“基础问题”。

该服务暂未提供标准配置,请参考 README 手动接入

可用工具 (11 个)

该服务在 MCP 协议中暴露的工具,AI 可按需调用

analyze_existing_docs 1 个参数 需填 1 项

Analyze existing documentation files with enhanced content analysis and metadata generation

必填参数:projectPath

analyze_project_with_metadata 1 个参数 需填 1 项

Analyze project structure, create initial documentation files, and enhance with metadata/context

必填参数:projectPath

analyze_project 1 个参数 需填 1 项

Analyze project structure and create initial documentation files

必填参数:projectPath

read_doc 2 个参数 需填 2 项

Read a documentation file (required before updating)

必填参数:projectPath、docFile

update_doc 5 个参数 需填 4 项

Update a specific documentation file using diff-based changes

必填参数:projectPath、docFile、searchContent、replaceContent

get_doc_content 2 个参数 需填 2 项

Get the current content of a documentation file

必填参数:projectPath、docFile

get_project_info 1 个参数 需填 1 项

Get information about the project structure and files

必填参数:projectPath

search_docs 2 个参数 需填 2 项

Search across documentation files with highlighted results

必填参数:projectPath、query

update_metadata 3 个参数 需填 3 项

Update metadata for a documentation file

必填参数:projectPath、docFile、metadata

get_related_docs 2 个参数 需填 2 项

Find related documentation files based on metadata

必填参数:projectPath、docFile

customize_template 3 个参数 需填 2 项

Create or update a custom documentation template

必填参数:templateName、content

服务介绍

MCP-RTFM

TypeScript
MCP

“去读手册!”他们说,但如果根本没有手册可读怎么办?🤔 这时就轮到 MCP-RTFM 出场了:这是一个 MCP 服务器,帮助你创建那个每个人都告诉别人去读的手册!通过高级内容分析、元数据生成和智能搜索功能,它将你不存在或难以阅读的文档转化为一个真正能回答那些“基本问题”的互连知识库。

剧情转折:与其只是告诉人们去读手册,现在你可以给他们一个真正值得读的手册!因为对“去读那该死的手册”最好的回应就是有一个真正值得一读的手册。📚✨

📚 目录

🚀 快速开始

# Install dependencies
npm install

# Build the server
npm run build

# Add to your MCP settings and start using
await use_mcp_tool({
  server: "mcp-rtfm",
  tool: "analyze_project_with_metadata", // Enhanced initialization
  args: { projectPath: "/path/to/project" }
});

// This will:
// 1. Create documentation structure
// 2. Analyze content with unified/remark
// 3. Generate intelligent metadata
// 4. Build search index with minisearch
// 5. Add structured front matter
// 6. Make your docs actually readable!

✨ 特性

文档管理工具

  • analyze_existing_docs - 通过内容分析和元数据增强现有文档
  • analyze_project_with_metadata - 使用增强的内容分析和元数据生成初始化文档结构
  • analyze_project - 基本的文档结构初始化
  • read_doc - 读取文档文件(在更新前需要)
  • update_doc - 使用基于差异的更改更新文档
  • get_doc_content - 获取文档文件的当前内容
  • get_project_info - 获取项目结构和文档状态
  • search_docs - 搜索文档文件并高亮显示结果
  • update_metadata - 更新文档元数据
  • get_related_docs - 根据元数据和内容链接查找相关文档
  • customize_template - 创建或更新文档模板

默认文档文件

服务器会自动创建并管理这些核心文档文件:

  • techStack.md - 工具、库和配置的详细清单
  • codebaseDetails.md - 代码结构和逻辑的低级解释
  • workflowDetails.md - 关键流程的逐步工作流程
  • integrationGuides.md - 外部系统连接的说明
  • errorHandling.md - 故障排除策略和实践
  • handoff_notes.md - 关键主题和下一步的摘要

文档模板

内置的不同类型文档模板:

  • 标准文档模板
  • API 文档模板
  • 工作流文档模板

可以使用 customize_template 工具创建自定义模板。

📝 示例工作流程

1. 分析现有文档

// Enhance existing documentation with advanced analysis
await use_mcp_tool({
  server: "mcp-rtfm",
  tool: "analyze_existing_docs",
  args: { projectPath: "/path/to/project" }
});

// This will:
// - Find all markdown files in .handoff_docs
// - Analyze content structure with unified/remark
// - Generate intelligent metadata
// - Build search index
// - Add front matter if not present
// - Establish document relationships
// - Preserve existing content

// The results include:
// - Enhanced metadata for all docs
// - Search index population
// - Content relationship mapping
// - Git context if available

2. 增强项目文档设置

// Initialize documentation with advanced content analysis
await use_mcp_tool({
  server: "mcp-rtfm",
  tool: "analyze_project_with_metadata",
  args: { projectPath: "/path/to/project" }
});

// Results include:
// - Initialized documentation files
// - Generated metadata from content analysis
// - Established document relationships
// - Populated search index
// - Added structured front matter
// - Git repository context

// Get enhanced project information
const projectInfo = await use_mcp_tool({
  server: "mcp-rtfm",
  tool: "get_project_info",
  args: { projectPath: "/path/to/project" }
});

// Search across documentation with intelligent results
const searchResults = await use_mcp_tool({
  server: "mcp-rtfm",
  tool: "search_docs",
  args: {
    projectPath: "/path/to/project",
    query: "authentication"
  }
});

// Results include:
// - Weighted matches (title matches prioritized)
// - Fuzzy search results
// - Full content context
// - Related document suggestions

3. 更新带有内容链接的文档

// First read the document
await use_mcp_tool({
  server: "mcp-rtfm",
  tool: "read_doc",
  args: {
    projectPath: "/path/to/project",
    docFile: "techStack.md"
  }
});

// Update with content that links to other docs
await use_mcp_tool({
  server: "mcp-rtfm",
  tool: "update_doc",
  args: {
    projectPath: "/path/to/project",
    docFile: "techStack.md",
    searchContent: "[Why this domain is critical to the project]",
    replaceContent: "The tech stack documentation provides essential context for development. See [[workflowDetails]] for implementation steps.",
    continueToNext: true // Automatically move to next document
  }
});

4. 管理文档元数据

// Update metadata for better organization
await use_mcp_tool({
  server: "mcp-rtfm",
  tool: "update_metadata",
  args: {
    projectPath: "/path/to/project",
    docFile: "techStack.md",
    metadata: {
      title: "Technology Stack Overview",
      category: "architecture",
      tags: ["infrastructure", "dependencies", "configuration"]
    }
  }
});

// Find related documentation
const related = await use_mcp_tool({
  server: "mcp-rtfm",
  tool: "get_related_docs",
  args: {
    projectPath: "/path/to/project",
    docFile: "techStack.md"
  }
});

5. 带有上下文的文档搜索

// Search with highlighted results
const results = await use_mcp_tool({
  server: "mcp-rtfm",
  tool: "search_docs",
  args: {
    projectPath: "/path/to/project",
    query: "authentication"
  }
});

// Results include:
// - File name
// - Line numbers
// - Highlighted matches
// - Context around matches

6. 创建自定义模板

// Create a custom template for architecture decisions
await use_mcp_tool({
  server: "mcp-rtfm",
  tool: "customize_template",
  args: {
    templateName: "architecture-decision",
    content: `# {title}

## Context
[Background and context for the decision]

## Decision
[The architecture decision made]

## Consequences
[Impact and trade-offs of the decision]

## Related Decisions
[Links to related architecture decisions]`,
    metadata: {
      category: "architecture",
      tags: ["decision-record", "design"]
    }
  }
});

🔧 安装

VSCode (Roo Cline)

在以下位置添加到设置文件:

  • Windows: %APPDATA%\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\cline_mcp_settings.json
  • MacOS: ~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
  • Linux: ~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
{
  "mcpServers": {
    "mcp-rtfm": {
      "command": "node",
      "args": ["<path-to-mcp-rtfm>/build/index.js"],
      "disabled": false,
      "alwaysAllow": []
    }
  }
}

Claude Desktop

在以下位置添加到配置文件:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "mcp-rtfm": {
      "command": "node",
      "args": ["<path-to-mcp-rtfm>/build/index.js"],
      "disabled": false,
      "alwaysAllow": []
    }
  }
}

🎯 高级功能

内容链接

使用 [[document-name]] 语法在文档之间创建链接。服务器会自动跟踪这些关系,并在查找相关文档时包含它们。

元数据驱动的组织

文档通过以下方式组织:

  • 分类(例如,“架构”、“API”、“工作流程”)
  • 标签用于灵活分组
  • 基于共享元数据的自动关系发现
  • 内容链接分析

增强的内容分析

服务器使用高级库进行更好的文档管理:

  • unified/remark 用于 Markdown 处理:

    • 基于 AST 的内容分析
    • 准确的标题结构检测
    • 代码块和链接提取
    • 正确的 Markdown 解析和操作
  • minisearch 用于强大的搜索功能:

    • 跨所有文档的快速模糊搜索
    • 字段加权搜索(标题优先级更高)
    • 完整内容和元数据索引
    • 带 TTL 管理的高效缓存
    • 实时搜索索引更新

智能元数据生成

  • 自动内容分析以进行分类
  • 基于内容模式的智能标签生成
  • 文档中的结构化前置事项
  • 基于 AST 的标题和部分检测
  • 代码片段识别和标记
  • 上下文感知的结果呈现

模板系统

  • 内置模板用于常见文档类型
  • 支持带元数据默认值的自定义模板
  • 模板继承和覆盖能力
  • 占位符系统以实现一致的格式化

🛠️ 开发

# Install dependencies
npm install

# Build the server
npm run build

# Development with auto-rebuild
npm run watch

🐛 调试

由于 MCP 服务器通过 stdio 进行通信,调试可能会很困难。请使用 MCP Inspector

npm run inspector

Inspector 将提供一个 URL,以便您在浏览器中访问调试工具。

📄 许可证

MIT © Model Context Protocol

相关 MCP 服务