Token导航 LogoToken导航TokenDH.com
MCP Repo Insight logo
开发工具stdio官方级别未说明来源级核验

MCP Repo Insight

MCP Server

RepoInsight MCP是一个基于Python的本地优先GitHub仓库分析工具,提供结构化搜索、项目结构探索和源代码阅读功能,适用于AI代理深度分析公共GitHub仓库。

工具数

4

提示词数

0

GitHub Stars

0

资源数

0
PythonClaude开发工具Claude DesktopClaudeCline

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

berthojoris

提供方

berthojoris

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install -r requirements.txt

详细介绍

RepoInsight MCP

用于GitHub存储库分析的本地第一台MCP服务器

RepoInsight MCP是一个基于Python的模型上下文协议(MCP)服务器,使AI代理能够深入了解公共GitHub存储库。它提供了用于搜索文档、探索项目结构和读取源代码文件的结构化工具。

______________________________________________________________________

🚀 快速入门(3个步骤)

步骤1:安装依赖项

# Navigate to project folder
cd C:\DEKSTOP\MCP\repo_insight

# Install required packages
pip install -r requirements.txt

步骤2:配置Claude桌面

先找到你的Python路径:

# Windows
where python

# macOS/Linux  
which python3

编辑配置文件:

  • 视窗: %APPDATA%\Claude\claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

粘贴此配置 (更新路径以匹配您的系统):

Windows示例:

{
  "mcpServers": {
    "repoinsight": {
      "command": "C:\\laragon\\bin\\python\\python-3.13\\python.exe",
      "args": ["-m", "repoinsight_mcp.main"],
      "cwd": "C:\\DEKSTOP\\MCP\\repo_insight",
      "env": {
        "PYTHONPATH": "C:\\DEKSTOP\\MCP\\repo_insight\\src"
      }
    }
  }
}

macOS/Linux示例:

{
  "mcpServers": {
    "repoinsight": {
      "command": "/usr/local/bin/python3",
      "args": ["-m", "repoinsight_mcp.main"],
      "cwd": "/path/to/repo_insight",
      "env": {
        "PYTHONPATH": "/path/to/repo_insight/src"
      }
    }
  }
}

重要提示:

  • 使用 完整Python路径 (从 where pythonwhich python3)
  • cwd 必须指向项目根(其中 src/ 文件夹存在)
  • PYTHONPATH 必须指向 src 项目中的文件夹
  • 在Windows上,使用双反斜杠 \\ 在路径

步骤3:重新启动克劳德桌面

  1. 完全退出克劳德桌面 (文件→ 退出,而不仅仅是关闭窗口)
  2. 等待5秒
  3. 重新启动克劳德桌面
  4. 测试:“显示fastapi/fastapi存储库的结构”

完成! 您的AI代理现在可以分析任何GitHub存储库!

______________________________________________________________________

✅ 验证它是否正常工作

在Claude Desktop中,您应该看到:

  • 显示MCP服务器已加载的小图标或指示器
  • 当你要求分析一个仓库时,Claude会自动使用这些工具

测试命令:

"Analyze the structure of django/django and show me the main components"

如果它有效,你会看到克劳德使用 get_repo_structure 工具并显示结果!

______________________________________________________________________

🎯 你能做什么

配置后,询问您的AI代理以下问题:

"Analyze the FastAPI repository structure"
→ Uses: get_repo_structure

"Search the Django repo for authentication documentation"
→ Uses: search_doc

"Read the main.py file from fastapi/fastapi"
→ Uses: read_file

"Debug the login issue in owner/repo by checking auth files"
→ Uses: All 3 tools together

______________________________________________________________________

🔑 GitHub令牌(可选)

无令牌:60个请求/小时(适合测试)\ 带令牌:5000次请求/小时(增加83倍-更适合频繁使用)

