RFCXML MCP服务器
](https://www.npmjs.com/package/@shuji-bonji/rfcxml-mcp)   ](https://nodejs.org/) 
一种模型上下文协议(MCP)服务器 结构化理解 RFC文档。
目的
与现有的基于文本的RFC MCP服务器不同,该服务器利用RFCXML的语义结构来实现:
- 规范性要求提取 (必须/应该/可能)具有结构化输出
- RFC依赖关系图 建设
- 定义范围管理
- 实施检查表生成
建筑
┌─────────────────────────┐
│ Markdown / PDF │ Display & Sharing
├─────────────────────────┤
│ Translation │ Explanation & Verification
├─────────────────────────┤
│ RFCXML MCP │ Common Understanding for AI & Humans
├─────────────────────────┤
│ RFCXML │ Single Source of Truth
└─────────────────────────┘与现有MCP的比较
| 功能 | 现有mcp-rfc | RFCXML mcp |
|---|---|---|
| RFC文本检索 | ✅ | ✅ |
| 章节提取 | ✅ (基于文本) | ✅ (基于结构) |
| 必须/应该/可以提取 | ❌ | ✅ |
| 条件/例外结构 | ❌ | ✅ |
| RFC依赖关系图 | ❌ | ✅ |
| 定义范围管理 | ❌ | ✅ |
| 实施检查表 | ❌ | ✅ |
快速开始
使用克劳德桌面/Claude代码
将以下内容添加到MCP配置文件中:
{
"mcpServers": {
"rfcxml": {
"command": "npx",
"args": ["-y", "@shuji-bonji/rfcxml-mcp"]
}
}
}配置文件位置:
- 克劳德桌面(macOS):
~/Library/Application Support/Claude/claude_desktop_config.json - 克劳德桌面(Windows):
%APPDATA%\Claude\claude_desktop_config.json - 克劳德代码(项目范围):
.mcp.json从项目根源 - 克劳德代码(用户范围):
~/.claude.json - 克劳德代码(CLI):
claude mcp add rfcxml -- npx -y @shuji-bonji/rfcxml-mcp
安装(可选)
对于全局安装:
npm install -g @shuji-bonji/rfcxml-mcp然后配置MCP:
{
"mcpServers": {
"rfcxml": {
"command": "rfcxml-mcp"
}
}
}可用工具
第一阶段:基本结构
get_rfc_structure-获取节层次结构和元数据get_requirements-用结构提取规范性要求(必须/应该/可能)get_definitions-获取术语定义及其范围
第二阶段:关系
get_rfc_dependencies-获取引用的RFC(规范性/信息性)get_related_sections-获取同一RFC中的相关部分
第3阶段:验证支持
validate_statement-验证语句是否符合RFC要求generate_checklist-生成实施检查表
传统RFC支持
在RFC 8650(2019年12月)之后发布的RFC以官方RFCXML v3格式提供。早期的RFC可能没有XML可用。
此服务器包括 自动回退 功能-当XML不可用时,它会解析文本格式。
源信息
所有回复均包含源信息:
{
"rfc": 6455,
"sections": [...],
"_source": "text",
"_sourceNote": "Warning: Parsed from text format. Accuracy may be limited."
}_source | 说明 |
|---|---|
xml | 从RFCXML解析(高精度) |
text | 从文本解析(中等精度) |
兼容性
| RFC | 格式 | 注释 |
|---|---|---|
| RFC 8650+ | XML | 官方支持RFCXML v3 |
| RFC 8650之前 | 文本 | 自动回退 |
输出样本
get_rfc_structure -获取RFC结构
{
"metadata": {
"title": "Transmission Control Protocol (TCP)",
"docName": "draft-ietf-tcpm-rfc793bis-28",
"number": 9293
},
"sections": [
{
"number": "section-1",
"title": "Purpose and Scope"
},
{
"number": "section-3",
"title": "Functional Specification",
"subsections": [
{ "number": "section-3.1", "title": "Header Format" },
{
"number": "section-3.5",
"title": "Establishing a Connection",
"subsections": [
{ "number": "section-3.5.1", "title": "Half-Open Connections and Other Anomalies" },
{ "number": "section-3.5.2", "title": "Reset Generation" }
]
}
]
}
],
"referenceCount": { "normative": 15, "informative": 85 },
"_source": "xml"
}get_requirements -提取规范性要求
{
"rfc": 9293,
"filter": { "level": "MUST" },
"stats": { "total": 53, "byLevel": { "MUST": 53 } },
"requirements": [
{
"id": "R-section-3.5-5",
"level": "MUST",
"text": "A TCP implementation support simultaneous open attempts (MUST-10).",
"section": "section-3.5",
"sectionTitle": "Establishing a Connection"
},
{
"id": "R-section-3.7.1-9",
"level": "MUST",
"text": "TCP endpoints implement both sending and receiving the MSS Option (MUST-14).",
"section": "section-3.7.1",
"sectionTitle": "Maximum Segment Size Option"
}
],
"_source": "xml"
}get_rfc_dependencies -获取RFC依赖关系
{
"rfc": 9293,
"normative": [
{ "rfcNumber": 791, "title": "Internet Protocol", "anchor": "RFC0791" },
{ "rfcNumber": 2119, "title": "Key words for use in RFCs to Indicate Requirement Levels" },
{ "rfcNumber": 5681, "title": "TCP Congestion Control" }
],
"informative": [
{ "rfcNumber": 793, "title": "Transmission Control Protocol" },
{ "rfcNumber": 1122, "title": "Requirements for Internet Hosts - Communication Layers" }
],
"_source": "xml"
}generate_checklist -生成实施检查表
# RFC 9293 Implementation Checklist
**Transmission Control Protocol (TCP)**
Role: Client
## Required (MUST / REQUIRED / SHALL)
- [ ] A TCP implementation support simultaneous open attempts (MUST-10). (section-3.5)
- [ ] TCP endpoints implement both sending and receiving the MSS Option (MUST-14). (section-3.7.1)
- [ ] The RTO be computed according to the algorithm in, including Karn's algorithm (MUST-18). (section-3.8.1)
## Optional (MAY / OPTIONAL)
- [ ] Implementers include "keep-alives" in their TCP implementations (MAY-5). (section-3.8.4)文本回退输出(传统RFC)
{
"metadata": {
"title": "The WebSocket Protocol",
"number": 6455
},
"sections": [
{ "number": "1", "title": "Introduction" },
{ "number": "5", "title": "Data Framing" }
],
"_source": "text",
"_sourceNote": "Warning: Parsed from text format. Accuracy may be limited."
}示例
请参阅 示例/ 完整检查表样本目录:
Claude的示例提示:
Generate an implementation checklist for RFC 9293 (TCP).内部架构
模块结构
src/
├── index.ts # MCP server entry point
├── config.ts # Centralized configuration
├── constants.ts # BCP 14 keyword definitions + RFC number limits
├── services/
│ ├── rfc-fetcher.ts # RFC fetching (parallel)
│ ├── rfc-service.ts # RFC parse & cache management
│ ├── rfcxml-parser.ts # RFCXML parser
│ ├── rfc-text-parser.ts # Text fallback parser
│ └── checklist-generator.ts # Checklist generation service
├── tools/
│ ├── definitions.ts # MCP tool definitions
│ └── handlers.ts # Tool handlers (toolHandlers map)
├── types/
│ └── index.ts # Type definitions
└── utils/
├── cache.ts # LRU cache
├── fetch.ts # Parallel fetch utility
├── logger.ts # Logger abstraction
├── requirement-extractor.ts # Shared requirement extraction
├── section.ts # Section search utilities
├── statement-matcher.ts # Weighted statement matching
├── text.ts # Text processing utility
└── validation.ts # Input validationRFC获取优化
向多个源(RFC编辑器、IETF工具、数据跟踪器)发送并行请求,并使用第一个成功的响应:
┌─────────────────┐
│ fetchRFCXML() │
└────────┬────────┘
│ Parallel requests
┌────┴────┬────────────┐
▼ ▼ ▼
┌────────┐ ┌────────┐ ┌────────┐
│RFC │ │IETF │ │Data- │
│Editor │ │Tools │ │tracker │
└────┬───┘ └────┬───┘ └────┬───┘
│ │ │
└────┬─────┴──────────┘
│ Promise.any (first success)
▼
┌───────────┐
│ Successful│ → Cancel other requests via AbortController
│ Response │
└───────────┘缓存策略
具有内存限制的LRU(最近最少使用)缓存:
| 缓存 | 最大条目数 | 内容 |
|---|---|---|
| XML缓存 | 20 | 原始RFCXML |
| 文本缓存 | 20 | 原始文本 |
| 元数据缓存 | 100 | RFC元数据 |
| 解析缓存 | 50 | 解析结构 |
发展
# Install dependencies
npm install
# Development mode
npm run dev
# Build
npm run build
# Test (watch mode)
npm test
# Test (single run — for CI etc.)
npm test -- --run
# E2E test (MCP client integration)
npm run test:e2e
# Lint
npm run lint
# Format
npm run format许可证
麻省理工学院
相关项目
- mjpitz/mcp rfc -基于文本的RFC MCP
- ietf工具/RFCXML -RFCXML模式
- xml2rfc -IETF官方工具
