lmstudio-auditor
✨ 核心特性
零成本本地审查器: 通过 LM Studio 将繁重的代码审查迭代卸载到本地 GPU,无需消耗云端 token。
亚毫秒级 AST 哨兵: 在浪费 GPU 算力之前捕获语法错误和危险的运行时调用(
eval、exec、os.system、subprocess)。确定性契约: 强制执行结构化输出(
APPROVED与REJECTED,附带具体的行级反馈),使智能体无需人工干预即可自动重构代码。双数据汇(DPO 飞轮):
SQLite(
audit_history.db): 跟踪持续时间、类别和指标。单次审计 JSON(
audit_logs/): 存储单次审计记录,便于从配对的拒绝/批准尝试中轻松构建 DPO / 微调数据集。
Related MCP server: tar-engine
🚀 快速开始
1. 前提条件
Python 3.10+
LM Studio 运行一个兼容 OpenAI 的本地服务器(
http://localhost:1234/v1)Antigravity 或任何兼容 MCP 的客户端
安装
# 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.txt3. 注册 MCP 服务器
打开你的 Antigravity MCP 配置文件:
Windows:
%USERPROFILE%\.gemini\config\mcp_config.jsonmacOS / 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
打开 LM Studio 并加载任何指令微调的编码模型(例如
Qwen-2.5-Coder、DeepSeek-Coder、Llama-3)。转到 本地服务器(开发者)选项卡。
将端口设置为
...(e.g.,1234),然后点击 启动服务器。
🤖 智能体循环设置(自定义规则 / 技能)
将以下规则添加到你的 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.配置 LM Studio 打开 LM Studio 并加载任何指令微调的编码模型(例如 Qwen-2.5-Coder、DeepSeek-Coder、Llama-3)。
转到本地服务器选项卡。
将端口设置为 xxxx,然后点击启动服务器。
🤖 智能体循环设置(自定义规则 / 技能) 将以下规则添加到你的 Antigravity 智能体(mcp-studio-loop):
Markdown
强制 MCP 代码审计协议
每次生成或重构代码时,你必须调用 audit_submission 工具:
参数:
task_goal、output_content、strict_rules如果 STATUS == "REJECTED":阅读
ACTIONABLE_FEEDBACK,重构代码并重新提交。如果 STATUS == "APPROVED":向用户输出最终解决方案。
最大重试次数:中断循环前最多尝试 5 次。 🧪 测试 运行附带的 Pytest 测试套件,以验证 AST 检查、SQLite 迁移和模拟响应:
Bash pytest test_auditor.py -v
📸 真实场景审计实战(示例用法 / 使用示例)
以下是一个 MCP Local Auditor 拒绝未优化代码路径并给出可操作反馈的示例,促使编码智能体自我修复并重新验证:
示例用法:测试通过后,使用 "lmstudio-auditor" 工具逐一审计每个修改过的文件。
💖 支持与捐赠 如果这个项目为你节省了 API 成本,并帮助简化了你的本地 LLM 工作流,请考虑支持开发:
Ko-fi:https://ko-fi.com/xtanthaix
GitHub Sponsors:点击此仓库上的 Sponsor 按钮
📄 许可证 MIT 许可证。免费用于开源和商业用途。
This server cannot be installed
Maintenance
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
- AlicenseCqualityBmaintenanceCaptures code modifications via AST analysis, generates reusable rules, and injects them into AI agent context with version audit and token-budgeted rule retrieval.2810Apache 2.0
- AlicenseNot gradedqualityAmaintenanceAudits 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.2Apache 2.0
- FlicenseNot gradedqualityAmaintenanceEnables AI agents to scan code for security vulnerabilities before execution, supporting Python and JavaScript/TypeScript with deterministic AST-based analysis and optional Solana micropayments.
- AlicenseAqualityBmaintenanceEnforces AST-based architectural guardrails on AI-generated code, blocking writes that violate maintainability, security, or complexity rules and prompting immediate refactoring.2MIT
Related MCP Connectors
Deterministic AI code review, with an audit record. Governance inside the agent loop.
Lints + auto-fixes how AI coding agents discover any new product. 24 rules, 6 tools, score 0-100.
Agentic code review, no signup to try: reality gates + frontier-model review, with veto.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/xTanTHaix/mcp-local-auditor'
If you have feedback or need assistance with the MCP directory API, please join our Discord server