@aiclude/mcp-guard 0.2.0 → 0.2.1
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 +190 -0
- package/README.md +327 -126
- package/package.json +4 -3
- package/LICENSE.md +0 -64
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding any notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 AIclude Inc.
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,209 +1,410 @@
|
|
|
1
|
-
|
|
2
|
-
<img src="https://aiclude.com/assets/mcp-guard-logo.svg" alt="MCP Guard" width="120" />
|
|
3
|
-
</p>
|
|
1
|
+
# MCP Guard
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
**Real-time security firewall for AI agents**
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
<strong>AI 에이전트를 위한 실시간 보안 방화벽</strong><br/>
|
|
9
|
-
MCP(Model Context Protocol) 통신을 실시간으로 검사하고, 악성 도구 호출을 사전에 차단합니다.
|
|
10
|
-
</p>
|
|
5
|
+
MCP Guard is an inline security proxy that sits between MCP clients and servers. It inspects every message in real-time and blocks malicious tool calls before they reach the server.
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<a href="#핵심-기능">핵심 기능</a> ·
|
|
15
|
-
<a href="#빠른-시작">빠른 시작</a> ·
|
|
16
|
-
<a href="USAGE.md">사용 가이드</a> ·
|
|
17
|
-
<a href="LICENSE.md">라이선스</a>
|
|
18
|
-
</p>
|
|
7
|
+
[](https://www.npmjs.com/package/@aiclude/mcp-guard)
|
|
8
|
+
[](LICENSE)
|
|
19
9
|
|
|
20
10
|
---
|
|
21
11
|
|
|
22
|
-
##
|
|
12
|
+
## Why MCP Guard?
|
|
23
13
|
|
|
24
|
-
|
|
14
|
+
In 2026, **MCP (Model Context Protocol)** has become the de facto standard for AI agents to interact with external systems. Claude, Cursor, Copilot, and other major AI tools use MCP to connect to databases, APIs, file systems, and cloud services.
|
|
25
15
|
|
|
26
|
-
|
|
16
|
+
**But MCP communication is unprotected.**
|
|
27
17
|
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
- **OWASP MCP Top 10**
|
|
18
|
+
- **30+ CVEs** reported in Jan–Feb 2026 alone
|
|
19
|
+
- **92% exploit probability** with just 10 MCP plugins installed ([VentureBeat](https://venturebeat.com))
|
|
20
|
+
- **OWASP MCP Top 10** published — Tool Poisoning, Prompt Injection, Context Spoofing confirmed as real attack vectors
|
|
31
21
|
|
|
32
|
-
|
|
22
|
+
Existing security tools (WAF, SAST, DAST) don't operate at the MCP protocol level. Attacks happening inside **JSON-RPC message streams** over stdio pipes or SSE are invisible to traditional security tools.
|
|
33
23
|
|
|
34
|
-
> **MCP Guard
|
|
24
|
+
> **MCP Guard** inspects all messages in real-time and **blocks dangerous tool calls before they reach the server**.
|
|
35
25
|
|
|
36
26
|
---
|
|
37
27
|
|
|
38
|
-
##
|
|
28
|
+
## Quick Start
|
|
39
29
|
|
|
40
|
-
###
|
|
30
|
+
### Install
|
|
41
31
|
|
|
42
|
-
|
|
32
|
+
```bash
|
|
33
|
+
npm install -g @aiclude/mcp-guard
|
|
34
|
+
```
|
|
43
35
|
|
|
44
|
-
###
|
|
36
|
+
### stdio mode — Protect a local MCP server
|
|
45
37
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
| **Argument Injection Detection** | 클라이언트의 도구 호출 인자 | SQL/Command/XSS/Path Traversal/Template 인젝션 |
|
|
50
|
-
| **Data Exfiltration Detection** | 서버의 도구 실행 결과 | 민감 데이터 노출, 시스템 경로 유출, 명령어 실행 증거 |
|
|
38
|
+
```bash
|
|
39
|
+
mcp-guard -- npx @modelcontextprotocol/server-fetch
|
|
40
|
+
```
|
|
51
41
|
|
|
52
|
-
###
|
|
42
|
+
### HTTP mode — Protect a remote MCP server
|
|
53
43
|
|
|
54
|
-
|
|
44
|
+
```bash
|
|
45
|
+
mcp-guard http --upstream http://mcp-server:8080/mcp --port 9090
|
|
46
|
+
```
|
|
55
47
|
|
|
56
|
-
###
|
|
48
|
+
### Claude Desktop Integration
|
|
57
49
|
|
|
58
|
-
|
|
59
|
-
|------|------|------|
|
|
60
|
-
| **stdio** | 로컬 MCP 서버 프로세스 래핑 | Claude Desktop, Cursor 등 |
|
|
61
|
-
| **HTTP** | 원격 MCP 서버 리버스 프록시 | Streamable HTTP + Legacy SSE |
|
|
50
|
+
Add to your `claude_desktop_config.json`:
|
|
62
51
|
|
|
63
|
-
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"mcpServers": {
|
|
55
|
+
"fetch-guarded": {
|
|
56
|
+
"command": "npx",
|
|
57
|
+
"args": ["-y", "@aiclude/mcp-guard", "--", "npx", "-y", "@modelcontextprotocol/server-fetch"]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Cursor IDE Integration
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
Add to `.cursor/mcp.json`:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"mcpServers": {
|
|
70
|
+
"my-server-guarded": {
|
|
71
|
+
"command": "npx",
|
|
72
|
+
"args": ["-y", "@aiclude/mcp-guard", "--", "npx", "-y", "@some/mcp-server"]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
66
77
|
|
|
67
78
|
---
|
|
68
79
|
|
|
69
|
-
##
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
80
|
+
## Key Features
|
|
81
|
+
|
|
82
|
+
### 3 Security Rule Engines
|
|
83
|
+
|
|
84
|
+
| Rule | Inspects | Threats Addressed |
|
|
85
|
+
|------|----------|-------------------|
|
|
86
|
+
| **Tool Poisoning Detection** | Tool definitions from server | Zero-width steganography, prompt injection, homoglyph spoofing, name shadowing |
|
|
87
|
+
| **Argument Injection Detection** | Tool call arguments from client | SQL / Command / XSS / Path Traversal / Template injection (21+ patterns) |
|
|
88
|
+
| **Data Exfiltration Detection** | Tool responses from server | Credential leaks, system path exposure, stack trace disclosure |
|
|
89
|
+
|
|
90
|
+
### Multilingual Threat Detection
|
|
91
|
+
|
|
92
|
+
Detects prompt injection phrases in **English, Korean, Chinese, and Japanese**. Normalizes Cyrillic/Greek homoglyphs to block character-disguise bypass attacks.
|
|
93
|
+
|
|
94
|
+
### Dual Protocol Support
|
|
95
|
+
|
|
96
|
+
| Mode | Use Case | Target |
|
|
97
|
+
|------|----------|--------|
|
|
98
|
+
| **stdio** | Wrap local MCP server processes | Claude Desktop, Cursor, etc. |
|
|
99
|
+
| **HTTP** | Reverse proxy for remote MCP servers | Streamable HTTP + Legacy SSE |
|
|
100
|
+
|
|
101
|
+
### Zero Configuration
|
|
102
|
+
|
|
103
|
+
Works out of the box with built-in default policies. Customize with YAML policy files when needed.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Protection Coverage
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
+---------------------+-----------------------+-----------------------+
|
|
111
|
+
| Tool Definitions | Tool Call Arguments | Tool Responses |
|
|
112
|
+
| (server -> client) | (client -> server) | (server -> client) |
|
|
113
|
+
+---------------------+-----------------------+-----------------------+
|
|
114
|
+
| Zero-width chars | SQL Injection | Credential exposure |
|
|
115
|
+
| Prompt injection | Command Injection | System path leaks |
|
|
116
|
+
| Homoglyph spoofing | Path Traversal | Stack trace exposure |
|
|
117
|
+
| HTML comment hiding | XSS | Command exec evidence |
|
|
118
|
+
| Base64 encoding | Template Injection | Template injection |
|
|
119
|
+
| Name shadowing | Prompt injection | Credential leaks |
|
|
120
|
+
| Multilingual inject | Multilingual inject | |
|
|
121
|
+
| Agent manipulation | Zero-width hiding | |
|
|
122
|
+
| InputSchema checks | | |
|
|
123
|
+
+---------------------+-----------------------+-----------------------+
|
|
124
|
+
CWE: CWE-22, CWE-78, CWE-79, CWE-89, CWE-94, CWE-200, CWE-209
|
|
125
|
+
OWASP MCP Top 10: Tool Poisoning, Prompt Injection, and more
|
|
91
126
|
```
|
|
92
127
|
|
|
93
128
|
---
|
|
94
129
|
|
|
95
|
-
##
|
|
130
|
+
## How It Works
|
|
96
131
|
|
|
97
|
-
MCP Guard
|
|
132
|
+
MCP Guard operates as a **transparent proxy** between client and server.
|
|
98
133
|
|
|
99
|
-
### stdio
|
|
134
|
+
### stdio Mode
|
|
100
135
|
|
|
101
136
|
```
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
│
|
|
107
|
-
┌──────┴───────┐
|
|
108
|
-
│ Rule Engine │
|
|
109
|
-
└──────────────┘
|
|
137
|
+
MCP Client ──stdio──> MCP Guard ──stdio──> MCP Server
|
|
138
|
+
<──stdio── (Proxy) <──stdio── (Local)
|
|
139
|
+
|
|
|
140
|
+
Rule Engine
|
|
110
141
|
```
|
|
111
142
|
|
|
112
|
-
### HTTP
|
|
143
|
+
### HTTP Mode
|
|
113
144
|
|
|
114
145
|
```
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
│
|
|
120
|
-
┌──────┴───────┐
|
|
121
|
-
│ Rule Engine │
|
|
122
|
-
└──────────────┘
|
|
146
|
+
MCP Client ──HTTP──> MCP Guard ──HTTP──> MCP Server
|
|
147
|
+
<──SSE── (:9090) <──SSE── (Remote)
|
|
148
|
+
|
|
|
149
|
+
Rule Engine
|
|
123
150
|
```
|
|
124
151
|
|
|
125
|
-
|
|
152
|
+
**Default behavior: Fail-Close.** If the policy engine errors, all traffic is blocked for safety.
|
|
126
153
|
|
|
127
154
|
---
|
|
128
155
|
|
|
129
|
-
##
|
|
156
|
+
## CLI Reference
|
|
157
|
+
|
|
158
|
+
### stdio mode (default)
|
|
130
159
|
|
|
131
160
|
```bash
|
|
132
|
-
|
|
133
|
-
|
|
161
|
+
mcp-guard [options] -- <server-command> [server-args...]
|
|
162
|
+
```
|
|
134
163
|
|
|
135
|
-
|
|
136
|
-
|
|
164
|
+
| Option | Short | Description | Default |
|
|
165
|
+
|--------|-------|-------------|---------|
|
|
166
|
+
| `--config <path>` | `-c` | YAML policy file path | Built-in defaults |
|
|
167
|
+
| `--verbose` | `-v` | Enable debug-level logging | `false` |
|
|
168
|
+
| `--fail-open` | | Allow traffic on policy engine error (not recommended) | `false` |
|
|
169
|
+
| `--dry-run` | | Log violations without blocking | `false` |
|
|
170
|
+
| `--version` | `-V` | Print version | |
|
|
171
|
+
| `--help` | `-h` | Print help | |
|
|
137
172
|
|
|
138
|
-
|
|
139
|
-
|
|
173
|
+
### HTTP mode
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
mcp-guard http [options] --upstream <url>
|
|
140
177
|
```
|
|
141
178
|
|
|
142
|
-
|
|
179
|
+
| Option | Short | Description | Default |
|
|
180
|
+
|--------|-------|-------------|---------|
|
|
181
|
+
| `--upstream <url>` | `-u` | Upstream MCP server URL **(required)** | |
|
|
182
|
+
| `--port <number>` | `-p` | Listen port | `9090` |
|
|
183
|
+
| `--host <host>` | `-H` | Bind host | `127.0.0.1` |
|
|
184
|
+
| `--config <path>` | `-c` | YAML policy file path | Built-in defaults |
|
|
185
|
+
| `--verbose` | `-v` | Enable debug-level logging | `false` |
|
|
186
|
+
| `--fail-open` | | Allow traffic on policy engine error | `false` |
|
|
187
|
+
| `--dry-run` | | Log violations without blocking | `false` |
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Policy File
|
|
192
|
+
|
|
193
|
+
Policy files are written in YAML. Without a policy file, built-in defaults apply.
|
|
194
|
+
|
|
195
|
+
### Basic Structure
|
|
196
|
+
|
|
197
|
+
```yaml
|
|
198
|
+
version: 1
|
|
199
|
+
failMode: closed # closed (recommended) | open
|
|
200
|
+
|
|
201
|
+
logging:
|
|
202
|
+
level: info # debug | info | warn | error
|
|
203
|
+
destination: stderr
|
|
204
|
+
|
|
205
|
+
rules:
|
|
206
|
+
- id: tool-poisoning
|
|
207
|
+
enabled: true
|
|
208
|
+
severity: critical
|
|
209
|
+
action: block # block | warn
|
|
210
|
+
type: tool-poisoning
|
|
211
|
+
|
|
212
|
+
- id: argument-injection
|
|
213
|
+
enabled: true
|
|
214
|
+
severity: critical
|
|
215
|
+
action: block
|
|
216
|
+
type: argument-injection
|
|
217
|
+
|
|
218
|
+
- id: data-exfiltration
|
|
219
|
+
enabled: true
|
|
220
|
+
severity: high
|
|
221
|
+
action: warn # warn recommended — blocking may break normal flow
|
|
222
|
+
type: data-exfiltration
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Tool Poisoning Config
|
|
226
|
+
|
|
227
|
+
```yaml
|
|
228
|
+
config:
|
|
229
|
+
checkZeroWidth: true
|
|
230
|
+
checkInjectionPhrases: true
|
|
231
|
+
checkHtmlComments: true
|
|
232
|
+
checkBase64: true
|
|
233
|
+
checkShadowing: true
|
|
234
|
+
checkInstructionPatterns: true
|
|
235
|
+
maxDescriptionLength: 5000
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Argument Injection Config
|
|
239
|
+
|
|
240
|
+
```yaml
|
|
241
|
+
config:
|
|
242
|
+
checkPromptInjection: true
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
SQL, Command, Path Traversal, XSS, and Template Injection checks are always active.
|
|
246
|
+
|
|
247
|
+
### Data Exfiltration Config
|
|
248
|
+
|
|
249
|
+
```yaml
|
|
250
|
+
config:
|
|
251
|
+
checkCredentials: true
|
|
252
|
+
checkPathExposure: true
|
|
253
|
+
checkStackTraces: true
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Usage Scenarios
|
|
259
|
+
|
|
260
|
+
### Evaluate a new MCP server safely
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
# Step 1: Dry-run to observe
|
|
264
|
+
mcp-guard --dry-run --verbose -- npx @unknown/mcp-server 2>guard.log
|
|
265
|
+
|
|
266
|
+
# Step 2: Review findings
|
|
267
|
+
cat guard.log | grep "DRY-RUN"
|
|
268
|
+
|
|
269
|
+
# Step 3: Enable blocking if clean
|
|
270
|
+
mcp-guard -- npx @unknown/mcp-server
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Protect multiple servers in Claude Desktop
|
|
143
274
|
|
|
144
275
|
```json
|
|
145
276
|
{
|
|
146
277
|
"mcpServers": {
|
|
147
278
|
"fetch-guarded": {
|
|
148
279
|
"command": "npx",
|
|
149
|
-
"args": ["-y", "mcp-guard", "--", "npx", "-y", "@modelcontextprotocol/server-fetch"]
|
|
280
|
+
"args": ["-y", "@aiclude/mcp-guard", "--", "npx", "-y", "@modelcontextprotocol/server-fetch"]
|
|
281
|
+
},
|
|
282
|
+
"github-guarded": {
|
|
283
|
+
"command": "npx",
|
|
284
|
+
"args": ["-y", "@aiclude/mcp-guard", "--", "npx", "-y", "@modelcontextprotocol/server-github"]
|
|
150
285
|
}
|
|
151
286
|
}
|
|
152
287
|
}
|
|
153
288
|
```
|
|
154
289
|
|
|
155
|
-
|
|
290
|
+
### HTTP security gateway
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
mcp-guard http \
|
|
294
|
+
-u http://internal-mcp:8080/mcp \
|
|
295
|
+
-p 9090 -H 0.0.0.0 \
|
|
296
|
+
-c /etc/mcp-guard/policy.yaml
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Custom policy with selective rules
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
mcp-guard -c my-policy.yaml -- npx @some/mcp-server
|
|
303
|
+
```
|
|
156
304
|
|
|
157
305
|
---
|
|
158
306
|
|
|
159
|
-
##
|
|
307
|
+
## Understanding Logs
|
|
308
|
+
|
|
309
|
+
All logs are written to **stderr** in JSON format. stdout is reserved for MCP JSON-RPC communication.
|
|
310
|
+
|
|
311
|
+
### Startup
|
|
312
|
+
|
|
313
|
+
```json
|
|
314
|
+
{"ts":"...","level":"info","msg":"mcp-guard starting","rules":["tool-poisoning","argument-injection","data-exfiltration"],"failMode":"closed"}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Blocked
|
|
318
|
+
|
|
319
|
+
```json
|
|
320
|
+
{"ts":"...","level":"warn","msg":"BLOCKED server->client","rule":"tool-poisoning","severity":"critical","reason":"Tool \"search\": Zero-width characters detected in description"}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Warning
|
|
324
|
+
|
|
325
|
+
```json
|
|
326
|
+
{"ts":"...","level":"warn","msg":"WARNING server->client","rule":"data-exfiltration","severity":"critical","reason":"Sensitive Data Exposure in tool response (CWE-200)"}
|
|
327
|
+
```
|
|
160
328
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
| **YAML 정책** | 룰별 활성화/비활성화, 심각도 조정, 차단/경고 세밀 제어 |
|
|
167
|
-
| **Dry-Run** | 차단 없이 관찰 모드. 새 MCP 서버 안전 테스트 |
|
|
329
|
+
### Dry-Run
|
|
330
|
+
|
|
331
|
+
```json
|
|
332
|
+
{"ts":"...","level":"warn","msg":"DRY-RUN WOULD BLOCK client->server","rule":"argument-injection","severity":"critical","reason":"SQL Injection detected (CWE-89)"}
|
|
333
|
+
```
|
|
168
334
|
|
|
169
335
|
---
|
|
170
336
|
|
|
171
|
-
##
|
|
337
|
+
## Troubleshooting
|
|
172
338
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
339
|
+
**"Failed to spawn MCP server"**
|
|
340
|
+
— Verify the command after `--` runs independently: `npx @some/mcp-server`
|
|
341
|
+
|
|
342
|
+
**Legitimate tools being blocked**
|
|
343
|
+
1. Run with `--dry-run --verbose` to identify which rule triggers
|
|
344
|
+
2. Disable the specific check in a policy file, or change the rule action to `warn`
|
|
345
|
+
|
|
346
|
+
**No logs visible**
|
|
347
|
+
— Logs go to stderr. Redirect: `mcp-guard --verbose -- ... 2>/tmp/guard.log`
|
|
348
|
+
|
|
349
|
+
**HTTP "Upstream connection failed"**
|
|
350
|
+
— Verify upstream is reachable: `curl -v http://mcp-server:8080/mcp`
|
|
351
|
+
|
|
352
|
+
**SSE stream disconnecting**
|
|
353
|
+
— If behind nginx, disable buffering:
|
|
354
|
+
```nginx
|
|
355
|
+
proxy_buffering off;
|
|
356
|
+
proxy_cache off;
|
|
357
|
+
```
|
|
184
358
|
|
|
185
359
|
---
|
|
186
360
|
|
|
187
|
-
##
|
|
361
|
+
## FAQ
|
|
362
|
+
|
|
363
|
+
**Does it affect MCP communication speed?**
|
|
364
|
+
Barely. Synchronous pattern matching adds microsecond-level latency per message.
|
|
365
|
+
|
|
366
|
+
**Can I use it without a policy file?**
|
|
367
|
+
Yes. Built-in defaults apply: tool-poisoning (block), argument-injection (block), data-exfiltration (warn).
|
|
368
|
+
|
|
369
|
+
**What is fail-close?**
|
|
370
|
+
If the policy engine itself errors, all traffic is blocked for safety. Use `--fail-open` to override (not recommended).
|
|
371
|
+
|
|
372
|
+
**Does it work on Windows?**
|
|
373
|
+
Yes. Uses `cross-spawn` for Windows compatibility.
|
|
374
|
+
|
|
375
|
+
**Does it support HTTP/SSE MCP servers?**
|
|
376
|
+
Yes. Both Streamable HTTP and Legacy HTTP+SSE are supported since v0.2.0.
|
|
188
377
|
|
|
189
|
-
|
|
190
|
-
|
|
378
|
+
**How is authentication handled in HTTP mode?**
|
|
379
|
+
`Authorization` headers are forwarded to upstream as-is. MCP Guard does not store or modify tokens.
|
|
191
380
|
|
|
192
381
|
---
|
|
193
382
|
|
|
194
|
-
##
|
|
383
|
+
## Technical Specifications
|
|
195
384
|
|
|
196
|
-
|
|
|
197
|
-
|
|
198
|
-
|
|
|
199
|
-
|
|
|
385
|
+
| Spec | Details |
|
|
386
|
+
|------|---------|
|
|
387
|
+
| Language | TypeScript (strict mode, ESM-only) |
|
|
388
|
+
| Runtime | Node.js 20+ |
|
|
389
|
+
| Bundle Size | ~60KB (single file) |
|
|
390
|
+
| Dependencies | 3 (commander, cross-spawn, yaml) |
|
|
391
|
+
| Transport | stdio + HTTP (Streamable HTTP, Legacy SSE) |
|
|
392
|
+
| Security Rules | 3 engines, 7 detector modules |
|
|
393
|
+
| Injection Patterns | 21+ fuzz patterns, 33+ prompt injection phrases (EN/KO/ZH/JA) |
|
|
394
|
+
| CWE Coverage | CWE-22, CWE-78, CWE-79, CWE-89, CWE-94, CWE-200, CWE-209 |
|
|
395
|
+
| OS | macOS, Linux, Windows |
|
|
200
396
|
|
|
201
397
|
---
|
|
202
398
|
|
|
203
|
-
##
|
|
399
|
+
## Related
|
|
400
|
+
|
|
401
|
+
- **[AIclude ASVS](https://vs.aiclude.com)** — AI Agent Security Vulnerability Scanner platform
|
|
402
|
+
- **[OWASP MCP Top 10](https://owasp.org/www-project-mcp-top-10/)** — MCP security threat classification
|
|
403
|
+
|
|
404
|
+
---
|
|
204
405
|
|
|
205
|
-
|
|
406
|
+
## License
|
|
206
407
|
|
|
207
|
-
|
|
408
|
+
Apache License 2.0 — see [LICENSE](LICENSE) for details.
|
|
208
409
|
|
|
209
|
-
Copyright
|
|
410
|
+
Copyright 2026 AIclude Inc.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiclude/mcp-guard",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "MCP runtime security proxy — intercepts and enforces security policies on MCP tool calls",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,9 +25,10 @@
|
|
|
25
25
|
],
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"author": "AIclude <dev@aiclude.com>",
|
|
28
|
+
"homepage": "https://vs.aiclude.com/mcp-guard",
|
|
28
29
|
"repository": {
|
|
29
30
|
"type": "git",
|
|
30
|
-
"url": "https://github.com/
|
|
31
|
+
"url": "https://github.com/mastergear4824/mcp-guard"
|
|
31
32
|
},
|
|
32
33
|
"engines": {
|
|
33
34
|
"node": ">=20.0.0"
|
|
@@ -38,7 +39,7 @@
|
|
|
38
39
|
"files": [
|
|
39
40
|
"dist",
|
|
40
41
|
"README.md",
|
|
41
|
-
"LICENSE
|
|
42
|
+
"LICENSE"
|
|
42
43
|
],
|
|
43
44
|
"scripts": {
|
|
44
45
|
"build": "tsup src/index.ts --format esm --dts --shims",
|
package/LICENSE.md
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# AICLUDE Proprietary License
|
|
2
|
-
|
|
3
|
-
**Version 1.0 — Effective Date: January 1, 2026**
|
|
4
|
-
|
|
5
|
-
Copyright © 2026 AIclude Inc. All rights reserved.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## 1. 정의
|
|
10
|
-
|
|
11
|
-
- **"소프트웨어"** 란 MCP Guard의 소스 코드, 바이너리, 문서, 관련 파일 일체를 의미합니다.
|
|
12
|
-
- **"라이선서"** 란 AIclude Inc.를 의미합니다.
|
|
13
|
-
- **"라이선시"** 란 본 라이선스에 동의하고 소프트웨어를 사용하는 개인 또는 법인을 의미합니다.
|
|
14
|
-
|
|
15
|
-
## 2. 라이선스 부여
|
|
16
|
-
|
|
17
|
-
라이선서는 라이선시에게 다음 조건 하에 소프트웨어의 비독점적, 양도 불가능한, 제한적 사용 권한을 부여합니다.
|
|
18
|
-
|
|
19
|
-
### 2.1 허용되는 사용
|
|
20
|
-
|
|
21
|
-
- **평가 목적**: 비상업적 환경에서 소프트웨어의 기능을 평가하기 위한 사용
|
|
22
|
-
- **허가된 상업적 사용**: 라이선서와 별도의 상업적 라이선스 계약을 체결한 경우에 한하여 상업적 목적으로 사용 가능
|
|
23
|
-
|
|
24
|
-
### 2.2 금지되는 행위
|
|
25
|
-
|
|
26
|
-
명시적 서면 허가 없이 다음 행위는 엄격히 금지됩니다:
|
|
27
|
-
|
|
28
|
-
- 소프트웨어의 전부 또는 일부를 **복제, 수정, 병합, 배포, 재라이선스, 판매**하는 행위
|
|
29
|
-
- 소프트웨어를 기반으로 **파생 저작물**을 작성하는 행위
|
|
30
|
-
- 소프트웨어의 **역컴파일, 역어셈블, 리버스 엔지니어링** 행위
|
|
31
|
-
- 소프트웨어를 **제3자에게 서브라이선스**하는 행위
|
|
32
|
-
- 본 라이선스의 저작권 표시, 상표, 또는 기타 권리 고지를 **제거하거나 변경**하는 행위
|
|
33
|
-
|
|
34
|
-
## 3. 지적 재산권
|
|
35
|
-
|
|
36
|
-
소프트웨어에 대한 모든 지적 재산권(저작권, 특허, 상표, 영업비밀 포함)은 라이선서에게 독점적으로 귀속됩니다. 본 라이선스는 라이선시에게 소프트웨어에 대한 소유권을 부여하지 않습니다.
|
|
37
|
-
|
|
38
|
-
## 4. 보증 부인
|
|
39
|
-
|
|
40
|
-
소프트웨어는 **"있는 그대로(AS-IS)"** 제공되며, 상품성, 특정 목적에의 적합성, 비침해에 대한 보증을 포함하여 명시적이든 묵시적이든 어떠한 종류의 보증도 제공하지 않습니다.
|
|
41
|
-
|
|
42
|
-
## 5. 책임 제한
|
|
43
|
-
|
|
44
|
-
어떠한 경우에도 라이선서는 소프트웨어의 사용 또는 사용 불능으로 인해 발생하는 직접적, 간접적, 우발적, 특수적, 징벌적 또는 결과적 손해에 대하여 책임을 지지 않습니다.
|
|
45
|
-
|
|
46
|
-
## 6. 라이선스 종료
|
|
47
|
-
|
|
48
|
-
- 라이선시가 본 라이선스의 조건을 위반할 경우, 라이선스는 자동으로 종료됩니다.
|
|
49
|
-
- 라이선스 종료 시, 라이선시는 소프트웨어의 모든 사본을 즉시 삭제해야 합니다.
|
|
50
|
-
|
|
51
|
-
## 7. 준거법
|
|
52
|
-
|
|
53
|
-
본 라이선스는 대한민국 법률에 의해 규율되며, 관련 분쟁은 서울중앙지방법원을 전속 관할 법원으로 합니다.
|
|
54
|
-
|
|
55
|
-
## 8. 상업적 라이선스
|
|
56
|
-
|
|
57
|
-
상업적 사용을 위한 라이선스 문의: **license@aiclude.com**
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
**AIclude Inc.**
|
|
62
|
-
서울특별시 강남구 | https://aiclude.com
|
|
63
|
-
|
|
64
|
-
> [← README로 돌아가기](README.md)
|