LLM.txt文件解析服务

一个提取并提供LLM.txt文件内容的MCP服务器,支持文件列表、内容检索和高级多查询搜索功能,适用于AI模型理解开发环境中的文件结构、依赖关系和代码关系。

  • by mcp-get
  • JavaScript
  • 本地部署
  • 68 星标
  • 更新于
在 GitHub 查看 mcp-get/community-servers

使用说明

LLM.txt MCP服务器

模型上下文协议(MCP)服务器,从llm.txt文件中提取并提供上下文,使AI模型能够理解开发环境中的文件结构、依赖关系和代码关系。此服务器提供对 LLM.txt目录,支持文件列表、内容检索和高级多查询搜索功能。

特性

  • 带本地缓存的目录列表(24小时缓存)
  • 特定于操作系统的缓存位置:
    • 窗户: %LOCALAPPDATA%\llm-txt-mcp
    • macOS: ~/Library/Caches/llm-txt-mcp
    • Linux: ~/.cache/llm-txt-mcp
  • 带上下文的多查询搜索

安装

推荐:使用MCP Get

最简单的安装方法是使用MCP Get,它将在Claude Desktop中自动配置服务器:

npx @michaellatman/mcp-get@latest install @mcp-get-community/server-llm-txt

手动配置

或者,您可以在Claude Desktop配置中手动配置服务器,方法是将其添加到您的 claude_desktop_config.json:

{
  "mcpServers": {
    "llm-txt": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-llm-txt"
      ]
    }
  }
}

工具

1.list_llm_txt

列出目录中所有可用的LLM.txt文件。结果在本地缓存24小时。

示例响应:

[
  {
    "id": 1,
    "url": "https://docs.squared.ai/llms.txt",
    "name": "AI Squared",
    "description": "AI Squared provides a data and AI integration platform that helps make intelligent insights accessible to all."
  }
]

2.get_llm_txt

通过ID(从list_LLM_txt获得)从LLM.txt文件中获取内容。

参数:

  • id:LLM.txt文件的数字ID

示例响应:

{
  "id": 1,
  "url": "https://docs.squared.ai/llms.txt",
  "name": "AI Squared",
  "description": "AI Squared provides a data and AI integration platform that helps make intelligent insights accessible to all.",
  "content": "# AI Squared\n\n## Docs\n\n- [Create Catalog](https://docs.squared.ai/api-reference/catalogs/create_catalog)\n- [Update Catalog](https://docs.squared.ai/api-reference/catalogs/update_catalog)\n..."
}

3.search_llm_txt

在LLM.txt文件中搜索多个子字符串。

参数:

  • id:LLM.txt文件的数字ID
  • queries:要搜索的字符串数组(不区分大小写)
  • context_lines (可选):比赛前后显示的行数(默认值:2)

示例响应:

{
  "id": 1,
  "url": "https://docs.squared.ai/llms.txt",
  "name": "AI Squared",
  "matches": [
    {
      "lineNumber": 42,
      "snippet": "- [PostgreSQL](https://docs.squared.ai/guides/data-integration/destinations/database/postgresql): PostgreSQL\n popularly known as Postgres, is a powerful, open-source object-relational database system that uses and extends the SQL language combined with many features that safely store and scale data workloads.\n- [null](https://docs.squared.ai/guides/data-integration/destinations/e-commerce/facebook-product-catalog)",
      "matchedLine": "- [PostgreSQL](https://docs.squared.ai/guides/data-integration/destinations/database/postgresql): PostgreSQL\n popularly known as Postgres, is a powerful, open-source object-relational database system that uses and extends the SQL language combined with many features that safely store and scale data workloads.",
      "matchedQueries": ["postgresql", "database"]
    }
  ]
}

常见问题解答

为什么这些工具使用数字ID而不是字符串标识符?

虽然上面的示例为了清楚起见显示了字符串ID,但实际实现使用了数字ID。我们发现,当使用字符串ID(如域名或slug)时,语言模型更有可能产生看似合理但不存在的LLM.txt文件的幻觉。使用不透明的数字ID鼓励模型首先实际检查可用文件的列表,而不是猜测可能的ID。

发展

要在开发模式下运行并自动重新编译,请执行以下操作:

npm install
npm run watch

许可证

麻省理工学院