检索增强生成文档服务器

一个为网络可观测性平台(如Meraki、Splunk和ThousandEyes)提供检索增强生成(RAG)文档的自定义模型上下文协议(MCP)服务器,支持最佳实践、API模式、技术指南和全文搜索等功能。

  • by JackRiebel
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 JackRiebel/network-rag-mcp

使用说明

网络RAG MCP服务器

一个定制的模型上下文协议(MCP)服务器,为网络可观察性平台(Meraki、Splunk和ThousandEyes)的RAG(检索增强生成)文档提供服务。

特性

  • 最佳实践:检索每个平台的详细最佳实践
  • API架构:访问示例JSON/YAML模式和有效载荷
  • 技术指南:获取有关分页、速率限制、优化等的具体指南。
  • 路线规划手册:访问网络可观察性任务路由剧本
  • 搜索:在所有RAG文档中进行全文搜索
  • 概述:获取可用文档的全面概述

安装

先决条件

  • Python 3.10或更高版本
  • pip(Python包管理器)

设置步骤

  1. 克隆或下载此存储库

  2. 创建知识库结构:

    mkdir -p claude-knowledge/rag/{meraki,splunk,thousandeyes}
    mkdir -p claude-knowledge/playbooks
    
  3. 添加您的RAG文档 到 claude-knowledge/ 文件夹结构:

    claude-knowledge/
    ├─ rag/
    │  ├─ meraki/
    │  │  ├─ dashboards.json
    │  │  ├─ api_schemas.yaml
    │  │  ├─ best_practices.md
    │  │  ├─ pagination.md
    │  │  └─ rate_limits.md
    │  ├─ splunk/
    │  │  ├─ notable_events.json
    │  │  ├─ search_syntax.md
    │  │  ├─ best_practices.md
    │  │  ├─ optimization.md
    │  │  └─ token_rotation.md
    │  └─ thousandeyes/
    │     ├─ tests.json
    │     ├─ alerts.yaml
    │     ├─ best_practices.md
    │     ├─ alert_dedup.md
    │     └─ test_query.md
    └─ playbooks/
       └─ routing_playbook.md
    
  4. 安装依赖项:

    pip install -r requirements.txt
    
  5. 使服务器可执行:

    chmod +x server.py
    

Claude桌面配置

将此服务器添加到您的Claude Desktop配置文件中:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
视窗: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "network-rag": {
      "command": "python",
      "args": ["/absolute/path/to/network-rag-mcp/server.py"],
      "env": {}
    }
  }
}

替换 /absolute/path/to/network-rag-mcp/ 此目录的实际路径。

使用紫外线(替代)

如果您更喜欢使用 uv:

{
  "mcpServers": {
    "network-rag": {
      "command": "uvx",
      "args": ["--from", "fastmcp", "mcp", "run", "/absolute/path/to/network-rag-mcp/server.py"],
      "env": {}
    }
  }
}

可用工具

配置后,Claude将可以访问这些工具:

1. get_best_practices(platform: str)

检索平台的最佳实践文档。

示例: get_best_practices("meraki")

2. get_api_schema(platform: str, format: str = "yaml")

获取API架构文档。

示例: get_api_schema("thousandeyes", "yaml")

3. get_technical_guide(platform: str, topic: str)

检索特定的技术指南。

示例: get_technical_guide("splunk", "optimization")

可用主题:

  • 梅拉基:分页、速率限制
  • 斯普兰克:搜索语法、优化、标记旋转
  • 千只眼睛:alert_dup,test_query

4. get_routing_playbook()

检索完整的网络可观察性任务路由剧本。

示例: get_routing_playbook()

5. search_knowledge_base(query: str, platforms: List[str] = None)

搜索所有RAG文档。

示例: search_knowledge_base("rate limiting")

6. list_available_resources()

列出按平台组织的所有可用文档。

示例: list_available_resources()

7. get_platform_overview(platform: str)

获取平台文档的全面概述。

示例: get_platform_overview("meraki")

使用示例

配置完Claude Desktop后,您可以向Claude提出以下问题:

  • “Meraki API速率限制的最佳实践是什么?”
  • “显示ThousandEyes警报模式”
  • “在所有平台上搜索分页”
  • “给我网络故障排除的路由手册”
  • “Splunk有哪些优化指南?”

Claude将自动使用适当的MCP工具检索和呈现信息。

测试服务器

独立测试服务器:

python server.py

服务器将启动并等待MCP客户端连接。

故障排除

服务器未出现在Claude桌面中

  1. 检查配置文件路径是否正确
  2. 确保 server.py 路径是绝对的,不是相对的
  3. 完全重新启动克劳德桌面
  4. 检查Claude Desktop日志是否有错误

未找到知识库文件

  1. 验证 claude-knowledge/ 文件夹与位于同一目录中 server.py
  2. 确保所有文件路径与结构完全匹配
  3. 检查文件权限(文件应可读)

导入错误

pip install --upgrade -r requirements.txt

发展

添加新平台

  1. 在下创建新目录 claude-knowledge/rag/
  2. 添加您的markdown、JSON和YAML文件
  3. 更新 valid_platforms 服务器代码中的列表
  4. 添加特定于平台的模式和主题映射

添加新工具

添加装饰有新功能 @mcp.tool() 把他们暴露给克劳德。

许可证

此MCP服务器按原样提供,供Claude Desktop使用。

支持

对于以下问题:

  • MCP服务器:请查看FastMCP文档,网址为https://github.com/jlowin/fastmcp
  • Claude桌面版:参观https://support.claude.com
  • 您的RAG文件:确保它们遵循预期的结构

版本

当前版本:1.0.0