@aiclude/mcp-guard 0.2.0 → 0.2.2

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.
Files changed (4) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +319 -127
  3. package/package.json +4 -3
  4. 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,401 @@
1
- <p align="center">
2
- <img src="https://aiclude.com/assets/mcp-guard-logo.svg" alt="MCP Guard" width="120" />
3
- </p>
1
+ # MCP Guard
4
2
 
5
- <h1 align="center">MCP Guard</h1>
3
+ **Real-time security firewall for AI agents**
6
4
 
7
- <p align="center">
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
- <p align="center">
13
- <a href="#왜-mcp-guard인가">왜 필요한가</a> ·
14
- <a href="#핵심-기능">핵심 기능</a> ·
15
- <a href="#빠른-시작">빠른 시작</a> ·
16
- <a href="USAGE.md">사용 가이드</a> ·
17
- <a href="LICENSE.md">라이선스</a>
18
- </p>
7
+ [![npm version](https://img.shields.io/npm/v/@aiclude/mcp-guard.svg)](https://www.npmjs.com/package/@aiclude/mcp-guard)
8
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
19
9
 
20
10
  ---
21
11
 
22
- ## MCP Guard인가?
12
+ ## Why MCP Guard?
23
13
 
24
- AI 에이전트 시대, **MCP(Model Context Protocol)** 사실상의 표준이 되었습니다. Claude, Cursor, Copilot 주요 AI 도구가 MCP 통해 외부 시스템과 연동합니다.
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
- **그러나 MCP 통신은 무방비 상태입니다.**
16
+ **But MCP communication is unprotected.**
27
17
 
28
- - 2026년 1~2월, MCP 관련 CVE **30건 이상** 발생
29
- - MCP 플러그인 10개만 설치해도 **92%의 익스플로잇 확률** (VentureBeat)
30
- - **OWASP MCP Top 10** 발표 — Tool Poisoning, Prompt Injection, Context Spoofing 실제 공격 확인
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
- 기존 보안 도구(WAF, SAST, DAST) MCP 프로토콜 레벨에서 동작하지 않습니다. HTTP 요청이 아닌 **JSON-RPC 메시지 스트림** 위에서 벌어지는 공격은 기존 도구로 탐지할 없습니다.
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**는 MCP 클라이언트와 서버 사이에 인라인으로 위치하여, 모든 메시지를 실시간으로 검사하고 위험한 도구 호출을 **서버에 도달하기 전에 차단**합니다.
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
- MCP 클라이언트 → 서버, 서버 → 클라이언트 **양방향 모든 메시지**를 실시간으로 검사합니다. 단순한 사후 분석이 아닌, 위험이 실행되기 전에 차단하는 **인라인 보안 프록시**입니다.
32
+ ```bash
33
+ npm install -g @aiclude/mcp-guard
34
+ ```
43
35
 
44
- ### 3대 보안 엔진
36
+ ### stdio mode Protect a local MCP server
45
37
 
46
- | 보안 룰 | 검사 대상 | 대응 위협 |
47
- |---------|----------|----------|
48
- | **Tool Poisoning Detection** | 서버가 노출하는 도구 목록 | 제로폭 스테가노그래피, 프롬프트 인젝션, 도구명 사칭, 호모글리프 위장 |
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
49
+
50
+ Add to your `claude_desktop_config.json`:
51
+
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
+ ```
57
62
 
58
- | 모드 | 용도 | 대상 |
59
- |------|------|------|
60
- | **stdio** | 로컬 MCP 서버 프로세스 래핑 | Claude Desktop, Cursor 등 |
61
- | **HTTP** | 원격 MCP 서버 리버스 프록시 | Streamable HTTP + Legacy SSE |
63
+ ### Cursor IDE Integration
62
64
 
63
- ### 제로 설정, 즉시 보호
65
+ Add to `.cursor/mcp.json`:
64
66
 
65
- 정책 파일 없이도 빌트인 기본 정책으로 즉시 보호를 시작합니다. 필요 시 YAML 정책 파일로 세부 조정이 가능합니다.
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
- │ MCP Guard 보호 범위 │
74
- ├─────────────────────┬───────────────────────┬───────────────────────┤
75
- │ 도구 정의 검사 │ 도구 호출 검사 │ 도구 응답 검사 │
76
- │ (server client) │ (client server) │ (server client) │
77
- ├─────────────────────┼───────────────────────┼───────────────────────┤
78
- │ ✓ 제로폭 스테가노그래피 │ ✓ SQL Injection │ ✓ 민감 데이터 노출 │
79
- 프롬프트 인젝션 │ ✓ Command Injection │ ✓ 시스템 경로 유출 │
80
- │ ✓ 호모글리프 위장 │ ✓ Path Traversal │ ✓ 스택 트레이스 노출 │
81
- HTML 주석 은닉 │ XSS │ 명령어 실행 증거 │
82
- │ ✓ Base64 인코딩 은닉 │ ✓ Template Injection │ ✓ 템플릿 인젝션 결과 │
83
- 도구명 사칭 │ ✓ 프롬프트 인젝션 │ ✓ 자격 증명 유출 │
84
- │ ✓ 다국어 인젝션 │ ✓ 다국어 인젝션 │ │
85
- 에이전트 조작 패턴 │ 제로폭 문자 은닉 │ │
86
- │ ✓ InputSchema 검사 │ │ │
87
- ├─────────────────────┴───────────────────────┴───────────────────────┤
88
- │ CWE: CWE-22, CWE-78, CWE-79, CWE-89, CWE-94, CWE-200, CWE-209 │
89
- │ OWASP MCP Top 10: Tool Poisoning, Prompt Injection 등 다수 대응 │
90
- └─────────────────────────────────────────────────────────────────────┘
91
- ```
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.
92
104
 
93
105
  ---
94
106
 
95
- ## 동작 원리
107
+ ## Protection Coverage
108
+
109
+ | Tool Definitions (server → client) | Tool Call Arguments (client → server) | Tool Responses (server → client) |
110
+ |:-----------------------------------|:--------------------------------------|:---------------------------------|
111
+ | Zero-width steganography | SQL Injection | Credential exposure |
112
+ | Prompt injection phrases | Command Injection | System path leaks |
113
+ | Homoglyph spoofing | Path Traversal | Stack trace exposure |
114
+ | HTML comment hiding | XSS | Command exec evidence |
115
+ | Base64 encoding hiding | Template Injection | Template injection results |
116
+ | Name shadowing | Prompt injection | Credential leaks |
117
+ | Multilingual injection | Multilingual injection | |
118
+ | Agent manipulation patterns | Zero-width char hiding | |
119
+ | InputSchema validation | | |
120
+
121
+ **CWE Coverage:** CWE-22, CWE-78, CWE-79, CWE-89, CWE-94, CWE-200, CWE-209
122
+
123
+ **OWASP MCP Top 10:** Tool Poisoning, Prompt Injection, and more
124
+
125
+ ---
126
+
127
+ ## How It Works
128
+
129
+ MCP Guard operates as a **transparent proxy** between client and server.
130
+
131
+ ### stdio Mode
132
+
133
+ > **MCP Client** → *stdio* → **MCP Guard (Proxy)** → *stdio* → **MCP Server (Local)**
134
+ >
135
+ > All messages pass through the **Rule Engine** for real-time inspection.
96
136
 
97
- MCP Guard는 클라이언트와 서버 사이에서 **투명 프록시**로 동작합니다.
137
+ ### HTTP Mode
98
138
 
99
- ### stdio 모드 로컬 MCP 서버
139
+ > **MCP Client** *HTTP POST* → **MCP Guard (:9090)** → *HTTP POST* → **MCP Server (Remote)**
140
+ >
141
+ > Responses (JSON or SSE stream) are inspected before forwarding back to the client.
100
142
 
143
+ **Default behavior: Fail-Close.** If the policy engine errors, all traffic is blocked for safety.
144
+
145
+ ---
146
+
147
+ ## CLI Reference
148
+
149
+ ### stdio mode (default)
150
+
151
+ ```bash
152
+ mcp-guard [options] -- <server-command> [server-args...]
101
153
  ```
102
- ┌──────────────┐ stdio ┌──────────────┐ stdio ┌──────────────┐
103
- │ MCP Client │ ────────────→ │ MCP Guard │ ────────────→ │ MCP Server │
104
- │ (Claude 등) │ ←──────────── │ (Proxy) │ ←──────────── │ (로컬) │
105
- └──────────────┘ └──────┬───────┘ └──────────────┘
106
-
107
- ┌──────┴───────┐
108
- │ Rule Engine
109
- └──────────────┘
154
+
155
+ | Option | Short | Description | Default |
156
+ |--------|-------|-------------|---------|
157
+ | `--config <path>` | `-c` | YAML policy file path | Built-in defaults |
158
+ | `--verbose` | `-v` | Enable debug-level logging | `false` |
159
+ | `--fail-open` | | Allow traffic on policy engine error (not recommended) | `false` |
160
+ | `--dry-run` | | Log violations without blocking | `false` |
161
+ | `--version` | `-V` | Print version | |
162
+ | `--help` | `-h` | Print help | |
163
+
164
+ ### HTTP mode
165
+
166
+ ```bash
167
+ mcp-guard http [options] --upstream <url>
110
168
  ```
111
169
 
112
- ### HTTP 모드 원격 MCP 서버
170
+ | Option | Short | Description | Default |
171
+ |--------|-------|-------------|---------|
172
+ | `--upstream <url>` | `-u` | Upstream MCP server URL **(required)** | |
173
+ | `--port <number>` | `-p` | Listen port | `9090` |
174
+ | `--host <host>` | `-H` | Bind host | `127.0.0.1` |
175
+ | `--config <path>` | `-c` | YAML policy file path | Built-in defaults |
176
+ | `--verbose` | `-v` | Enable debug-level logging | `false` |
177
+ | `--fail-open` | | Allow traffic on policy engine error | `false` |
178
+ | `--dry-run` | | Log violations without blocking | `false` |
179
+
180
+ ---
181
+
182
+ ## Policy File
183
+
184
+ Policy files are written in YAML. Without a policy file, built-in defaults apply.
185
+
186
+ ### Basic Structure
113
187
 
188
+ ```yaml
189
+ version: 1
190
+ failMode: closed # closed (recommended) | open
191
+
192
+ logging:
193
+ level: info # debug | info | warn | error
194
+ destination: stderr
195
+
196
+ rules:
197
+ - id: tool-poisoning
198
+ enabled: true
199
+ severity: critical
200
+ action: block # block | warn
201
+ type: tool-poisoning
202
+
203
+ - id: argument-injection
204
+ enabled: true
205
+ severity: critical
206
+ action: block
207
+ type: argument-injection
208
+
209
+ - id: data-exfiltration
210
+ enabled: true
211
+ severity: high
212
+ action: warn # warn recommended — blocking may break normal flow
213
+ type: data-exfiltration
114
214
  ```
115
- ┌──────────────┐ HTTP POST ┌──────────────┐ HTTP POST ┌──────────────┐
116
- │ MCP Client │ ────────────→ │ MCP Guard │ ────────────→ │ MCP Server │
117
- │ │ ←──SSE/JSON── │ (:9090) │ ←──SSE/JSON── │ (원격) │
118
- └──────────────┘ └──────┬───────┘ └──────────────┘
119
-
120
- ┌──────┴───────┐
121
- Rule Engine │
122
- └──────────────┘
215
+
216
+ ### Tool Poisoning Config
217
+
218
+ ```yaml
219
+ config:
220
+ checkZeroWidth: true
221
+ checkInjectionPhrases: true
222
+ checkHtmlComments: true
223
+ checkBase64: true
224
+ checkShadowing: true
225
+ checkInstructionPatterns: true
226
+ maxDescriptionLength: 5000
227
+ ```
228
+
229
+ ### Argument Injection Config
230
+
231
+ ```yaml
232
+ config:
233
+ checkPromptInjection: true
123
234
  ```
124
235
 
125
- **기본 동작: Fail-Close.** 정책 엔진에 오류가 발생하면 안전을 위해 모든 트래픽을 차단합니다.
236
+ SQL, Command, Path Traversal, XSS, and Template Injection checks are always active.
237
+
238
+ ### Data Exfiltration Config
239
+
240
+ ```yaml
241
+ config:
242
+ checkCredentials: true
243
+ checkPathExposure: true
244
+ checkStackTraces: true
245
+ ```
126
246
 
127
247
  ---
128
248
 
129
- ## 빠른 시작
249
+ ## Usage Scenarios
250
+
251
+ ### Evaluate a new MCP server safely
130
252
 
131
253
  ```bash
132
- # 설치
133
- npm install -g mcp-guard
254
+ # Step 1: Dry-run to observe
255
+ mcp-guard --dry-run --verbose -- npx @unknown/mcp-server 2>guard.log
134
256
 
135
- # stdio 모드: 로컬 MCP 서버 보호
136
- mcp-guard -- npx @modelcontextprotocol/server-fetch
257
+ # Step 2: Review findings
258
+ cat guard.log | grep "DRY-RUN"
137
259
 
138
- # HTTP 모드: 원격 MCP 서버 보호
139
- mcp-guard http --upstream http://mcp-server:8080/mcp --port 9090
260
+ # Step 3: Enable blocking if clean
261
+ mcp-guard -- npx @unknown/mcp-server
140
262
  ```
141
263
 
142
- ### Claude Desktop 연동
264
+ ### Protect multiple servers in Claude Desktop
143
265
 
144
266
  ```json
145
267
  {
146
268
  "mcpServers": {
147
269
  "fetch-guarded": {
148
270
  "command": "npx",
149
- "args": ["-y", "mcp-guard", "--", "npx", "-y", "@modelcontextprotocol/server-fetch"]
271
+ "args": ["-y", "@aiclude/mcp-guard", "--", "npx", "-y", "@modelcontextprotocol/server-fetch"]
272
+ },
273
+ "github-guarded": {
274
+ "command": "npx",
275
+ "args": ["-y", "@aiclude/mcp-guard", "--", "npx", "-y", "@modelcontextprotocol/server-github"]
150
276
  }
151
277
  }
152
278
  }
153
279
  ```
154
280
 
155
- > 자세한 설치, 설정, 정책 작성법은 **[사용 가이드(USAGE.md)](USAGE.md)** 를 참고하세요.
281
+ ### HTTP security gateway
282
+
283
+ ```bash
284
+ mcp-guard http \
285
+ -u http://internal-mcp:8080/mcp \
286
+ -p 9090 -H 0.0.0.0 \
287
+ -c /etc/mcp-guard/policy.yaml
288
+ ```
289
+
290
+ ### Custom policy with selective rules
291
+
292
+ ```bash
293
+ mcp-guard -c my-policy.yaml -- npx @some/mcp-server
294
+ ```
156
295
 
157
296
  ---
158
297
 
159
- ## 제품 특장점
298
+ ## Understanding Logs
299
+
300
+ All logs are written to **stderr** in JSON format. stdout is reserved for MCP JSON-RPC communication.
160
301
 
161
- | 특장점 | 설명 |
162
- |--------|------|
163
- | **마이크로초 검사** | 동기적 패턴 매칭으로 메시지당 마이크로초 수준 지연. 사용자 경험 영향 없음 |
164
- | **46KB 초경량** | 의존성 3개, 단일 파일 번들. 공급망 공격 표면 최소화 |
165
- | **Node.js 단독** | 별도 데몬/컨테이너 불필요. 어디서나 즉시 배포 |
166
- | **YAML 정책** | 룰별 활성화/비활성화, 심각도 조정, 차단/경고 세밀 제어 |
167
- | **Dry-Run** | 차단 없이 관찰 모드. 새 MCP 서버 안전 테스트 |
302
+ ### Startup
303
+
304
+ ```json
305
+ {"ts":"...","level":"info","msg":"mcp-guard starting","rules":["tool-poisoning","argument-injection","data-exfiltration"],"failMode":"closed"}
306
+ ```
307
+
308
+ ### Blocked
309
+
310
+ ```json
311
+ {"ts":"...","level":"warn","msg":"BLOCKED server->client","rule":"tool-poisoning","severity":"critical","reason":"Tool \"search\": Zero-width characters detected in description"}
312
+ ```
313
+
314
+ ### Warning
315
+
316
+ ```json
317
+ {"ts":"...","level":"warn","msg":"WARNING server->client","rule":"data-exfiltration","severity":"critical","reason":"Sensitive Data Exposure in tool response (CWE-200)"}
318
+ ```
319
+
320
+ ### Dry-Run
321
+
322
+ ```json
323
+ {"ts":"...","level":"warn","msg":"DRY-RUN WOULD BLOCK client->server","rule":"argument-injection","severity":"critical","reason":"SQL Injection detected (CWE-89)"}
324
+ ```
168
325
 
169
326
  ---
170
327
 
171
- ## 기술 사양
328
+ ## Troubleshooting
172
329
 
173
- | 항목 | 내용 |
174
- |------|------|
175
- | Language | TypeScript (strict mode, ESM-only) |
176
- | Runtime | Node.js 20+ |
177
- | Bundle Size | 46KB (단일 파일) |
178
- | Dependencies | 3개 |
179
- | Transport | stdio + HTTP (Streamable HTTP, Legacy SSE) |
180
- | 보안 룰 | 3종, 탐지기 7개 모듈 |
181
- | 인젝션 패턴 | 21개+, 프롬프트 인젝션 구절 33개+ (영/한/중/일) |
182
- | CWE 커버리지 | 7개 (CWE-22, 78, 79, 89, 94, 200, 209) |
183
- | OS | macOS, Linux, Windows |
330
+ **"Failed to spawn MCP server"**
331
+ — Verify the command after `--` runs independently: `npx @some/mcp-server`
332
+
333
+ **Legitimate tools being blocked**
334
+ 1. Run with `--dry-run --verbose` to identify which rule triggers
335
+ 2. Disable the specific check in a policy file, or change the rule action to `warn`
336
+
337
+ **No logs visible**
338
+ Logs go to stderr. Redirect: `mcp-guard --verbose -- ... 2>/tmp/guard.log`
339
+
340
+ **HTTP "Upstream connection failed"**
341
+ — Verify upstream is reachable: `curl -v http://mcp-server:8080/mcp`
342
+
343
+ **SSE stream disconnecting**
344
+ — If behind nginx, disable buffering:
345
+ ```nginx
346
+ proxy_buffering off;
347
+ proxy_cache off;
348
+ ```
184
349
 
185
350
  ---
186
351
 
187
- ## 관련 프로젝트
352
+ ## FAQ
353
+
354
+ **Does it affect MCP communication speed?**
355
+ Barely. Synchronous pattern matching adds microsecond-level latency per message.
356
+
357
+ **Can I use it without a policy file?**
358
+ Yes. Built-in defaults apply: tool-poisoning (block), argument-injection (block), data-exfiltration (warn).
359
+
360
+ **What is fail-close?**
361
+ If the policy engine itself errors, all traffic is blocked for safety. Use `--fail-open` to override (not recommended).
362
+
363
+ **Does it work on Windows?**
364
+ Yes. Uses `cross-spawn` for Windows compatibility.
365
+
366
+ **Does it support HTTP/SSE MCP servers?**
367
+ Yes. Both Streamable HTTP and Legacy HTTP+SSE are supported since v0.2.0.
188
368
 
189
- - **[AIclude ASVS](https://vs.aiclude.com)** AI Agent 보안 취약점 종합 진단 플랫폼
190
- - **[OWASP MCP Top 10](https://owasp.org/www-project-mcp-top-10/)** MCP 보안 위협 분류 체계
369
+ **How is authentication handled in HTTP mode?**
370
+ `Authorization` headers are forwarded to upstream as-is. MCP Guard does not store or modify tokens.
191
371
 
192
372
  ---
193
373
 
194
- ## 문서
374
+ ## Technical Specifications
195
375
 
196
- | 문서 | 내용 |
197
- |------|------|
198
- | **[사용 가이드 (USAGE.md)](USAGE.md)** | 설치, 설정, CLI 옵션, 정책 작성법, 연동 가이드, FAQ |
199
- | **[라이선스 (LICENSE.md)](LICENSE.md)** | AICLUDE Proprietary License |
376
+ | Spec | Details |
377
+ |------|---------|
378
+ | Language | TypeScript (strict mode, ESM-only) |
379
+ | Runtime | Node.js 20+ |
380
+ | Bundle Size | ~60KB (single file) |
381
+ | Dependencies | 3 (commander, cross-spawn, yaml) |
382
+ | Transport | stdio + HTTP (Streamable HTTP, Legacy SSE) |
383
+ | Security Rules | 3 engines, 7 detector modules |
384
+ | Injection Patterns | 21+ fuzz patterns, 33+ prompt injection phrases (EN/KO/ZH/JA) |
385
+ | CWE Coverage | CWE-22, CWE-78, CWE-79, CWE-89, CWE-94, CWE-200, CWE-209 |
386
+ | OS | macOS, Linux, Windows |
200
387
 
201
388
  ---
202
389
 
203
- ## 라이선스
390
+ ## Related
391
+
392
+ - **[AIclude ASVS](https://vs.aiclude.com)** — AI Agent Security Vulnerability Scanner platform
393
+ - **[OWASP MCP Top 10](https://owasp.org/www-project-mcp-top-10/)** — MCP security threat classification
394
+
395
+ ---
204
396
 
205
- MCP Guard는 **AICLUDE Proprietary License**에 의해 보호됩니다. AIclude Inc.의 명시적 서면 허가 없이 복제, 수정, 배포, 상업적 사용이 금지됩니다.
397
+ ## License
206
398
 
207
- 자세한 내용은 [LICENSE.md](LICENSE.md) 참고하세요.
399
+ Apache License 2.0 — see [LICENSE](LICENSE) for details.
208
400
 
209
- Copyright © 2026 AIclude Inc. All rights reserved.
401
+ Copyright 2026 AIclude Inc.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiclude/mcp-guard",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
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/aiclude/mcp-guard"
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.md"
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)