mcp-rtfm

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Provides Git repository context for documentation generation and analysis. The server can extract context from Git repositories when analyzing projects and creating documentation.

  • Specializes in managing and enhancing Markdown documentation files, providing capabilities for content analysis, metadata generation, and document relationships.

  • Leverages remark for advanced Markdown processing including AST-based content analysis, heading structure detection, and proper Markdown parsing and manipulation.

MCP-RTFM

“RTFM!”他们说,但如果没有 FM 来 R 呢?🤔 那就来 MCP-RTFM 吧:一个 MCP 服务器,帮你创建那本人人都劝人读的《F*ing 手册》!它使用高级内容分析、元数据生成和智能搜索功能,将你那些不存在或难以阅读的文档转化为一个互联的知识库,在提出“基本问题”之前就给出答案。

剧情反转:与其直接告诉大家“读手册”,现在你真的可以给他们一份值得一读的手册了!因为对“读该死的手册”最好的回应,就是拥有一份真正值得一读的手册。📚✨

📚 目录

🚀 快速入门

# 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": [] } } }

克劳德桌面

添加到配置文件:

  • 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”、“工作流”)
  • 灵活分组的标签
  • 基于共享元数据的自动关系发现
  • 内容链接分析

增强内容分析

该服务器使用高级库来更好地管理文档:

  • 统一/注释用于 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 检查器

npm run inspector

检查器将提供一个 URL 来访问浏览器中的调试工具。

📄 许可证

MIT ©模型上下文协议

ID: 44sgp6bmdc