@anma-labs/mcpgaze 1.0.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 +202 -0
- package/README.md +298 -0
- package/dist/index.js +2148 -0
- package/native/mcpgaze-proxy/Cargo.toml +15 -0
- package/native/mcpgaze-proxy/src/main.rs +445 -0
- package/package.json +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 ANMA Labs LLC
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# mcpgaze
|
|
4
|
+
|
|
5
|
+
**A transparent wiretap for MCP servers.**
|
|
6
|
+
See exactly what your AI client sends your server — without breaking the protocol — and catch tool-schema drift before it ships.
|
|
7
|
+
|
|
8
|
+
[](./LICENSE)
|
|
9
|
+
[](https://nodejs.org)
|
|
10
|
+
[](#zero-dependencies-by-design)
|
|
11
|
+
[](https://modelcontextprotocol.io/specification)
|
|
12
|
+
[](./CONTRIBUTING.md)
|
|
13
|
+
|
|
14
|
+
[Quickstart](#quickstart) · [Why mcpgaze](#why-mcpgaze) · [Commands](#commands) · [Docs](./docs) · [Security](./SECURITY.md) · [Contributing](./CONTRIBUTING.md)
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
An MCP server's **stdout *is* the protocol wire** — so a single stray `console.log` corrupts every message, and the logs you actually wanted vanish into the void. `mcpgaze` sits transparently between your client and your server, forwarding every byte **untouched** while logging the whole JSON-RPC conversation through a side channel.
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
BEFORE AFTER
|
|
24
|
+
client ⇄ server client ⇄ [ mcpgaze ] ⇄ server
|
|
25
|
+
│ side channel (never stdout)
|
|
26
|
+
▼ log file · latencies · drift
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
On top of that live wiretap it adds schema-drift detection for CI, multi-version spec conformance, behavioral (response-shape) drift checks, record/replay, health monitoring, and failure triage — eleven commands, **zero runtime dependencies**, Apache-2.0.
|
|
30
|
+
|
|
31
|
+
> Context: a 2025 academic crawl of ~17.6k MCP registry entries ([arXiv:2509.25292](https://arxiv.org/abs/2509.25292)) found more than half invalid or low-value — i.e. abandoned or broken-on-install, not live downtime. The MCP ecosystem is young and brittle; `mcpgaze` is the instrument that tells you which half you're running.
|
|
32
|
+
|
|
33
|
+
## Quickstart
|
|
34
|
+
|
|
35
|
+
`mcpgaze` isn't published to npm yet, so build it from source (zero runtime deps, ~5 seconds):
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
git clone https://github.com/anma-labs/mcpgaze && cd mcpgaze
|
|
39
|
+
npm install && npm run build
|
|
40
|
+
node dist/index.js --help
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
> Once published, this becomes `npx @anma-labs/mcpgaze --help` / `npm i -g @anma-labs/mcpgaze`. Until then, substitute `node /abs/path/to/mcpgaze/dist/index.js` everywhere this README writes `mcpgaze`. See [Getting Started](./docs/getting-started.md) for the full setup, including a `mcpgaze` shell alias.
|
|
44
|
+
|
|
45
|
+
**Watch a live session:**
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
mcpgaze wrap --tui -- node my-server.js # full-screen live dashboard
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Gate CI on tool-schema drift:**
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
mcpgaze snapshot -- node my-server.js # writes mcpgaze.baseline.json (commit it)
|
|
55
|
+
mcpgaze diff --fail-on-drift -- node my-server.js # exit 1 on a breaking change
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
That's the whole loop: **see** what happens live, then **lock** the contract so it can't silently change.
|
|
59
|
+
|
|
60
|
+
## Why mcpgaze
|
|
61
|
+
|
|
62
|
+
Every other MCP debugging tool — the official [Inspector](https://github.com/modelcontextprotocol/inspector), MCPJam — acts **as the client**. It can only exercise a server you point it at, with traffic *it* generates. `mcpgaze` is different: it leaves a tap in place while your **real** client (Claude Desktop, Cursor, …) drives, so you see what actually happened — in development and in production.
|
|
63
|
+
|
|
64
|
+
| | Inspector / MCPJam | **mcpgaze** |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| Role | Acts *as* the client | Sits *between* client and server |
|
|
67
|
+
| Traffic seen | What the tool generates | What your real client actually sends |
|
|
68
|
+
| stdio + Streamable HTTP | ✓ / ✓ | ✓ / ✓ |
|
|
69
|
+
| Captures server stderr | — | ✓ (the logs that normally disappear) |
|
|
70
|
+
| Schema-drift gate for CI | — | ✓ `snapshot` / `diff` |
|
|
71
|
+
| Behavioral drift | — | ✓ `verify` |
|
|
72
|
+
| Record / replay (VCR) | — | ✓ `record` / `replay` |
|
|
73
|
+
| Continuous health | — | ✓ `health` |
|
|
74
|
+
| Runtime dependencies | many | **zero** |
|
|
75
|
+
|
|
76
|
+
### The two invariants
|
|
77
|
+
|
|
78
|
+
`mcpgaze` is engineered around two guarantees, enforced by generative tests (fuzz, differential, dogfood) on every push — not just hand-written cases:
|
|
79
|
+
|
|
80
|
+
- **(A) Wire integrity** — on the forward path, **bytes in == bytes out**. `mcpgaze` parses *copies* off the hot path; the protocol stream is never reconstructed, reordered, or re-encoded.
|
|
81
|
+
- **(B) Observer safety** — the observation/logging path **never throws** into the wire. Adversarial bytes (invalid UTF-8, NULs, multi-MB lines, malformed JSON) can disturb a log line, never the protocol.
|
|
82
|
+
|
|
83
|
+
Everything else in the tool is downstream of these two promises. See [Architecture](./docs/architecture.md) for how they're held.
|
|
84
|
+
|
|
85
|
+
## Commands
|
|
86
|
+
|
|
87
|
+
Eleven commands, one binary. Full reference with every flag, exit code, and example: **[docs/commands.md](./docs/commands.md)**.
|
|
88
|
+
|
|
89
|
+
| Command | What it does |
|
|
90
|
+
|---|---|
|
|
91
|
+
| [`wrap`](./docs/commands.md#wrap) | Transparent stdio proxy; logs the live session to a side channel. `--tui`, `--native`. |
|
|
92
|
+
| [`wrap-http`](./docs/commands.md#wrap-http) | Streamable HTTP proxy (JSON + SSE); localhost-bound, Origin-checked, path-routes many upstreams. |
|
|
93
|
+
| [`snapshot`](./docs/commands.md#snapshot) | Probe the server, write a tool-schema baseline you commit to git. |
|
|
94
|
+
| [`diff`](./docs/commands.md#diff) | Diff the live tool surface against the baseline; gate CI with `--fail-on`. |
|
|
95
|
+
| [`conform`](./docs/commands.md#conform) | Spec-conformance suite across protocol versions. |
|
|
96
|
+
| [`verify`](./docs/commands.md#verify) | Behavioral (response-shape) drift vs a recorded cassette. |
|
|
97
|
+
| [`record`](./docs/commands.md#record) | Wrap a server and write a replayable cassette (secrets redacted by default). |
|
|
98
|
+
| [`replay`](./docs/commands.md#replay) | Deterministic mock MCP server from a cassette — no backend. |
|
|
99
|
+
| [`health`](./docs/commands.md#health) | Continuous uptime/latency/drift monitoring, or `--once` as a liveness probe. |
|
|
100
|
+
| [`triage`](./docs/commands.md#triage) | Surface failures from a session log; optional Claude diagnosis with `--ai`. |
|
|
101
|
+
| [`preflight`](./docs/commands.md#preflight) | Find env vars a GUI client won't inherit; statically check a config's `env` block. |
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
### `wrap` — see the live session
|
|
106
|
+
|
|
107
|
+
Wrap your server command in your client config. For `claude_desktop_config.json` (Cursor and others are analogous):
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"mcpServers": {
|
|
112
|
+
"my-server": {
|
|
113
|
+
"command": "node",
|
|
114
|
+
"args": ["/abs/path/to/mcpgaze/dist/index.js", "wrap", "--", "node", "/abs/path/server.js"]
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Then tail the structured session log, or run standalone with a live view:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
mcpgaze wrap --print -- node server.js # standalone; pretty stream to stderr
|
|
124
|
+
mcpgaze wrap --tui -- node server.js # full-screen dashboard (zero deps, hand-drawn ANSI)
|
|
125
|
+
# every run also writes .mcpgaze/session-<ts>.jsonl
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
You get every JSON-RPC message (both directions), request→response **latency matched by id**, **orphaned requests** that never got a reply, parse errors, and the server's **stderr captured** alongside. The forwarded stream stays byte-exact (invariant A) — an observer error can never disturb the wire (invariant B).
|
|
129
|
+
|
|
130
|
+
→ [`wrap` reference](./docs/commands.md#wrap) · [`--native` Rust hot-path](./docs/commands.md#wrap---native) · [`--tui`](./docs/commands.md#wrap---tui)
|
|
131
|
+
|
|
132
|
+
### `snapshot` + `diff` — catch schema drift in CI
|
|
133
|
+
|
|
134
|
+
Tool schemas change silently between versions — a field flips to `required`, an enum loses a value — and agents break with no error. Treat your tool surface like a lockfile:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
mcpgaze snapshot -- node server.js # writes mcpgaze.baseline.json (commit it)
|
|
138
|
+
mcpgaze diff --fail-on-drift -- node server.js # exit 1 on a breaking change
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
```yaml
|
|
142
|
+
# .github/workflows/mcp.yml
|
|
143
|
+
- run: node dist/index.js diff --fail-on-drift -- node server.js
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Severity model:** removed property · new required property · type change · enum value removed · optional→required = **breaking**; required→optional = **warning**; additive changes = **info**. `--fail-on <breaking|warning|any>` sets the gate; `--update` accepts intentional drift into the baseline.
|
|
147
|
+
|
|
148
|
+
→ [`snapshot` / `diff` reference](./docs/commands.md#snapshot) · [CI recipes](./docs/ci.md)
|
|
149
|
+
|
|
150
|
+
### `conform` — spec conformance across versions
|
|
151
|
+
|
|
152
|
+
Run a conformance suite against your server for one or more protocol versions. Required checks gate CI; recommended checks warn.
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
mcpgaze conform -- node server.js # default spec (2025-06-18)
|
|
156
|
+
mcpgaze conform --spec 2025-11-25 -- node ... # a specific version
|
|
157
|
+
mcpgaze conform --all -- node server.js # 2025-06-18, 2025-11-25, 2026-07-28 (RC)
|
|
158
|
+
mcpgaze conform --json -- node server.js | jq # machine-readable
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Checks include: `initialize` returns a valid result with `protocolVersion` and `serverInfo.name`; `tools/list` returns named tools with object input schemas; `required[]` only names declared properties; and an unknown method returns a proper JSON-RPC error (`-32601`) instead of hanging. Exits 1 if any required check fails.
|
|
162
|
+
|
|
163
|
+
→ [`conform` reference & full check catalog](./docs/commands.md#conform)
|
|
164
|
+
|
|
165
|
+
### `record` + `replay` — VCR for MCP
|
|
166
|
+
|
|
167
|
+
Record a real session into a cassette, then replay it as a deterministic mock server with no backend — for offline client development and regression CI.
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
mcpgaze record --cassette s.json -- node server.js # capture req/res pairs (secrets redacted by default)
|
|
171
|
+
mcpgaze replay --cassette s.json # serve those pairs over stdio
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Replay matches by method + params (exact first, then a unique method-only fallback) and returns a clear JSON-RPC error for anything unrecorded instead of hanging. Cassettes are written `0600`, `*.cassette.json` is git-ignored by default, and `record` **redacts credential-shaped values by default** — review before sharing. See [Security](./SECURITY.md).
|
|
175
|
+
|
|
176
|
+
→ [`record` / `replay` reference](./docs/commands.md#record)
|
|
177
|
+
|
|
178
|
+
### `verify` — behavioral (response-shape) drift
|
|
179
|
+
|
|
180
|
+
`diff` compares *declared* schemas; `verify` catches drift the schema can't see — a server can keep an identical tool schema while its responses change shape (a field disappears, a list goes empty, a type flips). It re-issues a cassette's requests against the live server and diffs the **response shapes**.
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
mcpgaze verify --cassette s.json --fail-on warning --allow-tool-calls -- node server.js
|
|
184
|
+
# WARNING tools/call.results[] — array is now empty (was populated)
|
|
185
|
+
# BREAKING tools/call.total — field removed from response
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
> **Caveat:** `verify` re-executes recorded requests. Only read-only methods are re-issued unless you pass `--allow-tool-calls` — run that against a disposable instance.
|
|
189
|
+
|
|
190
|
+
→ [`verify` reference](./docs/commands.md#verify)
|
|
191
|
+
|
|
192
|
+
### `health` — continuous local monitoring
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
mcpgaze health --interval 30 -- node server.js # daemon: uptime, latency, schema-drift transitions
|
|
196
|
+
mcpgaze health --once -- node server.js # cron/CI liveness probe (exit 0 up / 1 down)
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Probes `initialize` + `tools/list` on an interval, prints up↔down and drift transitions, and persists status to `.mcpgaze/health.json`.
|
|
200
|
+
|
|
201
|
+
→ [`health` reference](./docs/commands.md#health)
|
|
202
|
+
|
|
203
|
+
### `triage` — turn a failed session into a diagnosis
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
mcpgaze triage --log .mcpgaze/session-<ts>.jsonl # local failure summary
|
|
207
|
+
ANTHROPIC_API_KEY=sk-... mcpgaze triage --log s.jsonl --ai --yes # + Claude root-cause & fix
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Surfaces every failure signal — error responses, orphaned requests, parse errors, crash-y stderr — and, with `--ai`, gets a plain-English root cause from Claude. The AI call uses zero extra dependencies (plain `fetch`), **redacts** secrets at the egress boundary, and requires explicit consent (`--yes` or an interactive `y`).
|
|
211
|
+
|
|
212
|
+
→ [`triage` reference](./docs/commands.md#triage)
|
|
213
|
+
|
|
214
|
+
### `preflight` — catch the env vars a GUI client won't inherit
|
|
215
|
+
|
|
216
|
+
GUI apps (Claude Desktop, etc.) do **not** inherit your shell environment, so a server that works in your terminal fails silently in production. `preflight` spawns the server twice — full env vs. the GUI-inherited subset — and names the vars that matter:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
mcpgaze preflight -- node server.js
|
|
220
|
+
mcpgaze preflight --config claude_desktop_config.json --server my-server
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
→ [`preflight` reference](./docs/commands.md#preflight)
|
|
224
|
+
|
|
225
|
+
### `wrap-http` — the Streamable HTTP transport
|
|
226
|
+
|
|
227
|
+
For remote/HTTP MCP servers, `mcpgaze` runs as a localhost-bound proxy that forwards to your upstream and observes both plain JSON and SSE. (For HTTP, the spec gives the client no view of server stderr — so the proxy is your *only* window.)
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
mcpgaze wrap-http --upstream http://localhost:3000/mcp --port 7000
|
|
231
|
+
# point your client at http://127.0.0.1:7000/mcp
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
One proxy can front several upstreams, routed by path prefix (longest match wins):
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
mcpgaze wrap-http --port 7000 \
|
|
238
|
+
--route /github=http://localhost:3001/mcp \
|
|
239
|
+
--route /slack=http://localhost:3002/mcp
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**Security defaults, baked in:** binds to `127.0.0.1` only, and rejects cross-origin browser requests (DNS-rebinding defense — the bug class behind the Inspector's [CVE-2025-49596](https://nvd.nist.gov/vuln/detail/CVE-2025-49596), CVSS 9.4). Multi-route credential scoping strips `Authorization`/`Cookie` unless a route opts in. Full model: [Security](./SECURITY.md) and [`wrap-http` reference](./docs/commands.md#wrap-http).
|
|
243
|
+
|
|
244
|
+
## `--native` — the Rust hot-path
|
|
245
|
+
|
|
246
|
+
A single static binary (`mcpgaze-proxy`, ~450 lines of `std`-only Rust, **no crates**) does the same byte-exact forward + observation as the Node proxy, with no Node runtime required:
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
cd native/mcpgaze-proxy && cargo build --release
|
|
250
|
+
mcpgaze wrap --native -- node server.js # or set MCPGAZE_PROXY_BIN
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
In a 20k-round-trip microbenchmark against a mock server, the Rust proxy runs ~1.7× the Node proxy's throughput and roughly halves added latency. The headline absolute numbers are machine- and runtime-specific and the bench harness isn't committed yet, so treat them as one machine's reading — **the durable result is the relationship**: direct ≫ Rust > Node, all far above any real MCP workload. `--native` earns its place for **single-binary distribution (no Node)** and high-throughput/streaming cases; it stays opt-in.
|
|
254
|
+
|
|
255
|
+
→ [`--native` details, benchmark, and the classifier trade-off](./docs/commands.md#wrap---native)
|
|
256
|
+
|
|
257
|
+
## Zero dependencies by design
|
|
258
|
+
|
|
259
|
+
`package.json` lists **no runtime dependencies** — nothing extra enters your protocol path. The TUI is hand-drawn ANSI, the AI triage call is plain `fetch`, the Rust proxy is `std`-only. Everything in `devDependencies` (TypeScript, tsup, the MCP SDK used only as a test fixture) is build/test-time and never ships in the `dist/` you run.
|
|
260
|
+
|
|
261
|
+
## Testing & hardening
|
|
262
|
+
|
|
263
|
+
Because `mcpgaze` sits in the protocol data path, correctness is enforced by **generative** checks, not just examples:
|
|
264
|
+
|
|
265
|
+
- **Property/fuzz hunt** (`npm run test:fuzz`) — thousands of seeded-random trials assert both invariants: framing is **invariant to chunk boundaries** (a message split at any byte, including mid-multibyte, yields identical results) and the observer **never throws** on adversarial bytes.
|
|
266
|
+
- **Wire-integrity fuzz** (`scripts/wire-integrity.mjs`) — random *binary* payloads forwarded through the proxy come out **byte-identical**.
|
|
267
|
+
- **Differential oracle** (`scripts/diff-proxies.mjs`) — the Node and Rust proxies run identical traffic; their logs must **agree** on every message, keeping the two implementations honest.
|
|
268
|
+
- **Dogfood** (`scripts/dogfood.mjs`) — `replay` is itself an MCP server, so `mcpgaze`'s own **conformance suite runs against it**.
|
|
269
|
+
- **Real-SDK integration** — the suite probes and conforms a genuine `@modelcontextprotocol/sdk` server, plus a 20-cell TS + Python SDK matrix across the full command surface.
|
|
270
|
+
|
|
271
|
+
`npm run harden` runs the differential, wire-integrity, and dogfood workflows together. CI runs typecheck/test/build on Node 18/20/22, builds the Rust proxy, and runs all of the above on every push. See [CONTRIBUTING](./CONTRIBUTING.md#testing) and [Architecture](./docs/architecture.md#how-the-invariants-are-tested).
|
|
272
|
+
|
|
273
|
+
## Documentation
|
|
274
|
+
|
|
275
|
+
| Doc | For |
|
|
276
|
+
|---|---|
|
|
277
|
+
| [Getting Started](./docs/getting-started.md) | Install, wire into Claude Desktop / Cursor, read your first session log |
|
|
278
|
+
| [Command Reference](./docs/commands.md) | Every command, flag, exit code, and env var |
|
|
279
|
+
| [CI Recipes](./docs/ci.md) | Drop-in GitHub Actions for drift gating, conformance, and liveness |
|
|
280
|
+
| [Architecture](./docs/architecture.md) | The two invariants, framing, the Node/Rust split, module map |
|
|
281
|
+
| [Session Log Format](./docs/session-log.md) | The `.jsonl` event schema, for building on top of `mcpgaze` |
|
|
282
|
+
| [Security Policy](./SECURITY.md) | Threat model, data-at-rest, credential scoping, reporting |
|
|
283
|
+
| [Known Issues](./KNOWN-ISSUES.md) | Accepted, documented limitations for v1.0 |
|
|
284
|
+
| [Changelog](./CHANGELOG.md) | Release history |
|
|
285
|
+
|
|
286
|
+
## Where this is going (open core)
|
|
287
|
+
|
|
288
|
+
The CLI — proxy, local logging, schema snapshot/diff, CI gating — is free and open source (Apache-2.0), forever. A future hosted layer handles what a local CLI can't: **continuous** uptime/health across many servers, drift *history*, alerting, and team workspaces. The line is simple: **one dev, one server, one machine is free; aggregation across servers, time, and teams is the paid layer.**
|
|
289
|
+
|
|
290
|
+
Post-1.0 roadmap: hosted control plane (cross-server health/drift history, alerting); prebuilt per-platform `mcpgaze-proxy` binaries shipped with the npm package (so `--native` needs no `cargo`).
|
|
291
|
+
|
|
292
|
+
## Contributing
|
|
293
|
+
|
|
294
|
+
Issues and PRs are welcome — see [CONTRIBUTING.md](./CONTRIBUTING.md) for the dev loop, the invariant rules every change must respect, and the test gates. By participating you agree to the [Code of Conduct](./CODE_OF_CONDUCT.md).
|
|
295
|
+
|
|
296
|
+
## License
|
|
297
|
+
|
|
298
|
+
[Apache-2.0](./LICENSE).
|