repo-to-txt-mcp

repo-to-txt-mcp

用于分析和转换 Git 仓库为文本文件,以供 LLM 上下文使用的 MCP 服务器。 (Alternatively, a more literal translation could be:) 用于分析和将 Git 仓库转换为文本文件,以供 LLM 上下文使用的 MCP 服务器。 **Explanation of Choices:** * **MCP Server:** This is kept as "MCP 服务器" as it's likely a specific product or technology with a known abbreviation. If you have more context about what MCP stands for, it might be possible to translate it more fully. * **Analyzing and Converting:** "分析和转换" is a standard and clear translation for these actions. * **Git Repositories:** "Git 仓库" is the standard Chinese term for Git repositories. * **Text Files:** "文本文件" is the standard Chinese term for text files. * **LLM Context:** "LLM 上下文" is used. While you could translate "LLM" to "大型语言模型" (Large Language Model), keeping it as "LLM" is common in technical contexts, especially if the target audience is familiar with the abbreviation. "上下文" is the standard translation for "context." * **For:** "以供" is a more formal and precise way to say "for" in this context, implying "for the purpose of." The first translation is slightly more natural-sounding in Chinese. The second is more literal. Choose the one that best suits your needs and target audience.

chromewillow

开发者工具
访问服务器

README

repo-to-txt-mcp

一个用于分析和转换 Git 仓库为文本文件,以供 LLM 上下文使用的 MCP 服务器。

概述

repo-to-txt-mcp 是一个机器码协议 (MCP) 服务器,允许您分析 GitHub 仓库或本地文件夹,并将它们转换为结构化的文本文件。这对于向大型语言模型 (LLM)(如 GPT-4)提供有关仓库的上下文信息特别有用。

本项目扩展了 repo-to-txt CLI 工具的功能,提供了一个可以集成到其他应用程序(特别是 Cursor 的 MCP 系统)中的 Web API。

特性

  • 仓库分析: 分析本地和远程 Git 仓库
  • 结构化输出: 生成带有文件夹结构和连接的文件内容的格式化文本
  • 文件过滤: 基于扩展名包含或排除文件
  • Token 管理: 通过 token 数量限制输出大小
  • 易于集成: 旨在与 Cursor 的 MCP 系统无缝协作
  • 跨平台: 适用于 Windows、macOS 和 Linux

安装

前提条件

  • Python 3.8+
  • Node.js 14+
  • Git

安装选项

请参阅 安装指南 获取详细的安装说明:

  • 直接安装
  • Docker 安装
  • GitHub Container Registry 使用

快速开始

  1. 安装所需的包:

    pip install -r requirements.txt
    npm install
    
  2. 启动服务器:

    node smithery-wrapper.js
    
  3. 服务器将在 http://localhost:8000 上可用

API 使用

转换 GitHub 仓库

curl -X POST http://localhost:8000/analyze \
  -H "Content-Type: application/json" \
  -d '{
    "source": "https://github.com/username/repository",
    "return_file": true
  }'

按文件扩展名过滤

curl -X POST http://localhost:8000/analyze \
  -H "Content-Type: application/json" \
  -d '{
    "source": "https://github.com/username/repository",
    "include_only": [".py", ".js", ".md"],
    "exclude": [".pyc", ".git"]
  }'

请参阅 API 文档 获取完整详细信息。

Cursor 集成

此服务器旨在与 Cursor 集成,以便在对话期间向语言模型提供仓库上下文。

请参阅 Cursor 集成指南 获取有关如何设置和使用此功能的说明。

Docker 支持

包含一个 Dockerfile 以方便容器化部署:

docker build -t repo-to-txt-mcp .
docker run -p 8000:8000 repo-to-txt-mcp

Smithery 集成

本项目包含 Smithery 的配置,Smithery 是一个用于管理 MCP 的工具:

smithery install chromewillow/repo-to-txt-mcp

贡献

欢迎贡献!请参阅 CONTRIBUTING.md 获取指南。

许可证

本项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。

致谢

  • 本项目基于 repo-to-txt CLI 工具的功能构建
  • 感谢 FastMCP 库简化了 MCP 服务器的创建

推荐服务器

Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
MCP Package Docs Server

MCP Package Docs Server

促进大型语言模型高效访问和获取 Go、Python 和 NPM 包的结构化文档,通过多语言支持和性能优化来增强软件开发。

精选
本地
TypeScript
Claude Code MCP

Claude Code MCP

一个实现了 Claude Code 作为模型上下文协议(Model Context Protocol, MCP)服务器的方案,它可以通过标准化的 MCP 接口来使用 Claude 的软件工程能力(代码生成、编辑、审查和文件操作)。

精选
本地
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

用于任务管理的模型上下文协议服务器。它允许 Claude Desktop(或任何 MCP 客户端)在基于队列的系统中管理和执行任务。

精选
本地
JavaScript
mermaid-mcp-server

mermaid-mcp-server

一个模型上下文协议 (MCP) 服务器,用于将 Mermaid 图表转换为 PNG 图像。

精选
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP 服务器向 AI 编码助手(如 Cursor)提供 Jira 工单信息。

精选
TypeScript
Linear MCP Server

Linear MCP Server

一个模型上下文协议(Model Context Protocol)服务器,它与 Linear 的问题跟踪系统集成,允许大型语言模型(LLM)通过自然语言交互来创建、更新、搜索和评论 Linear 问题。

精选
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

这个服务器通过将复杂问题分解为顺序步骤来促进结构化的问题解决,支持修订,并通过完整的 MCP 集成来实现多条解决方案路径。

精选
Python
Curri MCP Server

Curri MCP Server

通过管理文本笔记、提供笔记创建工具以及使用结构化提示生成摘要,从而实现与 Curri API 的交互。

官方
本地
JavaScript