如何创建令牌:

  1. 首选https://github.com/settings/tokens
  2. 点击 “生成新令牌(经典)”
  3. 给它起个名字: RepoInsight MCP
  4. 选择NO范围 (取消选中所有复选框)

- ✅ 我们只需要公共存储库访问权限 - ✅ 公共存储库不需要权限 - ✅ 使用最少的权限更安全

  1. 点击 “生成令牌”
  2. 复制令牌(以开头 ghp_...)

将令牌添加到配置:

更新您的Claude Desktop配置以包含令牌:

{
  "mcpServers": {
    "repoinsight": {
      "command": "C:\\laragon\\bin\\python\\python-3.13\\python.exe",
      "args": ["-m", "repoinsight_mcp.main"],
      "cwd": "C:\\DEKSTOP\\MCP\\repo_insight",
      "env": {
        "PYTHONPATH": "C:\\DEKSTOP\\MCP\\repo_insight\\src",
        "GITHUB_TOKEN": "ghp_your_token_here"
      }
    }
  }
}

添加令牌后,记得重新启动Claude Desktop!

______________________________________________________________________

特性

  • 本地优先:本地缓存的所有数据,最少API调用
  • 安全:只读访问、路径验证、不执行代码
  • 快速:SQLite FTS5搜索,主动缓存
  • 符合MCP标准:与Claude Desktop、Cline和其他MCP客户端配合使用
  • 确定性的:稳定的输出,用于可靠的AI推理

建筑

RepoInsight MCP
├── MCP Protocol Layer (stdio/HTTP)
├── Tool Handlers (search_doc, get_repo_structure, read_file)
├── GitHub API Client
├── Repository Cache
├── Search Index (SQLite FTS5)
└── File Reader (with security validation)

需求

  • Python 3.10或更高版本
  • Git已安装并在PATH中可用
  • (可选)用于更高API速率限制的GitHub个人访问令牌

安装

来源

# Clone or navigate to repository
cd repo_insight

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Install in development mode
pip install -e .

使用pip

pip install -e .

用法

运行服务器

标准模式(建议MCP客户端使用)

# Using installed command
repoinsight-mcp

# Or with Python module
python -m repoinsight_mcp.main

# With GitHub token for higher rate limits
export GITHUB_TOKEN=your_token_here
repoinsight-mcp

MCP客户端配置

克劳德桌面(推荐)

视窗: %APPDATA%\Claude\claude_desktop_config.json\ macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

完整的工作配置:

{
  "mcpServers": {
    "repoinsight": {
      "command": "C:\\path\\to\\python.exe",
      "args": ["-m", "repoinsight_mcp.main"],
      "cwd": "C:\\path\\to\\repo_insight",
      "env": {
        "PYTHONPATH": "C:\\path\\to\\repo_insight\\src"
      }
    }
  }
}

使用GitHub代币(5000需求/小时):

{
  "mcpServers": {
    "repoinsight": {
      "command": "C:\\path\\to\\python.exe",
      "args": ["-m", "repoinsight_mcp.main"],
      "cwd": "C:\\path\\to\\repo_insight",
      "env": {
        "PYTHONPATH": "C:\\path\\to\\repo_insight\\src",
        "GITHUB_TOKEN": "ghp_your_token_here"
      }
    }
  }
}

寻找你的路径:

# Python path
where python          # Windows
which python3         # macOS/Linux

# Project path - use absolute path where you cloned the project

Cline(VS代码扩展)

添加到临床MCP设置:

{
  "repoinsight": {
    "command": "repoinsight-mcp",
    "args": [],
    "env": {
      "GITHUB_TOKEN": "your_token_here"
    }
  }
}

MCP工具

RepoInsight提供 4个强大的工具 使AI代理能够分析、检查、调试和执行GitHub存储库上的任何任务:

1.get_repo_summary

获取GitHub存储库的全面摘要,包括元数据、统计数据、最近的活动、主要贡献者和主要文档。

