Skip to content
Conduit

mcp server

mcp-agentmesh

Autonomous, single-file AI multi-agent utility coordinating System Architect, Coder, and Security Auditor sub-agents locally using Google Gemini & SQLAlchemy.

jigar48/mcp-agentmeshcommunitylistedunreviewed

Set up

Runs on your computer. Pick your agent and operating system.

This project does not publish an install method we can turn into a config. Follow the README instead.

README

synced Oct 22, 2026

🕸️ MCP Agent Mesh (mcp-agent-mesh)

Python 3.8+ License: MIT Engine: Google Gemini State: SQLAlchemy Buy Me A Coffee LinkedIn

Autonomous, single-file multi-agent engineering utility coordinating specialized AI sub-agents locally using Google Gemini and structured SQLAlchemy state persistence.


📌 Table of Contents


💡 Executive Overview

Modern multi-agent frameworks often introduce sprawling folder structures, dozens of transitive dependencies, obscure abstractions, and unpredictable breaking changes.

mcp-agent-mesh delivers an enterprise-grade multi-agent coordination system in a single, self-contained Python file (agent_mesh.py). It coordinates three specialized AI sub-agents:

  1. 🏛️ System Architect: Analyzes complex engineering requirements, decomposes systems, defines interface schemas, and designs robust component topologies.
  2. 💻 Implementation Coder: Translates architectural specifications into production-ready, typed, idiomatic code with built-in test suites.
  3. 🛡️ Security Auditor: Rigorously analyzes code and architecture for OWASP Top 10 vulnerabilities, calculates a quantitative Security Score (0-100), and outputs hardened patches.
  4. 🔄 Auto-Refiner (Optional Loop): Feeds auditor findings back to the engineering agent to automatically remediate security flaws in real time.

All interaction prompts, execution latency, structured payloads, and generated deliverables are persistently recorded in a local SQLite database via SQLAlchemy.


⚡ Why mcp-agent-mesh?

FeatureSprawling Multi-Agent Frameworksmcp-agent-mesh
File Count50+ files across nested folders1 self-contained file (agent_mesh.py)
Dependencies30+ packages, heavy vector storesJust 2: google-genai & sqlalchemy
Setup Time15–30 minutes of environment debuggingUnder 60 seconds
Security AuditingNone / Addon requiredNative OWASP threat engine & scoring
PersistenceComplex cloud / external brokersZero-config local SQLite via SQLAlchemy
Offline / CI TestingDifficult or requires live API keysDeterministic mock mode (--mock)

📐 System Architecture

                                  ┌─────────────────────────────┐
                                  │   USER SPECIFICATION / TASK │
                                  └──────────────┬──────────────┘
                                                 │
                                                 ▼
        ┌──────────────────────────────────────────────────────────────────────────────────┐
        │                          🏛️  SYSTEM ARCHITECT AGENT                              │
        │    Decomposes problem • Produces topological specs • Defines interface schemas   │
        └────────────────────────────────────────┬─────────────────────────────────────────┘
                                                 │ (Architectural Blueprint)
                                                 ▼
        ┌──────────────────────────────────────────────────────────────────────────────────┐
        │                        💻  IMPLEMENTATION CODER AGENT                            │
        │    Synthesizes production code • Type hints • Modular layout • Unit test suites   │
        └────────────────────────────────────────┬─────────────────────────────────────────┘
                                                 │ (Source Code & Tests)
                                                 ▼
        ┌──────────────────────────────────────────────────────────────────────────────────┐
        │                         🛡️  SECURITY AUDITOR AGENT                              │
        │     OWASP Top 10 audit • Vulnerability matrix • Security score (0-100) • Patches │
        └────────────────────────────────────────┬─────────────────────────────────────────┘
                                                 │
                    ┌────────────────────────────┴───────────────────────────┐
                    │ (If score < 85 or CONDITIONAL / FAIL & --refine flag)  │
                    ▼                                                        │
        ┌─────────────────────────────────────────┐                          │
        │       🔄 CODE REFINER AGENT             │                          │
        │   Auto-patches vulnerabilities to v2    │                          │
        └───────────────────┬─────────────────────┘                          │
                            │                                                │
                            └────────────────────┬───────────────────────────┘
                                                 │
                                                 ▼
        ┌──────────────────────────────────────────────────────────────────────────────────┐
        │                        💾  SQLITE STATE PERSISTENCE                              │
        │        Sessions • Steps • Artifacts • Latency Telemetry • Audit Lineage          │
        └────────────────────────────────────────┬─────────────────────────────────────────┘
                                                 │
                                                 ▼
        ┌──────────────────────────────────────────────────────────────────────────────────┐
        │                 📑  UNIFIED MARKDOWN / JSON DELIVERABLES                         │
        └──────────────────────────────────────────────────────────────────────────────────┘

