Back to MCP directory
publicPublicdnsLocal runtime

GitMCP (GitHub to MCP)

GitMCP是一个免费开源的远程MCP服务器,可将任何GitHub项目转化为文档中心,使AI工具能够访问最新文档和代码,减少幻觉。

article

README

🚀 使用 GitMCP 的指南

GitMCP 是一款强大的工具,它支持多种 AI 工具,具备全面的 GitHub 集成能力,同时注重隐私保护且完全免费开源。通过它,用户可高效获取项目文档、进行智能搜索以及解析 URL 内容。

🚀 快速开始

安装与配置

1. 克隆仓库

git clone https://github.com/idosal/git-mcp.git
cd git-mcp

2. 安装依赖项

pnpm install

3. 开发环境启动

npm run dev
# 或者
pnpm dev

✨ 主要特性

  • 支持多种AI工具:与 Cursor、VSCode、Claude 等工具兼容。
  • 全面的GitHub集成:适用于任何公开仓库,无需修改。
  • 隐私保护:无用户数据存储,遵循机器人协议。
  • 免费服务:完全开源,无使用成本。

📦 安装指南

安装 MCP 检查器进行测试

1. 安装 MCP 检查器工具

npx @modelcontextprotocol/inspector

2. 在检查器界面中操作

  • 设置传输类型为 SSE
  • 输入你的 GitMCP 地址(例如:http://localhost:5173/docs)。
  • 点击“连接”。

💻 使用示例

基础用法

GitMCP 提供了一系列实用的工具函数,以下是一些基础使用示例:

# 获取项目的主要文档(如 llms.txt)
fetch_<repo-name>_documentation

# 通过查询在文档中找到相关内容
search_<repo-name>_documentation

# 在代码库中进行精准搜索
search_<repo-name>_code

# 从文档中的链接获取信息
fetch_url_content

📚 详细文档

核心功能

1. 文档获取工具

  • fetch_<repo-name>_documentation:获取项目的主要文档(如 llms.txt)。

2. 智能搜索

  • search_<repo-name>_documentation:通过查询在文档中找到相关内容。
  • search_<repo-name>_code:在代码库中进行精准搜索。

3. URL内容解析

  • fetch_url_content:从文档中的链接获取信息。

工作流程

  1. 用户输入问题。
  2. AI 工具分析是否需要外部上下文。
  3. 如果需要,AI 通过 MCP 协议调用 GitMCP 服务。
  4. GitMCP 检索相关文档或代码,并返回结果。
  5. AI 根据获得的上下文生成回答。

常见问题解答

什么是模型上下文协议?

模型上下文协议(Model Context Protocol, MPT) 是一个标准,允许 AI 助手通过结构化的方式请求和接收外部来源提供的额外信息,从而提升其理解和性能。

支持哪些AI工具?

GitMCP 与所有支持模型上下文协议的 AI 工具兼容,包括 Cursor、VSCode 和 Claude 等。

🔧 技术细节

隐私保护

  • 无数据存储:不保存任何用户查询或个人数据。
  • 遵循机器人协议:访问 GitHub 项目前检查并遵守 robots.txt 指定规则。
  • 开源性质:可独立部署,保障使用环境的安全性。

贡献指南

参与方式

我们欢迎任何形式的贡献,请参考 贡献指南 了解具体要求。

开发流程

  1. 克隆仓库。
  2. 创建功能分支。
  3. 提交代码。
  4. 提交 Pull Request。

📄 许可证

本项目遵循 Apache License 2.0 协议开源。

⚠️ 重要提示

GitMCP 作为开源项目,不承担任何担保责任。使用前请仔细阅读相关协议和文档,确保符合所有适用的法律法规。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client