🎯 AI代理用例:

  • 在深入分析之前快速浏览存储库
  • 了解存储库流行度和活动级别
  • 获取README摘要,无需阅读完整文件
  • 查看最新问题和PR概览
  • 确定使用的主要编程语言

输入:

{
  "repository": "owner/repo"
}

输出:

{
  "repository": {
    "name": "owner/repo",
    "description": "...",
    "stars": 1234,
    "forks": 567,
    "language": "Python",
    "default_branch": "main",
    "updated_at": "2024-01-15T10:30:00Z"
  },
  "readme_summary": "First 500 characters of README...",
  "recent_issues": [...],
  "recent_pull_requests": [...],
  "top_contributors": [...],
  "languages": {
    "Python": 45,
    "JavaScript": 30
  },
  "total_files": 123
}

2.search_doc

搜索与GitHub存储库对应的知识文档,快速了解存储库知识、新闻、最新问题、PR和贡献者。

🎯 AI代理用例:

  • 快速了解存储库的功能
  • 查找功能的相关文档
  • 回顾最近的问题和讨论
  • 确定积极的贡献者和维护者
  • 搜索特定主题或实现

输入:

{
  "repository": "owner/repo",
  "query": "authentication flow",
  "limit": 10
}

输出:

{
  "repository": {
    "name": "owner/repo",
    "description": "...",
    "stars": 1234,
    "language": "Python"
  },
  "documents": [...],
  "issues": [...],
  "pull_requests": [...],
  "contributors": [...]
}

3.get_repo_structure

获取GitHub仓库的目录结构和文件列表,了解项目模块拆分和目录组织。

🎯 AI代理用例:

  • 了解整体架构
  • 定位特定模块或组件
  • 分析项目组织模式
  • 查找配置文件
  • 映射模块之间的依赖关系
  • 高效地浏览大型代码库

输入:

{
  "repository": "owner/repo",
  "path": "",
  "depth": 4
}

输出:

{
  "root": "/",
  "structure": [...],
  "stats": {
    "total_files": 123,
    "languages": {
      "Python": 45,
      "JavaScript": 30
    }
  }
}

4.read_file

阅读GitHub存储库中指定文件的完整代码内容,深入分析文件代码的实现细节。

🎯 AI代理用例:

  • 调试代码问题
  • 分析实施细节
  • 审查代码质量
  • 理解算法和逻辑
  • 检查安全漏洞
  • 提取API签名
  • 学习编码模式

输入:

{
  "repository": "owner/repo",
  "path": "src/main.py"
}

输出:

{
  "path": "src/main.py",
  "language": "Python",
  "size": 1234,
  "encoding": "utf-8",
  "content": "..."
}

______________________________________________________________________

🤖 AI代理工作流示例

  1. 概述 -使用 get_repo_summary 快速获取摘要
  2. 发现 -使用 search_doc 了解存储库
  3. 导航 -使用 get_repo_structure 查找相关文件
  4. 分析 -使用 read_file 检查实施细节
  5. 调试 -读取多个文件以跟踪错误
  6. 审查 -检查代码质量和模式

配置

环境变量

  • GITHUB_TOKEN:GitHub个人访问令牌(可选,增加速率限制)

缓存位置

存储库缓存在:

  • Linux/macOS: ~/.repoinsight/repos/
  • 视窗: %USERPROFILE%\.repoinsight\repos\

缓存TTL:24小时(可在中配置 config.py)

文件大小限制

  • 最大文件大小:1MB
  • 最大树深:10层

安全

RepoInsight MCP的设计优先考虑安全性:

  • 只读:无文件修改或代码执行
  • 路径验证:阻止路径遍历尝试
  • 大小限制:防止内存耗尽
  • 二进制检测:拒绝二进制文件
  • 本地优先:没有数据发送到外部服务(除了GitHub API)

演出

  • 存储库索引:\<60秒(中等存储库)
  • 缓存搜索:\<500ms
  • 文件读取时间:\<200ms

