Free, offline security shield for AI agents that use MCP: static scanner, real-time Shield, signed ledger. Italiano / English.
翻译准备中
取自仓库 README
正在加载完整 README。
查看完整 README ↗by Alexander Puglisi · Download · ✓ Claude Academy: Introduction to MCP · ✓ Claude Academy: MCP Advanced Topics
Step-by-step guide with screenshots · Guida passo passo con foto
· · How it was tested · Security · For reviewers · Guide (EN) · Guida (IT)
🇬🇧 English below · 🇮🇹 Italiano più sotto
Guardia MCP is a free, open source, fully offline defensive shield for AI agents (Claude Code, Claude Desktop, Cursor, VS Code and others) that use tools through the Model Context Protocol (MCP). No account, no telemetry, no data ever leaves your computer.
Every server you install can read files, use your keys and give instructions to the AI. Guardia answers three questions in a minute:
And if you want, the Shield checks everything while the AI works: it blocks, hides secrets or asks you first.
Free, open source and offline. No account, no data ever leaves your PC.
The demo runs on a fake PC made of fake servers and skills written for the purpose
(scripts/demo.py): no real data, no real secrets.
Status: version 0.5.7 — v1 (static analysis) and v2 (real-time Shield for local stdio servers).
guardia inventory — finds the MCP servers and skills configured on this PC in the supported apps
(Claude Desktop, Claude Code, Cursor, VS Code, Windsurf, Gemini CLI, Codex, Copilot CLI) and lists
them with a risk level.guardia scan — checks them against 96 rules and explains every problem with the exact file and
line, a plain-language explanation and how to fix it:
setup.py;SKILL.md text, granted tools, download-and-execute commands, attached scripts;guardia ledger verify | show | anchor.--format text | json | html | sarif. The HTML report is a single file with no
scripts and a strict Content Security Policy; SARIF 2.1.0 works with GitHub code scanning.guardia rules lists all 96 rules, guardia rules G05-002 explains one.
The full guide is in docs/RULES.md (generated from the code, always up to date).The scan never runs the code it analyzes and never changes configuration files: it writes only its
own notes (baseline and ledger). Only the Shield changes a client's configuration, and only when you
confirm it (with a backup first). Guardia keeps its own data (baseline, ledger, rules, tool memory,
backups, app settings) in %LOCALAPPDATA%\GuardiaMCP.
Exit codes of guardia scan: 0 nothing at or above --fail-on (default high),
1 problems found, 2 usage error, 3 incomplete analysis.
Read SECURITY.md for what Guardia guarantees and its honest limits, and CONTRIBUTING.md to help.
The Shield sits between an AI app and a local MCP server: the client talks to Guardia, Guardia talks to the server, and every message is checked before it passes.
guardia shield list
guardia shield enable --server NAME --confirm
guardia shield rules example --save
guardia shield rules approve
guardia shield list shows every server and whether it can be
protected; enable saves a backup, changes only that server's entry and records the original;
disable puts it back, never overwriting your own later edits. The same actions are in the
Shield section of the app.guardia shield rules test tries a rule without a
server.guardia shield tools approve --server NAME); it
applies in real time the v1 rules for tool descriptions and server instructions to hide poisoned
tools and remove dangerous server instructions; it flags
prompt injection in results, redacts secrets in results, and stops secrets in arguments and
requests for passwords. Hidden tools cannot be called either.ask: the AI cannot answer for you,
and no answer within 45 seconds means block.Full guide: docs/SHIELD.md.
Two built-in defenses from the INFINITY-SAND doctrine.
Canary — a decoy secret that warns you if a server reads it:
guardia canary create --file "%USERPROFILE%\Documents\credentials.env"
This plants a tempting fake secrets file. If any MCP server behind the Shield ever reads the bait
and sends it back, the Shield blocks the message and records it in the ledger with the canary
label. See them with guardia canary list, remove one with guardia canary remove <id>.
Encrypted backups — a snapshot of your ledger, approved rules and canaries, encrypted with Windows DPAPI and rotated (the oldest are deleted):
guardia backup create
Copy the file it writes to a USB stick or another computer: that is your copy off this PC (Guardia
never uses the network). Restore it into a folder of your choice with
guardia backup extract <file> <folder>.
Prefer pictures? Follow the step-by-step guide with screenshots.
GuardiaMCP-0.5.7-windows-x64.zip and SHA256SUMS.txt from the project's
Releases page on GitHub
and check the zip: the guide has two PowerShell lines to
paste, which must print True.C:\Users\YOUR-NAME (the zip
already contains the GuardiaMCP folder, so you get C:\Users\YOUR-NAME\GuardiaMCP).
Protected servers start Guardia from this folder: if you move it, press Relink to this
Guardia in the Shield section; if you want to delete it, first remove the protection (see
Uninstall).GuardiaMCP.exe (the one with the red shield icon). The first time Windows SmartScreen
may warn you, because the program is not code-signed yet: choose More info → Run anyway. The
first scan starts by itself.ask, a small Guardia window asks you; no answer within 45 seconds means block.To update, extract the new zip to the same place, replacing the files: your rules, ledger and settings stay where they are (details). Something not working? The guide has a troubleshooting table.
Everything is also available from the command line (guardia.exe), described below and in
docs/SHIELD.md. The guides are also inside the zip, in the docs folder.
Claude Desktop from the Microsoft Store. Windows gives Store apps a private copy of the
AppDatafolder. If a program started by Claude (such as the Shield) is the first to create Guardia's data folder, Windows puts it in Claude's private folder (%LOCALAPPDATA%\Packages\Claude_*\LocalCache\Local\GuardiaMCP), where the app and the command line do not see it. Open Guardia once from its own icon before protecting servers: once the real folder exists, everything uses it.
Requires uv.
git clone https://github.com/AlexanderPuglisi/GuardiaMCP.git
cd GuardiaMCP
uv sync --extra app
uv run guardia inventory
uv run guardia scan
uv run guardia scan --format html --output guardia-report.html
uv run guardia ledger verify
uv run guardia rules G05-002
uv run guardia-app
scripts/build_exe.py builds, with PyInstaller, a folder dist\GuardiaMCP\ with two programs —
guardia.exe (command line) and GuardiaMCP.exe (desktop app) — plus a zip and a
SHA256SUMS.txt file with their fingerprints. Python is not needed to run them.
cd GuardiaMCP
uv run --exact --no-dev --group build --extra app python scripts\build_exe.py
.\dist\GuardiaMCP\guardia.exe scan
.\dist\GuardiaMCP\GuardiaMCP.exe
--exact --no-dev keeps the test tools out of the build, so the executables contain only Guardia,
Python and the libraries listed in SECURITY.md. Afterwards uv sync brings the test
tools back.
The executables are not code-signed yet: Windows SmartScreen may warn the first time.
Before running a copy you did not build yourself, compare its SHA-256 with SHA256SUMS.txt
(Get-FileHash .\GuardiaMCP.exe).
Guardia has no installer and leaves nothing hidden in the system: no services, no registry keys, no automatic start. Remove it in this order:
Close the AI apps (Claude Desktop also from its tray icon → Quit) and remove the Shield from every server, otherwise the AI apps can no longer start those servers. The simplest way: open Guardia, go to Shield and press Remove protection next to each protected server, until the summary says 0. From PowerShell you can do it in one go (change the path if you extracted Guardia somewhere else):
& "$env:USERPROFILE\GuardiaMCP\guardia.exe" shield disable --all --confirm
& "$env:USERPROFILE\GuardiaMCP\guardia.exe" shield list
The list must show 0 protected servers. Entries you protected by hand (TOML files or files with
comments) must be restored by hand: the original file is in the backup folder of Guardia's data
(for each file, the oldest copy is the original).
Close Guardia.
Delete Guardia's data (ledger, rules, tool memory, backups, settings). This cannot be undone: copy the folder elsewhere first if you want to keep the history.
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\GuardiaMCP"
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\Packages\Claude_*\LocalCache\Local\GuardiaMCP" -ErrorAction SilentlyContinue
The second line only matters with Claude Desktop from the Microsoft Store; if there is nothing there it does nothing.
Delete the folder you extracted and any shortcut you created.
I created Guardia MCP on my own: there is no team or company behind it. I decided what to build, how
it should work and what it must never do. To write the code I worked with Claude Code,
Anthropic's AI coding agent, which is listed as a contributor: every commit carries a
Co-Authored-By: Claude line, so the project history shows openly who did what.
I apply a purple-team approach to my projects: adversarial red-team review to find the weaknesses, then defensive fixes verified with regression tests.
Before writing any code I studied the protocol with Anthropic's official course (Claude Academy badge: Introduction to Model Context Protocol). Then I built Guardia in one intensive day, 23 October 2026: the static scanner (v1), the real-time Shield (v2.0 to v2.5) and finally the review from scratch. The next day, while preparing version 0.2.2, I also completed the advanced course (Claude Academy badge: Model Context Protocol: Advanced Topics).
From there I kept hardening it in the open: version 0.3.0 added two built-in defenses — a canary decoy and encrypted rotating backups (INFINITY-SAND) — and versions 0.4.0 and 0.5.0 were two more independent red-team passes, first on the whole tool and then on the Shield, closing five further weaknesses in all, each with its own regression test and the full suite kept green. Every version is recorded in the CHANGELOG.
— Alexander Puglisi
License: Apache 2.0.
Guardia MCP è uno scudo difensivo gratuito, open source e completamente offline per gli agenti AI (Claude Code, Claude Desktop, Cursor, VS Code e altri) che usano strumenti tramite il Model Context Protocol (MCP). Nessun account, nessuna telemetria, nessun dato esce dal tuo computer.
Ogni server che installi può leggere file, usare le tue chiavi e dare istruzioni all'AI. Guardia risponde in un minuto a tre domande:
E se vuoi, lo Scudo controlla tutto mentre l'AI lavora: blocca, nasconde i segreti o ti chiede conferma.
Gratis, open source e offline. Nessun account, nessun dato esce dal tuo PC.
La demo gira su un PC finto, fatto di server e skill finti scritti apposta
(scripts/demo.py): nessun dato vero, nessun segreto vero.
Stato: versione 0.5.7 — v1 (analisi statica) e v2 (Scudo in tempo reale per i server locali stdio).
guardia inventario — trova i server MCP e le skill configurati sul PC nelle app supportate
(Claude Desktop, Claude Code, Cursor, VS Code, Windsurf, Gemini CLI, Codex, Copilot CLI) e li
elenca con il livello di rischio.guardia scansiona — li controlla con 96 regole e spiega ogni problema con file e riga esatti,
una spiegazione semplice e come correggerlo:
setup.py che esegue codice;SKILL.md, strumenti concessi, comandi che scaricano ed eseguono, script allegati;guardia registro verifica | mostra | ancora.--formato testo | json | html | sarif. Il rapporto HTML è un file unico, senza
script e con una Content Security Policy rigida; SARIF 2.1.0 funziona con GitHub code scanning.guardia regole elenca tutte le 96 regole, guardia regole G05-002 ne
spiega una. La guida completa è in docs/REGOLE.md (generata dal codice,
sempre aggiornata).La scansione non esegue mai il codice che analizza e non modifica i file di configurazione: scrive
soltanto i propri appunti (base di confronto e registro). Solo lo Scudo modifica la configurazione di
un client, e solo quando lo confermi (dopo averne salvato una copia). Guardia tiene i propri dati
(base di confronto, registro, regole, memoria degli strumenti, copie di sicurezza, impostazioni
dell'app) in %LOCALAPPDATA%\GuardiaMCP.
Codici di uscita di guardia scansiona: 0 nessun problema dal livello --fallisci-da in su
(predefinito high), 1 problemi trovati, 2 errore d'uso, 3 analisi incompleta.
Leggi SECURITY.md per sapere cosa garantisce Guardia e quali sono i suoi limiti, e CONTRIBUTING.md per contribuire.
Lo Scudo si mette tra un'app AI e un server MCP locale: il client parla con Guardia, Guardia parla con il server, e ogni messaggio viene controllato prima di passare.
guardia scudo elenco
guardia scudo attiva --server NOME --conferma
guardia scudo regole esempio --salva
guardia scudo regole approva
guardia scudo elenco mostra tutti i server e se si possono
proteggere; attiva salva una copia di sicurezza, cambia solo la voce di quel server e annota
quella originale; disattiva la rimette, senza mai sovrascrivere le tue modifiche successive. Le
stesse azioni sono nella sezione Scudo dell'app.guardia scudo regole prova prova una regola senza server.guardia scudo strumenti approva --server NOME); applica in tempo reale le regole della v1 su
descrizioni degli strumenti e istruzioni del server per nascondere gli strumenti avvelenati e
togliere le istruzioni pericolose; segnala la prompt injection nei risultati, oscura i segreti
nei risultati e ferma i segreti negli argomenti e le richieste di password. Gli strumenti nascosti
non si possono nemmeno chiamare.chiedi: l'AI non può rispondere al posto tuo, e senza risposta entro 45 secondi blocca.Guida completa: docs/SCUDO.md.
Vuoi capire MCP da zero? Leggi docs/IMPARA-MCP.md.
Due difese di serie, dalla dottrina INFINITY-SAND.
Esca — un segreto civetta che ti avvisa se un server lo legge:
guardia esca crea --file "%USERPROFILE%\Documents\credenziali.env"
Pianta un finto file di segreti allettante. Se un server MCP dietro lo Scudo legge l'esca e la
rimanda, lo Scudo blocca il messaggio e lo scrive nel registro con l'etichetta canary. Le vedi
con guardia esca elenco, ne rimuovi una con guardia esca rimuovi <id>.
Backup cifrati — uno snapshot di registro, regole approvate ed esche, cifrato con DPAPI di Windows e a rotazione (i più vecchi vengono cancellati):
guardia copia crea
Copia il file che crea su una chiavetta o un altro computer: quella è la tua copia fuori dal PC
(Guardia non usa mai la rete). Ripristinalo in una cartella che scegli tu con
guardia copia estrai <file> <cartella>.
Preferisci le foto? Segui la guida passo passo con le schermate.
GuardiaMCP-0.5.7-windows-x64.zip e SHA256SUMS.txt dalla pagina
Releases del progetto su
GitHub e controlla lo zip: nella guida ci sono due righe
da incollare in PowerShell, che devono stampare True.C:\Users\TUO-NOME (lo zip
contiene già la cartella GuardiaMCP, quindi ottieni C:\Users\TUO-NOME\GuardiaMCP).
I server protetti avviano Guardia da questa cartella: se la sposti, premi Ricollega a questa
Guardia nella sezione Scudo; se vuoi cancellarla, prima togli la protezione (vedi
Disinstallare).GuardiaMCP.exe (quello con l'icona dello scudo rosso). La prima volta Windows
SmartScreen può mostrare un avviso, perché il programma non è ancora firmato digitalmente: scegli
Ulteriori informazioni → Esegui comunque. La prima scansione parte da sola.chiedi, una piccola finestra di Guardia ti chiede
conferma; senza risposta entro 45 secondi blocca.Per aggiornare, estrai il nuovo zip nello stesso posto sostituendo i file: regole, registro e impostazioni restano dove sono (dettagli). Qualcosa non va? Nella guida c'è una tabella dei problemi comuni.
Tutto si può fare anche da riga di comando (guardia.exe), come spiegato sotto e in
docs/SCUDO.md. Le guide sono anche dentro lo zip, nella cartella docs.
Claude Desktop installato dal Microsoft Store. Windows dà alle app dello Store una copia privata della cartella
AppData. Se il primo a creare la cartella dei dati di Guardia è un programma avviato da Claude (per esempio lo Scudo), Windows la mette nella cartella privata di Claude (%LOCALAPPDATA%\Packages\Claude_*\LocalCache\Local\GuardiaMCP), dove l'app e la riga di comando non la vedono. Apri Guardia una volta dalla sua icona prima di proteggere i server: quando la cartella vera esiste, tutti usano quella.
Serve uv.
git clone https://github.com/AlexanderPuglisi/GuardiaMCP.git
cd GuardiaMCP
uv sync --extra app
uv run guardia inventario
uv run guardia scansiona
uv run guardia scansiona --formato html --salva guardia-report.html
uv run guardia registro verifica
uv run guardia regole G05-002
uv run guardia-app
scripts/build_exe.py costruisce con PyInstaller la cartella dist\GuardiaMCP\ con due
programmi — guardia.exe (riga di comando) e GuardiaMCP.exe (app desktop) — più un archivio
zip e il file SHA256SUMS.txt con le loro impronte. Per usarli non serve Python.
cd GuardiaMCP
uv run --exact --no-dev --group build --extra app python scripts\build_exe.py
.\dist\GuardiaMCP\guardia.exe scansiona
.\dist\GuardiaMCP\GuardiaMCP.exe
--exact --no-dev lascia fuori dalla build gli strumenti di test, così gli eseguibili contengono
solo Guardia, Python e le librerie elencate in SECURITY.md. Dopo, uv sync rimette
gli strumenti di test.
Gli eseguibili non sono ancora firmati digitalmente: la prima volta Windows SmartScreen
potrebbe mostrare un avviso. Prima di avviare una copia che non hai costruito tu, confronta la sua
impronta SHA-256 con SHA256SUMS.txt (Get-FileHash .\GuardiaMCP.exe).
Guardia non ha un programma di installazione e non lascia nulla di nascosto nel sistema: niente servizi, niente chiavi di registro, niente avvio automatico. Toglila in quest'ordine:
Chiudi le app AI (Claude Desktop anche dalla sua icona vicino all'orologio → Esci) e togli lo Scudo da tutti i server, altrimenti le app AI non riescono più ad avviarli. Il modo più semplice: apri Guardia, vai in Scudo e premi Togli protezione accanto a ogni server protetto, finché il riepilogo dice 0. Da PowerShell puoi farlo in un colpo solo (cambia il percorso se hai estratto Guardia altrove):
& "$env:USERPROFILE\GuardiaMCP\guardia.exe" scudo disattiva --tutti --conferma
& "$env:USERPROFILE\GuardiaMCP\guardia.exe" scudo elenco
L'elenco deve mostrare 0 server protetti. Le voci protette a mano (file TOML o con commenti)
vanno ripristinate a mano: il file originale è nella cartella backup dei dati di Guardia (per
ogni file la copia più vecchia è l'originale).
Chiudi Guardia.
Cancella i dati di Guardia (registro, regole, memoria degli strumenti, copie di sicurezza, impostazioni). Non si può annullare: se vuoi tenere lo storico, copia prima la cartella altrove.
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\GuardiaMCP"
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\Packages\Claude_*\LocalCache\Local\GuardiaMCP" -ErrorAction SilentlyContinue
La seconda riga serve solo con Claude Desktop installato dal Microsoft Store; se lì non c'è niente, non fa niente.
Cancella la cartella che avevi estratto e gli eventuali collegamenti.
Guardia MCP l'ho creato io, da solo: non c'è un team né un'azienda dietro. Ho deciso cosa costruire,
come doveva funzionare e cosa non doveva mai fare. Per scrivere il codice ho lavorato con
Claude Code, l'agente di programmazione AI di Anthropic, che compare tra i contributori: ogni
commit porta la riga Co-Authored-By: Claude, così la storia del progetto mostra con trasparenza
chi ha fatto cosa.
Applico un approccio purple-team ai miei progetti: red-team adversariale per trovare le debolezze, poi fix difensivi verificati con test di regressione.
Prima di scrivere codice ho studiato il protocollo con il corso ufficiale di Anthropic (badge Claude Academy: Introduction to Model Context Protocol). Poi ho costruito Guardia in una giornata intensa, il 23 ottobre 2026: lo scanner statico (v1), lo Scudo in tempo reale (dalla v2.0 alla v2.5) e infine la revisione da zero. Il giorno dopo, mentre preparavo la versione 0.2.2, ho completato anche il corso avanzato (badge Claude Academy: Model Context Protocol: Advanced Topics).
Da lì ho continuato a irrobustirlo alla luce del sole: la versione 0.3.0 ha aggiunto due difese di serie — un'esca (canary) e i backup cifrati a rotazione (INFINITY-SAND) — e le versioni 0.4.0 e 0.5.0 sono state altre due revisioni adversariali indipendenti (red-team), prima su tutto il tool e poi sullo Scudo, chiudendo in tutto cinque ulteriori debolezze, ognuna con il suo test di regressione e con l'intera suite sempre verde. Ogni versione è nel CHANGELOG.
— Alexander Puglisi
Licenza: Apache 2.0.
If you use or reference GuardiaMCP, please cite the whitepaper. · Se usi o citi GuardiaMCP, cita il whitepaper.
Puglisi, A. (2026). GuardiaMCP: A Free, Offline, Test-Verified Defensive Layer for the Model Context Protocol. Zenodo. https://doi.org/10.5281/zenodo.23814323
@techreport{puglisi2026guardiamcp,
author = {Puglisi, Alexander},
title = {{GuardiaMCP: A Free, Offline, Test-Verified Defensive Layer for the Model Context Protocol}},
institution = {Zenodo},
year = {2026},
doi = {10.5281/zenodo.23814323},
url = {https://doi.org/10.5281/zenodo.23814323}
}