🤖 The Autonomous Agent Triad

1. 🏛️ System Architect Agent

  • Decomposition: Breaks user requirements into discrete, testable architectural components.
  • Topological Specification: Generates ASCII network/component diagrams illustrating data flow.
  • Contract Definition: Outlines interface protocols, schemas, and invariants.
  • Fault Tolerance: Defines concurrency models, timeout policies, and state transitions.

2. 💻 Implementation Coder Agent

  • Zero Pseudo-Code: Produces complete, runnable source code without # TODO placeholders.
  • Idiomatic & Typed: Strict type hinting, standard naming conventions, and structured error boundaries.
  • Automated Test Suite: Every generated service includes a runnable unit test suite (using unittest or pytest).

3. 🛡️ Security Auditor Agent

  • OWASP Threat Modeling: Evaluates injection risks, broken access controls, secret leaks, and cryptographic hygiene.
  • Quantitative Scoring: Outputs an authoritative SECURITY SCORE (0-100) and VERDICT (PASS / CONDITIONAL / FAIL).
  • Hardened Remediations: Delivers copy-paste code patches addressing discovered vulnerabilities.

📦 Prerequisites & Installation

1. Requirements

2. Install Dependencies

pip install google-genai sqlalchemy

3. Configure API Key

# macOS / Linux
export GEMINI_API_KEY="your-gemini-api-key"

# Windows (PowerShell)
$env:GEMINI_API_KEY="your-gemini-api-key"

# Windows (CMD)
set GEMINI_API_KEY=your-gemini-api-key

🚀 Quickstart Guide

Run an Autonomous Multi-Agent Pipeline

Coordinate the full triad to design, implement, and audit a backend service:

python agent_mesh.py --task "Build a distributed token bucket rate limiter in Python using Redis"

Enable Auto-Refinement & Save to Markdown

Instruct the Security Auditor to automatically trigger a code refiner if issues are detected, saving the full report:

python agent_mesh.py --task "Implement a secure JWT authentication middleware with refresh tokens" --refine -o jwt_report.md

Run in Offline / Mock Simulation Mode

Verify the full orchestration pipeline, database writes, and artifact rendering without consuming Gemini API quota:

python agent_mesh.py --task "Design a high-throughput webhook receiver" --mock -o webhook.md

Standalone Security Audit on an Existing File

Point the Security Auditor directly at any local source file to receive an immediate vulnerability analysis:

python agent_mesh.py --audit-only --code-file server.py -o security_audit.md

🛠️ CLI Command Reference

usage: agent_mesh [-h] [-t TASK] [-m MODEL] [-o OUTPUT] [--api-key API_KEY]
                  [--db DB] [--mock] [--refine] [--skip-security]
                  [--audit-only] [--code-file CODE_FILE] [--list-sessions]
                  [--show-session SESSION_ID] [--export-json PATH] [-i] [-v]
                  [--version]
ArgumentDescriptionDefault
-t, --taskProblem specification or engineering task to orchestrateNone
-m, --modelGemini model (gemini-2.5-flash, gemini-2.0-flash, gemini-1.5-pro)gemini-2.5-flash
-o, --outputDestination file path for compiled Markdown mission reportNone
--api-keyExplicit Gemini API Key (overrides GEMINI_API_KEY env var)None
--dbSQLite database file path for state persistenceagent_mesh.db
--mock, --dry-runRun deterministic simulation mode (no API key needed)False
--refineAuto-trigger code refiner if security vulnerabilities are foundFalse
--skip-securityRun only Architect and Coder (omit Security Auditor)False
--audit-onlyDedicated audit mode on a local fileFalse
--code-fileTarget source code file for --audit-onlyNone
--list-sessionsDisplay historical execution runs from SQLite databaseFalse
--show-sessionPrint details and deliverables for a specific session IDNone
--export-jsonExport full session telemetry and artifacts to a JSON fileNone
-i, --interactiveLaunch interactive console promptFalse
-v, --verbosePrint extended diagnostics and debug logsFalse
--versionDisplay version informationv1.0.0

