Skip to main content
Glama

✨ 주요 기능

  • 비용 제로 로컬 비평가(Zero-Cost Local Critic): 클라우드 토큰을 소모하지 않고 LM Studio를 통해 무거운 코드 리뷰 반복 작업을 로컬 GPU로 오프로드합니다.

  • 서브 밀리초 AST 센티널(Sub-Millisecond AST Sentinel): GPU 사이클을 낭비하기 전에 구문 오류와 위험한 런타임 호출(eval, exec, os.system, subprocess)을 포착합니다.

  • 결정적 계약(Deterministic Contract): 구조화된 출력(APPROVED vs REJECTED, 특정 라인 피드백 포함)을 강제하여 에이전트가 사람의 개입 없이 자동으로 코드를 리팩터링하도록 합니다.

  • 이중 데이터 싱크(Dual Data Sink, DPO 플라이휠):

    • SQLite(audit_history.db): 기간, 카테고리, 메트릭을 추적합니다.

    • 감사별 JSON(audit_logs/): 개별 감사 기록을 저장하여 거부/승인된 시도 쌍에서 DPO/파인튜닝 데이터셋을 쉽게 구축할 수 있습니다.


Related MCP server: tar-engine

🚀 빠른 시작

1. 사전 요구 사항

  • Python 3.10+

  • OpenAI 호환 Local Server(http://localhost:1234/v1)를 실행 중인 LM Studio

  • Antigravity 또는 MCP 호환 클라이언트

  1. 설치

# Clone the repository
git clone [https://github.com/xTanThaix/mcp-local-auditor.git](https://github.com/xTanThaix/mcp-local-auditor.git)
cd mcp-local-auditor

# Set up virtual environment
python -m venv .venv

# Activate virtual environment
# On Windows:
.venv\Scripts\activate
# On macOS/Linux:
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

3. MCP 서버 등록

Antigravity MCP 구성 파일을 엽니다:

  • Windows: %USERPROFILE%\.gemini\config\mcp_config.json

  • macOS / Linux: ~/.gemini/config/mcp_config.json

mcpServers 안에 서버 정의를 추가합니다:

{
  "mcpServers": {
    "lmstudio-auditor": {
      "command": "D:\\Hucdeline\\.venv\\Scripts\\python.exe",
      "args": ["D:\\Hucdeline\\auditor_bridge.py"]
    }
  }
}

참고: D:\\Hucdeline을 실제 프로젝트 디렉터리 경로로 바꾸세요.


4. LM Studio 구성

  1. LM Studio를 열고 명령어 튜닝된 코딩 모델(예: Qwen-2.5-Coder, DeepSeek-Coder, Llama-3)을 로드합니다.

  2. Local Server(개발자) 탭으로 이동합니다.

  3. 포트를 ...(e.g.,1234)로 설정하고 Start Server를 클릭합니다.


🤖 에이전트 루프 설정(사용자 지정 규칙 / 스킬)

Antigravity 에이전트(mcp-studio-loop)에 다음 규칙을 추가합니다:

# Mandatory MCP Code Audit Protocol
Every time code is generated or refactored, you MUST invoke the `audit_submission` tool:
- Arguments: `task_goal`, `output_content`, `strict_rules`
- If STATUS == "REJECTED": Read `ACTIONABLE_FEEDBACK`, refactor the code, and re-submit.
- If STATUS == "APPROVED": Output the final solution to the user.
- Maximum retry limit: 5 attempts before breaking loop.
  1. LM Studio 구성 LM Studio를 열고 명령어 튜닝된 코딩 모델(예: Qwen-2.5-Coder, DeepSeek-Coder, Llama-3)을 로드합니다.

Local Server 탭으로 이동합니다.

포트를 xxxx로 설정하고 Start Server를 클릭합니다.

🤖 에이전트 루프 설정(사용자 지정 규칙 / 스킬) Antigravity 에이전트(mcp-studio-loop)에 다음 규칙을 추가합니다:

Markdown

Mandatory MCP Code Audit Protocol

Every time code is generated or refactored, you MUST invoke the audit_submission tool:

  • Arguments: task_goal, output_content, strict_rules

  • If STATUS == "REJECTED": Read ACTIONABLE_FEEDBACK, refactor the code, and re-submit.

  • If STATUS == "APPROVED": Output the final solution to the user.

  • Maximum retry limit: 5 attempts before breaking loop. 🧪 테스트 포함된 Pytest 스위트를 실행하여 AST 검사, SQLite 마이그레이션 및 mock 응답을 검증합니다:

Bash pytest test_auditor.py -v

📸 실제 감사 작동 예시(사용 예시 / 사용 예제)

다음은 MCP Local Auditor가 최적화되지 않은 코드 경로를 실행 가능한 피드백과 함께 거부하여 코딩 에이전트가 스스로 수정(self-heal)하고 재검증하도록 유도하는 예시입니다: 사용 예시: 테스트가 통과한 후 "lmstudio-auditor" 도구를 사용하여 수정된 각 파일을 하나씩 감사합니다.

💖 지원 및 기부 이 프로젝트가 API 비용을 절약하고 로컬 LLM 워크플로를 간소화하는 데 도움이 되었다면 개발 지원을 고려해 주세요:

Ko-fi: https://ko-fi.com/xtanthaix

GitHub Sponsors: 이 저장소의 Sponsor 버튼을 클릭하세요

📄 라이선스 MIT 라이선스. 오픈소스 및 상업적 사용에 무료입니다.

Related MCP Connectors

Related MCP Servers

  • A
    license
    C
    quality
    D
    maintenance
    Captures code modifications via AST analysis, generates reusable rules, and injects them into AI agent context with version audit and token-budgeted rule retrieval.
    28
    18 npm
    Apache 2.0
  • A
    license
    Not graded
    quality
    C
    maintenance
    Audits AI agent skills for safety using static, semantic, adversarial, and supply-chain analysis, providing scores and risk flags. Can be run via CLI, CI, or as an MCP tool from Claude Code, Cursor, and Codex.
    17 PyPI
    2
    Apache 2.0
  • A
    license
    A
    quality
    C
    maintenance
    Enforces AST-based architectural guardrails on AI-generated code, blocking writes that violate maintainability, security, or complexity rules and prompting immediate refactoring.
    2
    MIT