Llmstxt Doc Search

io.github.praveenc由 GitHub 账号 praveenc 发布v1.0.0更新于 Oct 24, 2026

BM25 search over llms.txt doc indexes (Strands, Kiro, AWS); sources addable at runtime.

概览

AI 生成的概览

一个本地 MCP 服务器,把 llms.txt 文档索引变成 BM25 排序搜索,让助手能搜索并获取已注册来源的最新文档。

可以做什么
查看与列出来源:显示已注册的 llms.txt 来源、其网址和索引状态,包括最近的索引错误。搜索文档:在单个来源或全部来源上执行 BM25 排序查询,返回标题、网址、分数和摘要片段。获取文档:按需抓取某条结果的完整 Markdown 或 HTML 内容。管理来源:在运行时新增 llms.txt 来源、移除来源或刷新已有索引。
适用场景
适合助手需要从发布 llms.txt 索引的文档站点(如 Strands、Kiro 或 AWS 指南)获取快速、最新的参考资料,而不必在本地保存整套文档快照。适用于范围广、更新快的技术文档。
运行要求
以 npm 包形式通过 stdio 在本地运行,可用 npx 或全局安装;需要 Node.js 20 或更高版本。需要网络访问以抓取 llms.txt 索引和页面。无需账号、API 密钥或请求头;可选环境变量用于设置注册表路径、摘要抓取数量、页面缓存大小和日志级别。
安装前请注意
服务器会在运行时抓取用户提供的网址;它把抓取限制在已注册来源内并阻止私有和保留地址,但添加来源即会指向第三方站点。新增、移除和刷新来源会改动持久化的注册表文件,移除操作被标记为破坏性。抓取的页面内容来自外部站点,应视为不可信。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Llmstxt Doc Search,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

llmstxt-doc-search

Live, ranked search across any number of llms.txt documentation sites - Strands, Kiro, the AWS guides, and whatever you add at runtime.

[npm version] [MCP Registry] [License: MIT] [Release]

llmstxt-doc-search is a Model Context Protocol (MCP) server that turns the llms.txt index a documentation site publishes into a fast, ranked search tool your agent can call. It indexes titles at startup, ranks queries with BM25, and fetches the full document only when you open a result - so you get current docs with almost no local storage. Built on the search engine from @praveenc/mcp-docs-server, generalized to a runtime registry of sources.

It implements the MCP 2026-07-28 specification over stdio and still works with clients on the 2025 protocol, which open with an initialize handshake. Requires Node.js 20 or later.


Why

An llms.txt file is a curated index of a doc site's pages, published for tools like this one to consume. They can be large - AWS Bedrock's lists roughly a thousand documents - so downloading everything is wasteful and goes stale fast.

This server takes a leaner approach:

  • Title-only index, built lazily. On first search of a source, only the page titles are indexed. That is fast to build and tiny to hold in memory.
  • Ranked with BM25. Queries are scored with BM25 plus Porter stemming, bigrams, and markdown-aware weighting (headers, code, and links count for more). Technical terms like mcp, json, and stdio are preserved rather than stemmed.
  • Content on demand. The full markdown or HTML of a result is fetched only when you call fetch_doc.

The result is a good fit for broad, fast-moving reference material - the opposite tradeoff to snapshotting docs into a local vault.


Installation

Quick start (recommended)

Add the server to your MCP client configuration (Claude Desktop, Kiro, and others). It is downloaded and run on demand via npx - no manual build:

json
{  "mcpServers": {    "llmstxt-doc-search": {      "command": "npx",      "args": ["-y", "@praveenc/llmstxt-doc-search"]    }  }}

Global install

bash
npm install -g @praveenc/llmstxt-doc-search

Then point your MCP client at the installed binary:

json
{  "mcpServers": {    "llmstxt-doc-search": {      "command": "llmstxt-doc-search"    }  }}

Quick start

Once the server is connected, the typical flow is three calls:

  1. docs_home() - orient yourself: see the registered sources and how to search and fetch.
  2. search_docs("prompt caching", "aws-bedrock-userguide") - rank matching docs. Omit the source to search everything.
  3. fetch_doc(url) - read the full content of a result you like.

Add your own source at any time and it is indexed immediately and persisted for future runs:

add_doc_source("langgraph", "https://langchain-ai.github.io/langgraph/llms.txt")

Tools

ToolPurpose
docs_home()Orientation: registered sources plus how to search and fetch. Call this first.
list_doc_sources()List sources with their llms.txt URL and index status, including the last index error for a failing source.
search_docs(query, source?, k?)BM25 search. Omit source to search all, or scope to one. Returns ranked {source, url, title, score, snippet}, where score (0-1) is comparable across sources. k defaults to 5 (max 50).
fetch_doc(url)Fetch the full content of a result URL. The URL must be under the llms.txt directory of a registered source, or listed in the llms.txt of a source that has been indexed (by a search, add, or refresh).
add_doc_source(name, llms_txt_url)Register and index a new llms.txt source at runtime. Persisted. Rejected if that llms.txt is already registered or contains no links.
remove_doc_source(name)Remove a registered source.
refresh_doc_source(name)Re-index a source to pick up new or changed docs. A source whose llms.txt fails to index is skipped for 5 minutes; this retries it immediately.

