MCP Local Auditor & Architect
Streams formatted audit event summaries to a Discord channel via webhook for real-time observability.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Local Auditor & ArchitectAudit my Python script for security vulnerabilities and best practices"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🛡️ MCP Local Auditor & Architect
"Slides made with Gemini Notebook" A high-performance Model Context Protocol (MCP) server that turns your local LLM (via LM Studio) into an autonomous Dual-Role Critic & System Architect. It provides enterprise-grade code auditing, dynamic AST security screening, architectural planning, and real-time Discord observability—with zero cloud API costs.
✨ Key Features
🎠Hybrid Dual-Role Engine (
LMStudio-DualRole-Pipeline):Role 1 (Code Auditor): Enforces strict 10-point defensive code standards (Type Hinting, dataclass schemas, RADS bounded iterations, structured error tracing, and Axiom Aegis testing framework compliance).
Role 2 (System Architect & Strategist): Automatically activates when receiving natural-language plans, questions, or specs—producing complete component topologies, risk analyses, and actionable master execution plans.
⚡ Sub-Millisecond AST Sentinel: Instant static analysis and security gate that intercepts syntax errors and dangerous runtime invocations (
eval,exec,os.system,subprocess) before hitting the LLM.🔍 Dynamic Model Auto-Discovery: Automatically inspects the active model loaded in LM Studio and filters out embedding models. Supports explicit overrides via the
AUDITOR_MODELenvironment variable.đź§ Deep Reasoning Support: Seamlessly captures reasoning traces from models with chain-of-thought capabilities (e.g., DeepSeek-R1 via
reasoning_content).đź’ľ Dual Data Sink (DPO Flywheel):
SQLite Database (
audit_history.db): Tracks durations, status breakdowns, and categorized metrics (CODE_AUDIT,SYSTEM_ARCHITECTURE,SECURITY,SYNTAX).Per-Audit JSON Traces (
audit_logs/): Stores atomic audit artifacts to easily construct DPO (Direct Preference Optimization) / RLHF datasets.
📡 Real-Time Discord Observability (
watch_audit_logs.py): Standalone polling background daemon that streams debounced, formatted markdown summaries of audit events directly to your Discord channel.
Related MCP server: Portable MCP Toolkit
🚀 Quick Start
1. Prerequisites
Python 3.10+
LM Studio running an OpenAI-compatible Local Server (
http://localhost:1234/v1)Antigravity or any MCP-compatible client
Installation
# 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. # URL for local LM Studio Server (Default: http://localhost:1234/v1)
LM_STUDIO_URL=http://localhost:1234/v1
Specific model name override (leave empty for auto-detection)
AUDITOR_MODEL=
Discord Webhook URL for real-time audit notifications
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/your-webhook-url
⚙️ MCP Server Registration Open your Antigravity MCP config file:
Windows:
%USERPROFILE%\.gemini\config\mcp_config.jsonmacOS / Linux:
~/.gemini/config/mcp_config.json
Add the server definition inside mcpServers:
{
"mcpServers": {
"lmstudio-auditor": {
"command": "D:\\Hucdeline\\.venv\\Scripts\\python.exe",
"args": ["D:\\Hucdeline\\auditor_bridge.py"],
"env": {
"LM_STUDIO_URL": "http://localhost:1234/v1"
}
}
}
}
đź’ˇ Note: Adjust the absolute paths to match your project's virtual environment Python interpreter and script path.
4. Configure LM Studio
Open LM Studio and load any instruction-tuned coding model (e.g.,
Qwen-2.5-Coder,DeepSeek-Coder,Llama-3).Go to the Local Server (Developer) tab.
Set Port to
...(e.g.,1234)and click Start Server.
🤖 Agent Loop Setup (Custom Rule / Skill)
Add the following rule to your Antigravity Agent (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.Configure LM Studio Open LM Studio and load any instruction-tuned coding model (e.g., Qwen-2.5-Coder, DeepSeek-Coder, Llama-3).
Go to the Local Server tab.
Set Port to xxxx and click Start Server.
🤖 Agent Protocol & Loop Rules Add the following rule to your autonomous coding agent's system prompt or custom skill file:
Mandatory MCP Code Audit & Strategy Protocol
For every generated or refactored code unit, invoke the
audit_submissiontool:Parameters:
task_goal,output_content,strict_rules
Interpret the return status:
If STATUS == "REJECTED": Analyze
ACTIONABLE_FEEDBACK, refactor the code defensively, and re-submit (Max retries: 5).If STATUS == "APPROVED": Proceed with execution or present the final code.
If STATUS contains Architecture / Planning: Adopt the recommended Master Execution Plan before writing code. đź§Ş Testing Run the included Pytest suite to verify AST checks, SQLite migrations, and mock responses:
Bash pytest test_auditor.py -v
📸 Real-World Audit in Action (Example Usage / Usage Example)
Here is an example of MCP Local Auditor rejecting an unoptimized code path with actionable feedback, prompting the coding agent to self-heal and re-verify:
Example Usage: After the tests pass, audit each modified file one by one using the "lmstudio-auditor" tool.
đź’– Support & Donations If this project saved you API costs and helped streamline your local LLM workflow, consider supporting development:
Ko-fi: https://ko-fi.com/xtanthaix
GitHub Sponsors: Click the Sponsor button on this repository
đź“„ License MIT License. Free for open-source and commercial use.
This server cannot be installed
Maintenance
Related MCP Servers
- FlicenseCqualityDmaintenanceEnterprise-grade code intelligence platform providing AI-powered code analysis, semantic search, security scanning, and automated refactoring capabilities. Integrates with local AI models for zero-cost operations while delivering comprehensive development workflow automation.28
- AlicenseNot gradedqualityCmaintenanceProvides AI-powered code intelligence for any codebase using local LLMs and vector search, enabling semantic code search, pattern analysis, and context-optimized code generation with 90% token savings.2MIT
- AlicenseCqualityDmaintenanceA privacy-first MCP server that provides local LLM-enhanced tools for code analysis, security scanning, and automated task execution using backends like Ollama and LM Studio. It enables symbol-aware code reviews and workspace exploration while ensuring that all code and analysis remain strictly on your local machine.36ISC
- AlicenseAqualityAmaintenanceEnterprise-grade (40m+ lines) codebase intelligence in a zero-setup, private and local MCP: managed indexing, hybrid semantic search, polyglot code dependency graphs, and DB/API/infra knowledge. Benchmark: 61% less tokens, 84% fewer calls, 37x faster than standard AI grep.251,7423,276AGPL 3.0
Related MCP Connectors
Enterprise code intelligence for M&A, security audits, and tech debt. Hosted server with 200k free.
Deterministic AI code review, with an audit record. Governance inside the agent loop.
Zero-config MCP security scanner for AI-generated apps. 25K+ vulnerability patterns.
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-dualrole-pipeline'
If you have feedback or need assistance with the MCP directory API, please join our Discord server