💻 Python SDK Programmatic Usage

mcp-agent-mesh can be imported as a Python library inside your own applications, CI/CD runners, or custom agents:

from agent_mesh import AgentMesh, MeshConfig

# 1. Configure the mesh engine
config = MeshConfig(
    task="Design an asynchronous event bus with dead-letter queue",
    model="gemini-2.5-flash",
    db_path="agent_mesh.db",
    auto_refine=True,
    output_path="event_bus_deliverable.md",
    verbose=True
)

# 2. Instantiate and execute the coordinator
mesh = AgentMesh(config)
result = mesh.run()

# 3. Inspect results programmatically
print(f"Session ID    : {result.session_id}")
print(f"Security Score: {result.security_score}/100 [{result.security_verdict}]")
print(f"Total Latency : {result.total_latency_ms:.0f}ms")

# Access individual deliverables
print("\n--- Architecture Blueprint ---")
print(result.architecture[:300])

print("\n--- Implementation Code ---")
print(result.implementation[:300])

print("\n--- Security Findings ---")
print(result.security_audit[:300])

💾 SQLite Schema & Persistence

Every run stores structured relational data into SQLite using SQLAlchemy ORM:

┌─────────────────────────────────┐       ┌─────────────────────────────────┐
│          mesh_sessions          │       │           agent_steps           │
├─────────────────────────────────┤       ├─────────────────────────────────┤
│ session_id (PK, String)         │◄──┐   │ id (PK, Integer)                │
│ task (Text)                     │   └───┤ session_id (FK, String)         │
│ model_name (String)             │       │ agent_role (String)             │
│ status (String)                 │       │ step_number (Integer)           │
│ security_score (Integer)        │       │ prompt_snippet (Text)           │
│ security_verdict (String)       │       │ output_content (Text)           │
│ total_latency_ms (Float)        │       │ latency_ms (Float)              │
│ created_at (DateTime)           │       │ created_at (DateTime)           │
│ completed_at (DateTime)         │       └─────────────────────────────────┘
│ summary (Text)                  │       
└────────────────┬────────────────┘       ┌─────────────────────────────────┐
                 │                        │         mesh_artifacts          │
                 │                        ├─────────────────────────────────┤
                 │                        │ id (PK, Integer)                │
                 └───────────────────────►│ session_id (FK, String)         │
                                          │ artifact_type (String)          │
                                          │ title (String)                  │
                                          │ content (Text)                  │
                                          │ created_at (DateTime)           │
                                          └─────────────────────────────────┘

Inspect your stored sessions anytime:

python agent_mesh.py --list-sessions
python agent_mesh.py --show-session mesh_20261020_054401_3dcbe2

🧪 Testing & Mock Mode

mcp-agent-mesh includes an intelligent deterministic mock engine. This enables 100% test coverage in CI/CD environments without requiring API tokens:

# Verify end-to-end pipeline in simulation mode
python agent_mesh.py --task "Build a Redis key-value store" --mock --refine -o sample.md --export-json sample.json

# Verify standalone security auditor
python agent_mesh.py --audit-only --code-file agent_mesh.py --mock -o self_audit.md

☕ Support & Commercial Services

☕ Support Open-Source Development

If mcp-agent-mesh saves your team hours of boilerplate or accelerates your prototyping, please consider buying a coffee:

👉 Support on Buy Me a Coffee


💼 Custom AI & Backend Engineering Services

Are you a tech founder, CTO, or engineering manager looking to build:

  • Custom Autonomous AI Agent Swarms & Tool-Calling Meshes
  • Model Context Protocol (MCP) Server Infrastructure
  • Enterprise LLM Workflows & Production RAG Pipelines
  • High-Throughput Python / Cloud Distributed Backend Systems

Let's collaborate:


📄 License

This project is licensed under the permissive MIT License. See the LICENSE file for complete details.

Copyright (c) 2026 Jigar Prajapati.

↑↓ navigate openesc close