mcp-wiretap 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/ISSUE_TEMPLATE/bug_report.md +35 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
- package/.github/workflows/ci.yml +25 -0
- package/.github/workflows/publish.yml +28 -0
- package/CHANGELOG.md +15 -0
- package/CONTRIBUTING.md +22 -0
- package/LICENSE +21 -0
- package/README.md +151 -0
- package/dist/index.js +1426 -0
- package/dist/index.js.map +1 -0
- package/package.json +51 -0
- package/src/display.ts +232 -0
- package/src/export.ts +93 -0
- package/src/index.ts +255 -0
- package/src/logger.ts +178 -0
- package/src/parser.ts +179 -0
- package/src/proxy.ts +239 -0
- package/src/sessions.ts +122 -0
- package/tsconfig.json +20 -0
- package/tsup.config.ts +17 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug Report
|
|
3
|
+
about: Report a bug in mcp-wiretap
|
|
4
|
+
title: ""
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
**Describe the bug**
|
|
10
|
+
|
|
11
|
+
[What happened]
|
|
12
|
+
|
|
13
|
+
**MCP server being wrapped**
|
|
14
|
+
|
|
15
|
+
[e.g., @modelcontextprotocol/server-filesystem]
|
|
16
|
+
|
|
17
|
+
**MCP client**
|
|
18
|
+
|
|
19
|
+
[e.g., Claude Desktop, Cursor, Claude Code]
|
|
20
|
+
|
|
21
|
+
**Expected behavior**
|
|
22
|
+
|
|
23
|
+
[What you expected]
|
|
24
|
+
|
|
25
|
+
**Steps to reproduce**
|
|
26
|
+
|
|
27
|
+
1.
|
|
28
|
+
2.
|
|
29
|
+
3.
|
|
30
|
+
|
|
31
|
+
**Environment**
|
|
32
|
+
|
|
33
|
+
- OS: [e.g., macOS 14.5]
|
|
34
|
+
- Node: [e.g., 20.11.0]
|
|
35
|
+
- mcp-wiretap version: [e.g., 0.1.0]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Request
|
|
3
|
+
about: Suggest a feature for mcp-wiretap
|
|
4
|
+
title: ""
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
**What problem does this solve?**
|
|
10
|
+
|
|
11
|
+
[Description]
|
|
12
|
+
|
|
13
|
+
**Proposed solution**
|
|
14
|
+
|
|
15
|
+
[How you'd like it to work]
|
|
16
|
+
|
|
17
|
+
**Alternatives considered**
|
|
18
|
+
|
|
19
|
+
[Other approaches]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
node-version: [18, 20, 22]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
20
|
+
uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: ${{ matrix.node-version }}
|
|
23
|
+
|
|
24
|
+
- run: npm ci
|
|
25
|
+
- run: npm run build
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
id-token: write
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- uses: actions/setup-node@v4
|
|
19
|
+
with:
|
|
20
|
+
node-version: 20
|
|
21
|
+
registry-url: "https://registry.npmjs.org"
|
|
22
|
+
|
|
23
|
+
- run: npm ci
|
|
24
|
+
- run: npm run build
|
|
25
|
+
|
|
26
|
+
- run: npm publish --provenance --access public
|
|
27
|
+
env:
|
|
28
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
Initial release.
|
|
6
|
+
|
|
7
|
+
- Transparent stdio proxy for any MCP server
|
|
8
|
+
- JSON-RPC message parsing with request/response correlation
|
|
9
|
+
- SQLite logging with session management
|
|
10
|
+
- Real-time color-coded terminal display (compact + verbose modes)
|
|
11
|
+
- Latency calculation by matching request/response IDs
|
|
12
|
+
- JSON and CSV export
|
|
13
|
+
- Session list, replay, and search
|
|
14
|
+
- Works via `npx mcp-wiretap` with zero install
|
|
15
|
+
- Drop-in wrapper for Claude Desktop, Cursor, and Claude Code configs
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Contributing to mcp-wiretap
|
|
2
|
+
|
|
3
|
+
1. Fork the repo
|
|
4
|
+
2. Create a feature branch: `git checkout -b feat/my-feature`
|
|
5
|
+
3. Make your changes
|
|
6
|
+
4. Run the build: `npm run build`
|
|
7
|
+
5. Submit a PR
|
|
8
|
+
|
|
9
|
+
Please open an issue before starting major work so we can discuss the approach.
|
|
10
|
+
|
|
11
|
+
## Development
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
git clone https://github.com/dantrapp/mcp-wiretap.git
|
|
15
|
+
cd mcp-wiretap
|
|
16
|
+
npm install
|
|
17
|
+
npm run build
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Commit Messages
|
|
21
|
+
|
|
22
|
+
Use conventional commits: `feat:`, `fix:`, `docs:`, `chore:`, `refactor:`.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Trapp
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# mcp-wiretap
|
|
2
|
+
|
|
3
|
+
> See everything your AI agents do through MCP. One command. Zero config.
|
|
4
|
+
|
|
5
|
+
<!-- TODO: Add demo GIF recorded with vhs or asciinema -->
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx mcp-wiretap -- npx -y @modelcontextprotocol/server-filesystem ~/Code
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
That's it. Every MCP tool call is now logged to SQLite and displayed in your terminal.
|
|
14
|
+
|
|
15
|
+
## Why
|
|
16
|
+
|
|
17
|
+
MCP servers can read files, query databases, and execute code on your behalf. But you can't see what they're actually doing.
|
|
18
|
+
|
|
19
|
+
mcp-wiretap wraps any MCP server and records every tool call — what was requested, what was returned, and how long it took. No SDK integration. No platform to adopt. Just wrap and watch.
|
|
20
|
+
|
|
21
|
+
## Use with Claude Desktop
|
|
22
|
+
|
|
23
|
+
Replace your existing MCP server config:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"filesystem": {
|
|
29
|
+
"command": "npx",
|
|
30
|
+
"args": [
|
|
31
|
+
"-y", "mcp-wiretap", "--",
|
|
32
|
+
"npx", "-y", "@modelcontextprotocol/server-filesystem", "/Users/me/Code"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Now every tool call Claude Desktop makes through this server is logged.
|
|
40
|
+
|
|
41
|
+
## Use with Cursor
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"mcpServers": {
|
|
46
|
+
"filesystem": {
|
|
47
|
+
"command": "npx",
|
|
48
|
+
"args": [
|
|
49
|
+
"-y", "mcp-wiretap", "--",
|
|
50
|
+
"npx", "-y", "@modelcontextprotocol/server-filesystem", "/Users/me/Code"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Use with Claude Code
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
claude mcp add filesystem -- npx -y mcp-wiretap -- npx -y @modelcontextprotocol/server-filesystem ~/Code
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Terminal Output
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
14:23:01.442 ──▶ initialize
|
|
67
|
+
14:23:01.458 ◀── initialize 16ms
|
|
68
|
+
14:23:01.460 ──▶ tools/list
|
|
69
|
+
14:23:01.463 ◀── tools/list (12 tools) 3ms
|
|
70
|
+
14:23:05.891 ──▶ tools/call read_file {"path":"/Users/me/Code/README.md"}
|
|
71
|
+
14:23:05.903 ◀── tools/call read_file (2,847 bytes) 12ms
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Use `--verbose` to see full payloads.
|
|
75
|
+
|
|
76
|
+
## Export & Search
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Export current session to JSON
|
|
80
|
+
npx mcp-wiretap export --format json --output audit.json
|
|
81
|
+
|
|
82
|
+
# Export all sessions to CSV
|
|
83
|
+
npx mcp-wiretap export --format csv --all --output audit.csv
|
|
84
|
+
|
|
85
|
+
# List all recorded sessions
|
|
86
|
+
npx mcp-wiretap sessions
|
|
87
|
+
|
|
88
|
+
# Replay a specific session
|
|
89
|
+
npx mcp-wiretap replay <session-id>
|
|
90
|
+
|
|
91
|
+
# Search across all sessions
|
|
92
|
+
npx mcp-wiretap search "read_file"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## How It Works
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
|
99
|
+
│ MCP Client │────▶│ mcp-wiretap │────▶│ MCP Server │
|
|
100
|
+
│ (Claude, etc)│◀────│ (proxy) │◀────│ (any) │
|
|
101
|
+
└──────────────┘ └──────┬───────┘ └──────────────┘
|
|
102
|
+
│
|
|
103
|
+
┌──────▼───────┐
|
|
104
|
+
│ SQLite DB │
|
|
105
|
+
│ + Terminal │
|
|
106
|
+
│ Output │
|
|
107
|
+
└──────────────┘
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
mcp-wiretap spawns your MCP server as a child process, intercepts all JSON-RPC messages on stdin/stdout, logs them to SQLite with timestamps and latency, and forwards everything unmodified. Neither the client nor the server knows it's there.
|
|
111
|
+
|
|
112
|
+
All display output goes to stderr. stdout is reserved exclusively for the MCP protocol.
|
|
113
|
+
|
|
114
|
+
## Options
|
|
115
|
+
|
|
116
|
+
| Flag | Description | Default |
|
|
117
|
+
|------|-------------|---------|
|
|
118
|
+
| `--db <path>` | SQLite database location | `~/.mcp-wiretap/wiretap.db` |
|
|
119
|
+
| `--quiet` | Suppress terminal output, log only | `false` |
|
|
120
|
+
| `--verbose` | Show full payloads in terminal | `false` |
|
|
121
|
+
| `--filter <method>` | Only display specific methods | all |
|
|
122
|
+
| `--max-payload <bytes>` | Truncate payloads in display | unlimited |
|
|
123
|
+
| `--no-color` | Disable color output | `false` |
|
|
124
|
+
|
|
125
|
+
## Comparison
|
|
126
|
+
|
|
127
|
+
| Tool | Type | Setup | Cost |
|
|
128
|
+
|------|------|-------|------|
|
|
129
|
+
| **mcp-wiretap** | Passive CLI monitor | One command | Free |
|
|
130
|
+
| MCP Inspector | Interactive debugger | Manual testing | Free |
|
|
131
|
+
| Datadog MCP | Enterprise SaaS | SDK + account | $$$ |
|
|
132
|
+
| Gateways (Composio, etc.) | Platform | Architecture change | Varies |
|
|
133
|
+
|
|
134
|
+
## SQLite Schema
|
|
135
|
+
|
|
136
|
+
Events are stored at `~/.mcp-wiretap/wiretap.db`. You can query them directly:
|
|
137
|
+
|
|
138
|
+
```sql
|
|
139
|
+
SELECT timestamp, direction, method, tool_name, latency_ms
|
|
140
|
+
FROM events
|
|
141
|
+
WHERE session_id = 'your-session-id'
|
|
142
|
+
ORDER BY timestamp;
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Contributing
|
|
146
|
+
|
|
147
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
MIT
|