文档检索服务

Marten Docs MCP Server是一个本地文档检索服务,用于快速检索Marten文档,支持渐进式细化搜索和特定部分读取。

  • by stijnVanHorenbeek
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 stijnVanHorenbeek/marten_mcp

使用说明

Marten Docs MCP服务器

本地MCP服务器,用于集中检索Marten文档。

它缓存 https://martendb.io/llms-full.txt,构建一个局部索引,并公开一个狭窄的检索表面,以便代理首先搜索,然后逐渐缩小到特定的部分。

快速安装

macOS/Linux

# Install latest release
curl -fsSL https://raw.githubusercontent.com/stijnVanHorenbeek/marten_mcp/master/scripts/quickinstall.sh | sh

# Print a Copilot-compatible config snippet
curl -fsSL https://raw.githubusercontent.com/stijnVanHorenbeek/marten_mcp/master/scripts/quickinstall.sh | sh -s -- --client copilot

Windows PowerShell

# Install latest release
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/stijnVanHorenbeek/marten_mcp/master/scripts/quickinstall.ps1)))

# Print a Copilot-compatible config snippet
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/stijnVanHorenbeek/marten_mcp/master/scripts/quickinstall.ps1))) -Client copilot

SKILL.md示例

示例 技能.md 包括

MCP配置示例

开源代码

{
  "mcp": {
    "marten-docs": {
      "type": "local",
      "command": ["marten-docs-mcp"],
      "environment": {
        "MARTEN_MCP_CACHE_DIR": "~/.cache/marten-docs-mcp",
        "MARTEN_MCP_STORAGE_MODE": "auto",
        "MARTEN_MCP_SQLITE_PATH": "~/.cache/marten-docs-mcp/cache.db"
      }
    }
  }
}

GitHub Copilot 聊天助手

{
  "mcpServers": {
    "marten-docs": {
      "type": "local",
      "command": "marten-docs-mcp",
      "args": [],
      "env": {
        "MARTEN_MCP_CACHE_DIR": "~/.cache/marten-docs-mcp",
        "MARTEN_MCP_STORAGE_MODE": "auto",
        "MARTEN_MCP_SQLITE_PATH": "~/.cache/marten-docs-mcp/cache.db"
      },
      "tools": ["*"]
    }
  }
}

MCP工具

  • search_docs(query, limit?, offset?)
  • search_within_page(path, query, limit?, offset?)
  • list_headings(path)
  • read_section(id, segmentIndex?, offset?, maxChars?) (返回一个本地段加上压缩 neighbors.before/after 参考文献)
  • read_context(id, before?, after?) (仅限附近参考文献)
  • list_pages(prefix?, limit?) (仅在搜索不足时发现)
  • get_status()
  • refresh_docs(force?)

推荐检索流程

  1. search_docs(...)
  2. 窄与 list_headings(...) 和 search_within_page(...)
  3. 阅读一个区块 read_section(...)
  4. 使用 read_context(...) 仅供附近参考

宽页面转储故意不受支持。

1. search_docs(query="aggregate projections", limit=3)
2. search_within_page(path="/events/projections/aggregate-projections.md", query="lifecycle", limit=3)
3. read_section(id="<id>", offset=0, maxChars=1200)
4. read_context(id="<id>", before=1, after=1)
5. repeat read_section(..., offset=<nextOffset>) while hasMore=true

配套文件