@guardion/guardion 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +202 -0
- package/dist/bin/cli.d.ts.map +1 -0
- package/dist/bin/cli.js +590 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/connectors/claude-code/hooks/enforce.cjs +58 -0
- package/{hooks → dist/connectors/claude-code/hooks}/guardion-hook.cjs +123 -1
- package/dist/connectors/claude-code/hooks/tool-scanner.cjs +272 -0
- package/dist/connectors/claude-code/src/collect.d.ts +5 -0
- package/dist/connectors/claude-code/src/collect.d.ts.map +1 -0
- package/dist/connectors/claude-code/src/collect.js +17 -0
- package/dist/connectors/claude-code/src/collect.js.map +1 -0
- package/dist/{installer.d.ts → connectors/claude-code/src/installer.d.ts} +1 -1
- package/dist/connectors/claude-code/src/installer.d.ts.map +1 -0
- package/dist/{installer.js → connectors/claude-code/src/installer.js} +2 -2
- package/dist/connectors/claude-code/src/installer.js.map +1 -0
- package/dist/connectors/claude-code/src/scanner.d.ts.map +1 -0
- package/dist/{scanner.js → connectors/claude-code/src/scanner.js} +1 -1
- package/dist/connectors/claude-code/src/scanner.js.map +1 -0
- package/dist/{config.d.ts → core/config.d.ts} +96 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/{config.js → core/config.js} +44 -0
- package/dist/core/config.js.map +1 -0
- package/dist/{constants.d.ts → core/constants.d.ts} +1 -1
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/{constants.js → core/constants.js} +1 -1
- package/dist/core/constants.js.map +1 -0
- package/dist/core/discover.d.ts +36 -0
- package/dist/core/discover.d.ts.map +1 -0
- package/dist/core/discover.js +154 -0
- package/dist/core/discover.js.map +1 -0
- package/dist/core/fingerprint.cjs +84 -0
- package/dist/core/inventory.d.ts +35 -0
- package/dist/core/inventory.d.ts.map +1 -0
- package/dist/core/inventory.js +69 -0
- package/dist/core/inventory.js.map +1 -0
- package/dist/core/keychain.d.ts.map +1 -0
- package/dist/core/keychain.js.map +1 -0
- package/dist/core/mcp/guard-client.cjs +86 -0
- package/dist/core/mcp/interceptor.cjs +238 -0
- package/dist/core/mcp/jsonrpc.cjs +194 -0
- package/dist/core/mcp/transport/http-server-side.cjs +89 -0
- package/dist/core/mcp/transport/http-upstream.cjs +111 -0
- package/dist/core/mcp/transport/http_forward.cjs +40 -0
- package/dist/core/mcp/transport/http_input.cjs +46 -0
- package/dist/core/mcp/transport/http_reverse.cjs +33 -0
- package/dist/core/mcp/transport/index.cjs +32 -0
- package/dist/core/mcp/transport/sse_bridge.cjs +101 -0
- package/dist/core/mcp/transport/stdio.cjs +60 -0
- package/dist/core/mcp-interpose.cjs +141 -0
- package/dist/core/mcp-protect.d.ts +69 -0
- package/dist/core/mcp-protect.d.ts.map +1 -0
- package/dist/core/mcp-protect.js +205 -0
- package/dist/core/mcp-protect.js.map +1 -0
- package/dist/core/mcp-scan.d.ts +40 -0
- package/dist/core/mcp-scan.d.ts.map +1 -0
- package/dist/core/mcp-scan.js +201 -0
- package/dist/core/mcp-scan.js.map +1 -0
- package/dist/core/mock-server.d.ts.map +1 -0
- package/dist/{mock-server.js → core/mock-server.js} +41 -0
- package/dist/core/mock-server.js.map +1 -0
- package/package.json +9 -10
- package/config.yaml.example +0 -84
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -298
- package/dist/cli.js.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/installer.d.ts.map +0 -1
- package/dist/installer.js.map +0 -1
- package/dist/keychain.d.ts.map +0 -1
- package/dist/keychain.js.map +0 -1
- package/dist/mock-server.d.ts.map +0 -1
- package/dist/mock-server.js.map +0 -1
- package/dist/scanner.d.ts.map +0 -1
- package/dist/scanner.js.map +0 -1
- /package/dist/{cli.d.ts → bin/cli.d.ts} +0 -0
- /package/dist/{scanner.d.ts → connectors/claude-code/src/scanner.d.ts} +0 -0
- /package/dist/{keychain.d.ts → core/keychain.d.ts} +0 -0
- /package/dist/{keychain.js → core/keychain.js} +0 -0
- /package/{hooks → dist/core}/metadata.cjs +0 -0
- /package/dist/{mock-server.d.ts → core/mock-server.d.ts} +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Guardion AI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# Guardion
|
|
2
|
+
|
|
3
|
+
**Guardion — Agent runtime governance: DLP for MCPs and agents.**
|
|
4
|
+
|
|
5
|
+
An MCP (Model Context Protocol) DLP proxy with policy-driven PII anonymization that wraps
|
|
6
|
+
any MCP server — local (stdio) or remote (HTTP/SSE) — behind one secure interface, and
|
|
7
|
+
governs Claude Code at the same time.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Guardion adds a protective layer to your MCP setup. It auto-detects your existing MCP
|
|
12
|
+
configuration files and routes each server through a local interposer that scans every
|
|
13
|
+
tool **call** and **result** against a Guard policy — anonymizing PII/secrets in place
|
|
14
|
+
(structure preserved) before data ever reaches the model or leaves to a tool.
|
|
15
|
+
|
|
16
|
+
Key features:
|
|
17
|
+
|
|
18
|
+
- **DLP / anonymization** — PII and secrets in tool input *and* output are redacted via your
|
|
19
|
+
Guard policy (email, phone, names, cards, SSNs, …); the model/server only sees tokens.
|
|
20
|
+
- **Automatic configuration** — the CLI detects and updates MCP config files for **Cursor,
|
|
21
|
+
Claude Desktop, and Claude Code** (plus Windsurf, Cline, VS Code, `.mcp.json`).
|
|
22
|
+
- **Works with everything** — local **stdio** servers and **remote HTTP/SSE** servers
|
|
23
|
+
(forward, reverse, and SSE bridging); discovers remote connectors for inventory.
|
|
24
|
+
- **Transparent proxying** — tools, prompts, and resources pass through untouched except for
|
|
25
|
+
redacted text; multiple content blocks, `structuredContent`, images/blobs and `isError`
|
|
26
|
+
are preserved.
|
|
27
|
+
- **Three modes** — `dlp` (anonymize, never block), `enforce` (block on a deny verdict +
|
|
28
|
+
anonymize), `monitor` (observe only).
|
|
29
|
+
- **Beyond MCP** — Claude Code hooks (observability/enforcement) and shadow-AI discovery.
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Install the CLI
|
|
35
|
+
npm install -g @guardion/guardion # or use npx -y @guardion/guardion <cmd>
|
|
36
|
+
|
|
37
|
+
# Guided setup — pick what to protect (MCP / Claude Code), paste your key, choose policy & mode
|
|
38
|
+
guardion init
|
|
39
|
+
|
|
40
|
+
# Auto-detect & DLP-protect every MCP config on this machine (Cursor, Claude Desktop, Claude Code)
|
|
41
|
+
guardion install mcp
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`guardion init` stores your config in `~/.guardion/config.yaml` (token in the OS keychain)
|
|
45
|
+
and prints tailored next steps. Preview changes first with `guardion scan --mode mcp --dry-run`;
|
|
46
|
+
undo any time with `guardion scan --mode mcp --revert`.
|
|
47
|
+
|
|
48
|
+
## How It Works
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
MCP host (Cursor / Claude Desktop / Claude Code)
|
|
52
|
+
│ JSON-RPC
|
|
53
|
+
▼
|
|
54
|
+
guardion mcp ── tool input/output leaves ─▶ Guard API (/v1/guard, your policy)
|
|
55
|
+
│ apply redaction in place ◀── correction + redaction spans
|
|
56
|
+
▼
|
|
57
|
+
real MCP server (stdio · HTTP · SSE)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Detection and redaction are delegated entirely to your **Guard policy** — *what* to redact
|
|
61
|
+
(entity types) and *where* (tool input, output, or both) are configured centrally in the
|
|
62
|
+
Guardion console, not in the plugin.
|
|
63
|
+
|
|
64
|
+
## Usage
|
|
65
|
+
|
|
66
|
+
### Direct usage with npx
|
|
67
|
+
|
|
68
|
+
No install required — use directly in your Cursor / Claude Desktop / Claude Code MCP config.
|
|
69
|
+
Prefix any server's command with `npx -y @guardion/guardion mcp`:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"mcpServers": {
|
|
74
|
+
"protected_server": {
|
|
75
|
+
"command": "npx",
|
|
76
|
+
"args": [
|
|
77
|
+
"-y", "@guardion/guardion", "mcp", "--mode", "dlp", "--",
|
|
78
|
+
"npx", "-y", "@modelcontextprotocol/server-filesystem", "/path/to/files"
|
|
79
|
+
],
|
|
80
|
+
"env": {
|
|
81
|
+
"GUARDION_TOKEN": "grd_your_api_key",
|
|
82
|
+
"GUARDION_POLICY": "data-protection"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Standalone usage
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
GUARDION_TOKEN=grd_... GUARDION_POLICY=data-protection \
|
|
93
|
+
npx -y @guardion/guardion mcp --mode dlp -- npx -y @modelcontextprotocol/server-filesystem /path/to/files
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Configuration
|
|
97
|
+
|
|
98
|
+
### Local servers (stdio)
|
|
99
|
+
|
|
100
|
+
For local MCP servers that communicate via stdio, put the real command after `--`:
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"mcpServers": {
|
|
105
|
+
"protected_server": {
|
|
106
|
+
"command": "npx",
|
|
107
|
+
"args": ["-y", "@guardion/guardion", "mcp", "--mode", "dlp", "--", "node", "path/to/server.js"],
|
|
108
|
+
"env": { "GUARDION_TOKEN": "grd_...", "GUARDION_POLICY": "data-protection" }
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Remote servers (HTTP / SSE)
|
|
115
|
+
|
|
116
|
+
For remote MCP servers, use `--url` instead of `--`:
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"mcpServers": {
|
|
121
|
+
"protected_server": {
|
|
122
|
+
"command": "npx",
|
|
123
|
+
"args": ["-y", "@guardion/guardion", "mcp", "--mode", "dlp", "--url", "https://api.example.com/mcp"],
|
|
124
|
+
"env": { "GUARDION_TOKEN": "grd_...", "GUARDION_POLICY": "data-protection" }
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Add `--header "Authorization: Bearer …"` for authenticated remote servers, or `--listen 8900`
|
|
131
|
+
to expose Guardion as a local proxy URL you can paste into Claude Desktop → Connectors.
|
|
132
|
+
|
|
133
|
+
### Modes
|
|
134
|
+
|
|
135
|
+
| `--mode` | Behavior |
|
|
136
|
+
|-----------|-------------------------------------------------------|
|
|
137
|
+
| `dlp` | Anonymize PII via Guard corrections — **never blocks** (default) |
|
|
138
|
+
| `enforce` | Block on a deny verdict **and** anonymize |
|
|
139
|
+
| `monitor` | Observe only — send for visibility, never modify |
|
|
140
|
+
|
|
141
|
+
### Environment variables
|
|
142
|
+
|
|
143
|
+
| Variable | Purpose |
|
|
144
|
+
|------------------------|---------------------------------------------------------------|
|
|
145
|
+
| `GUARDION_TOKEN` | Your Guardion API key (or stored via `guardion token set`) |
|
|
146
|
+
| `GUARDION_POLICY` | Policy slug whose PII / Data-Protection detector to apply |
|
|
147
|
+
| `GUARDION_API_URL` | Guard API base URL (default `https://api.guardion.ai`) |
|
|
148
|
+
| `GUARDION_MODE` | `dlp` \| `enforce` \| `monitor` (same as `--mode`) |
|
|
149
|
+
| `GUARDION_FAIL_CLOSED` | `true` to deny when Guard is unreachable (default: fail-open) |
|
|
150
|
+
|
|
151
|
+
## Complete example for Cursor / Claude Desktop
|
|
152
|
+
|
|
153
|
+
Add this to your MCP configuration file:
|
|
154
|
+
|
|
155
|
+
```json
|
|
156
|
+
{
|
|
157
|
+
"mcpServers": {
|
|
158
|
+
"guardion": {
|
|
159
|
+
"command": "npx",
|
|
160
|
+
"args": [
|
|
161
|
+
"-y", "@guardion/guardion", "mcp", "--mode", "dlp", "--server", "filesystem", "--",
|
|
162
|
+
"npx", "-y", "@modelcontextprotocol/server-filesystem", "/path/to/files"
|
|
163
|
+
],
|
|
164
|
+
"env": {
|
|
165
|
+
"GUARDION_TOKEN": "grd_your_api_key",
|
|
166
|
+
"GUARDION_POLICY": "data-protection"
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
…or skip the hand-editing and let the CLI do it for every app: `guardion install mcp`.
|
|
174
|
+
|
|
175
|
+
## CLI
|
|
176
|
+
|
|
177
|
+
| Command | What it does |
|
|
178
|
+
|---------|--------------|
|
|
179
|
+
| `guardion init` | Guided setup: pick what to protect, paste your key, choose a policy & mode |
|
|
180
|
+
| `guardion install mcp` | Scan & DLP-protect every detected MCP config |
|
|
181
|
+
| `guardion mcp [--mode …] [--policy …] -- <cmd>` / `--url <url>` | Wrap one MCP server |
|
|
182
|
+
| `guardion scan [--mode full\|mcp\|tools\|agents\|skills]` | Discover MCP servers, tools, skills, shadow-AI agents/connectors; `--inventory` reports to Guard |
|
|
183
|
+
| `guardion scan --mode mcp --dry-run \| --replace \| --revert` | Preview / apply / undo config protection |
|
|
184
|
+
| `guardion claude-code [--mode hooks\|gateway\|full]` | Govern Claude Code via hooks |
|
|
185
|
+
| `guardion token set\|get\|test\|clear` | Manage your API token |
|
|
186
|
+
|
|
187
|
+
## Requirements
|
|
188
|
+
|
|
189
|
+
- Node.js >= 18.0.0
|
|
190
|
+
- A Guardion API key and a policy with the PII / Data-Protection detector enabled
|
|
191
|
+
(create one at [guardion.ai](https://guardion.ai))
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
|
|
195
|
+
MIT
|
|
196
|
+
|
|
197
|
+
## About
|
|
198
|
+
|
|
199
|
+
Guardion secures your MCP clients and AI agents from data leaks (DLP / PII anonymization),
|
|
200
|
+
prompt injection, tool poisoning, and risky actions.
|
|
201
|
+
|
|
202
|
+
[www.guardion.ai](https://guardion.ai)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../bin/cli.ts"],"names":[],"mappings":""}
|