docs_home, list_doc_sources, search_docs, and fetch_doc are annotated read-only, so a client can approve them without prompting. add_doc_source, remove_doc_source, and refresh_doc_source change the persisted registry, and remove_doc_source is annotated destructive. The tool list is fixed, so it is advertised as cacheable for one hour.

Default sources

Seeded into the registry on first run:

strands, kiro, aws-bedrock-userguide, aws-agentic-ai-lens, aws-bedrock-agentcore-devguide, mcp.

The registry is persisted at ~/.config/llmstxt-doc-search/sources.json (override with LLMSTXT_REGISTRY_PATH). Anything you add, remove, or refresh at runtime is saved there.


Configuration

All configuration is via environment variables; none are required.

VariableDefaultMeaning
LLMSTXT_REGISTRY_PATH~/.config/llmstxt-doc-search/sources.jsonWhere the source registry is persisted.
LLMSTXT_SNIPPET_HYDRATE_MAX5How many top hits to fetch when building result snippets.
LLMSTXT_PAGE_CACHE_MAX50Max fetched pages kept in memory per source (LRU); least-recently-used pages are evicted past this. 0 disables the cap.
LLMSTXT_LOG_LEVELinfoLog verbosity: debug, info, warn, or error. Logs go to stderr only.

Testing with MCP Inspector

bash
npx @modelcontextprotocol/inspector npx -y @praveenc/llmstxt-doc-search

The Inspector can connect in either protocol era; see Protocol eras.


Development

Clone the repository for local work (Node.js 20 or later):

bash
git clone https://github.com/praveenc/llmstxt-doc-search.gitcd llmstxt-doc-searchnpm install

Commands

bash
npm run dev         # run from source with tsx (no build)npm test            # offline unit and protocol testsnpm run typecheck   # type-check without emittingnpm run build       # compile to dist/npm run inspect:dev # MCP Inspector against the source

Local MCP client config (development)

Point your client at a source checkout instead of the published package:

json
{  "mcpServers": {    "llmstxt-doc-search": {      "command": "npx",      "args": ["tsx", "/ABS/PATH/llmstxt-doc-search/src/index.ts"]    }  }}

Or, after npm run build, at the compiled entry point:

json
{  "mcpServers": {    "llmstxt-doc-search": {      "command": "node",      "args": ["/ABS/PATH/llmstxt-doc-search/dist/index.js"]    }  }}

Architecture

text
src/├── index.ts              # Tool registration and the stdio entry point (serves 2026-07-28 and 2025-era clients)├── config.ts             # Defaults and environment configuration├── tools/│   └── docs.ts           # search_docs, fetch_doc, and source management└── utils/    ├── doc-fetcher.ts    # HTTP fetching, redirect handling, HTML parsing    ├── indexer.ts        # BM25 search index    ├── registry.ts       # Persisted source registry    ├── store.ts          # In-memory document store    ├── text-processor.ts # Tokenization and snippet helpers    ├── url-validator.ts   # SSRF guard and URL validation    ├── stopwords.ts      # Stop-word list    └── logger.ts         # Logging utilities

Search algorithm

Ranking uses BM25 (Best Matching 25) with several enhancements:

  • Porter stemming matches word variants (for example, running and run).
  • Bigrams capture phrase matches (for example, prompt caching).
  • Weighted scoring boosts title matches (3-8x), headers (4x), code blocks (2x), and link text (2x).
  • Domain-term preservation keeps technical terms like mcp, json, and stdio unstemmed so they match exactly.

Security

This server fetches user-supplied URLs at runtime, so its SSRF surface is guarded in depth:

  • Scoped fetches. fetch_doc only retrieves URLs that a registered source's llms.txt lists exactly, or that sit under that source's origin and path prefix (matched on a path boundary rather than a raw string prefix). There is no arbitrary fetch.
  • Scheme allow-list. Non-http(s) schemes are rejected.
  • Range-based address blocking. Private and reserved destinations are blocked using IP range classification (ipaddr.js), covering decimal, octal, and hex IPv4, IPv4-mapped IPv6, loopback, link-local, unique-local, carrier-grade NAT, and other reserved ranges - not just a hostname regex.
  • Connection-time validation. The resolved IP is checked at connection time via a custom DNS lookup, closing DNS-rebinding, and every redirect hop is re-validated.
  • Bounded responses. Response bodies are capped at 10 MB to limit memory and regular-expression (ReDoS) exposure.

Runtime dependencies report zero known vulnerabilities.


License

MIT - Copyright (c) 2026 Praveen Chamarthi


Contributing

Contributions are welcome. If you find a bug or have an idea:

  1. Open an issue describing the problem or proposal.
  2. For code changes, fork the repo and create a feature branch.
  3. Keep changes focused, add or update tests, and make sure npm test, npm run typecheck, and npm run build all pass.
  4. Open a pull request against main with a clear description of what changed and why.

Commit messages follow the Conventional Commits style.


Support

  • Questions and ideas: open a GitHub issue.
  • Bugs: please include your MCP client, the tool call you made, and any relevant logs (set LLMSTXT_LOG_LEVEL=debug for more detail).
  • Security issues: open an issue marked as security-sensitive, or contact the maintainer directly rather than posting exploit details publicly.

Built for the MCP community ❤️

来源:README.md,提交 768954a

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

3
  1. v1.0.0最新Sep 30, 2026
  2. v0.2.0Sep 30, 2026
  3. v0.1.0Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分