项目结构

repo_insight/
├── src/
│   └── repoinsight_mcp/
│       ├── __init__.py
│       ├── main.py              # Entry point
│       ├── server.py            # MCP server
│       ├── handlers.py          # Tool handlers
│       ├── github_client.py     # GitHub API
│       ├── cache.py             # Repository caching
│       ├── search.py            # Search & indexing
│       ├── file_reader.py       # File reading
│       ├── models.py            # Data models
│       ├── config.py            # Configuration
│       └── exceptions.py        # Custom exceptions
├── AGENTS.md                    # Agent guidelines
├── repo_insight_mcp_prd.md      # Product requirements
├── pyproject.toml
├── requirements.txt
└── README.md

发展

运行测试

# Install dev dependencies
pip install -e ".[dev]"

# Run tests (when implemented)
pytest

代码格式化

black src/

类型检查

mypy src/

故障排除

常见问题

1.MCP错误-32000:连接关闭

原因:服务器启动失败

解决:

A.使用完整的Python路径

{
  "mcpServers": {
    "repoinsight": {
      "command": "C:\\Users\\YourName\\AppData\\Local\\Programs\\Python\\Python313\\python.exe",
      "args": ["-m", "repoinsight_mcp.main"],
      "cwd": "C:\\DEKSTOP\\MCP\\repo_insight",
      "env": {
        "PYTHONPATH": "C:\\DEKSTOP\\MCP\\repo_insight\\src"
      }
    }
  }
}

找到你的Python路径:

where python          # Windows
which python3         # macOS/Linux

B.验证依赖关系

cd C:\DEKSTOP\MCP\repo_insight
pip install -r requirements.txt

C.手动测试服务器

cd C:\DEKSTOP\MCP\repo_insight
set PYTHONPATH=C:\DEKSTOP\MCP\repo_insight\src
python -m repoinsight_mcp.main

如果这有效,那么你的路径是正确的。

______________________________________________________________________

2.协议版本错误

如果您看到“不支持服务器的协议版本”,则代码已更新为使用协议版本 2024-11-05。只需重新启动Claude Desktop。

______________________________________________________________________

3.工具不出现

检查:

  • 配置文件位于正确的位置
  • JSON语法有效(没有缺少逗号/大括号)
  • 路径使用双反斜杠 \\ 在Windows上
  • Claude Desktop已完全退出并重新启动(不仅仅是关闭窗口)

验证配置位置:

# Windows - should open the folder
explorer %APPDATA%\Claude

# macOS
open ~/Library/Application\ Support/Claude/

---速率限制

如果您遇到GitHub API速率限制:

  1. 创建个人访问令牌:https://github.com/settings/tokens
  2. 选择NO范围 (公共仓库不需要权限)
  3. 添加到配置中(请参阅上面的GitHub Token部分)
  4. 重新启动克劳德桌面

缓存问题

清除缓存:

# Windows
rmdir /s /q %USERPROFILE%\.repoinsight

# macOS/Linux
rm -rf ~/.repoinsight/repos/

导入错误

确保安装了依赖项:

cd C:\DEKSTOP\MCP\repo_insight
pip install -r requirements.txt

未来的增强功能

  • 基于AST的符号导航
  • 语义嵌入搜索
  • 私有存储库支持
  • 语言服务器协议集成
  • HTTP/SSE传输模式

许可证

\[在此处添加您的许可证\]

贡献

欢迎投稿!请确保:

  • 代码遵循AGENTS.md指南
  • 遵守所有安全规则
  • 包括类型提示
  • 测试通过(实施时)

作者

项目作者

______________________________________________________________________

内置于❤️ 对于AI代理

目录标签

目录标签

PythonClaude开发工具GitHub分析本地部署代码阅读项目结构AI工具

支持客户端

Claude DesktopClaudeCline

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

token

工具数量(toolCount,工具数)

4

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiotoken部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP