Skip to main content
Glama

repo-guardian

MCP 服务器,用于提供仓库健康工具,让任何智能体都能守护仓库——检测固定/未固定的依赖、许可证合规问题、硬编码的机密信息以及死代码。

功能特性

  • audit_dependencies — 解析 pyproject.tomlrequirements*.txtsetup.py,识别可能遗漏安全补丁的固定版本,以及没有版本约束的依赖。

  • check_licenses — 扫描已声明依赖的许可证合规问题(GPL/AGPL copyleft、未知许可证、与项目许可证不兼容的许可证)。

  • scan_for_secrets — 搜索 AWS 密钥、GitHub 令牌、Slack 令牌、Google API 密钥、Stripe 密钥、私钥块、密码赋值、bearer 令牌以及高熵字符串。

  • find_dead_code — 检测未使用的 Python 导入、未使用的函数以及孤立文件。

所有扫描器均为零依赖(仅使用标准库),并且绝不会让 MCP 会话崩溃——错误会作为工具结果返回。

Related MCP server: sdlc-integrity-mcp

安装

pip install repo-guardian

用于开发:

git clone https://github.com/prem-the-dev/repo-guardian.git
cd repo-guardian
pip install -e ".[dev]"

快速开始 (Claude Desktop / Cursor / Windsurf)

添加到你的 MCP 客户端配置:

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "repo-guardian": {
      "command": "python",
      "args": ["-m", "repo_guardian"]
    }
  }
}

Cursor (.cursor/mcp.json)

{
  "mcpServers": {
    "repo-guardian": {
      "command": "python",
      "args": ["-m", "repo_guardian"]
    }
  }
}

Windsurf (.codeium/windsurf/mcp.json)

与上方 Cursor 的配置相同。

Gemini CLI (gemini/.gemini/.mcp.json)

{
  "mcpServers": {
    "repo-guardian": {
      "command": "python",
      "args": ["-m", "repo_guardian"]
    }
  }
}

Hermes Agent

将附带的 mcp.json 复制到你的 Hermes 配置目录中,或与现有的 MCP 服务器配置合并:

cp mcp.json ~/.hermes/profiles/mcp-specialist/mcp.json
hermes profile reload
{
  "mcpServers": {
    "repo-guardian": {
      "command": "python",
      "args": ["-m", "repo_guardian"]
    }
  }
}

使用示例

配置完成后,任何智能体都可以调用这些工具:

审计依赖

audit_dependencies(path="/path/to/my-project")

返回:

{
  "status": "ok",
  "scanned_files": ["pyproject.toml", "requirements.txt"],
  "total_dependencies": 4,
  "pinned_dependencies": [
    {"name": "Django", "version_spec": "==4.2.7", "classification": "pinned"}
  ],
  "potential_issues": [
    {"type": "pinned_exact", "dependency": "Django", "message": "..."}
  ]
}

检查许可证

check_licenses(path="/path/to/my-project")

返回:

{
  "status": "ok",
  "project_license": "MIT",
  "restricted_licenses": [],
  "unknown_licenses": [...],
  "potential_issues": []
}

扫描机密

scan_for_secrets(path="/path/to/my-project", max_file_size_mb=5)

返回:

{
  "status": "ok",
  "total_findings": 3,
  "findings": [
    {"type": "aws_access_key", "file": ".env", "line": 2, "confidence": "high"},
    {"type": "github_token", "file": "config.py", "line": 5, "confidence": "high"}
  ]
}

查找死代码

find_dead_code(path="/path/to/my-project")

返回:

{
  "status": "ok",
  "unused_imports": [
    {"type": "unused_import", "file": "main.py", "line": 3, "name": "unused_module"}
  ],
  "unused_functions": [
    {"type": "unused_function", "file": "main.py", "line": 12, "name": "unused_function"}
  ],
  "orphaned_files": [...]
}

运行测试

python -m pytest tests/ -v

架构

graph TD
    A[MCP Client<br/>Claude/Cursor/Windsurf/Hermes] -->|stdio JSON-RPC| B[MCP Server<br/>repo_guardian]
    B --> C[Tool Registry<br/>tools/list + tools/call]
    C --> D[audit_dependencies]
    C --> E[check_licenses]
    C --> F[scan_for_secrets]
    C --> G[find_dead_code]
    D --> D1[pyproject.toml parser]
    D --> D2[requirements.txt parser]
    D --> D3[setup.py parser]
    E --> E1[SPDX license DB<br/>offline lookup]
    E --> E2[Project license<br/>detect]
    F --> F1[Pattern matchers<br/>AWS/GH/Slack/etc]
    F --> F2[Shannon entropy<br/>high-entropy scan]
    G --> G1[AST parser<br/>imports + defs]
    G --> G2[Cross-file<br/>usage tracker]

许可证

MIT

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/prem-the-dev/repo-guardian'

If you have feedback or need assistance with the MCP directory API, please join our Discord server