proofscan 0.2.0 → 0.3.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/README.md +205 -281
- package/dist/analyzers/IAnalyzer.d.ts +87 -0
- package/dist/analyzers/IAnalyzer.d.ts.map +1 -0
- package/dist/analyzers/IAnalyzer.js +48 -0
- package/dist/analyzers/IAnalyzer.js.map +1 -0
- package/dist/analyzers/NoopAnalyzer.d.ts +24 -0
- package/dist/analyzers/NoopAnalyzer.d.ts.map +1 -0
- package/dist/analyzers/NoopAnalyzer.js +50 -0
- package/dist/analyzers/NoopAnalyzer.js.map +1 -0
- package/dist/analyzers/index.d.ts +13 -0
- package/dist/analyzers/index.d.ts.map +1 -0
- package/dist/analyzers/index.js +23 -0
- package/dist/analyzers/index.js.map +1 -0
- package/dist/cli.d.ts +15 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +131 -9
- package/dist/cli.js.map +1 -1
- package/dist/commands/events.d.ts +7 -0
- package/dist/commands/events.d.ts.map +1 -0
- package/dist/commands/events.js +185 -0
- package/dist/commands/events.js.map +1 -0
- package/dist/commands/explore.d.ts +9 -0
- package/dist/commands/explore.d.ts.map +1 -0
- package/dist/commands/explore.js +345 -0
- package/dist/commands/explore.js.map +1 -0
- package/dist/commands/index.d.ts +5 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +7 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/monitor.d.ts +1 -0
- package/dist/commands/monitor.d.ts.map +1 -1
- package/dist/commands/monitor.js +70 -12
- package/dist/commands/monitor.js.map +1 -1
- package/dist/commands/scan.d.ts.map +1 -1
- package/dist/commands/scan.js +12 -7
- package/dist/commands/scan.js.map +1 -1
- package/dist/commands/status.d.ts +7 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +108 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/tree.d.ts +7 -0
- package/dist/commands/tree.d.ts.map +1 -0
- package/dist/commands/tree.js +184 -0
- package/dist/commands/tree.js.map +1 -0
- package/dist/commands/view.d.ts +9 -0
- package/dist/commands/view.d.ts.map +1 -0
- package/dist/commands/view.js +210 -0
- package/dist/commands/view.js.map +1 -0
- package/dist/db/connection.d.ts.map +1 -1
- package/dist/db/connection.js +45 -4
- package/dist/db/connection.js.map +1 -1
- package/dist/db/events-store.d.ts +3 -0
- package/dist/db/events-store.d.ts.map +1 -1
- package/dist/db/events-store.js +6 -3
- package/dist/db/events-store.js.map +1 -1
- package/dist/db/schema.d.ts +8 -2
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +29 -3
- package/dist/db/schema.js.map +1 -1
- package/dist/db/types.d.ts +3 -0
- package/dist/db/types.d.ts.map +1 -1
- package/dist/eventline/index.d.ts +8 -0
- package/dist/eventline/index.d.ts.map +1 -0
- package/dist/eventline/index.js +8 -0
- package/dist/eventline/index.js.map +1 -0
- package/dist/eventline/normalizer.d.ts +79 -0
- package/dist/eventline/normalizer.d.ts.map +1 -0
- package/dist/eventline/normalizer.js +418 -0
- package/dist/eventline/normalizer.js.map +1 -0
- package/dist/eventline/schema-discovery.d.ts +79 -0
- package/dist/eventline/schema-discovery.d.ts.map +1 -0
- package/dist/eventline/schema-discovery.js +154 -0
- package/dist/eventline/schema-discovery.js.map +1 -0
- package/dist/eventline/store.d.ts +88 -0
- package/dist/eventline/store.d.ts.map +1 -0
- package/dist/eventline/store.js +358 -0
- package/dist/eventline/store.js.map +1 -0
- package/dist/eventline/types.d.ts +112 -0
- package/dist/eventline/types.d.ts.map +1 -0
- package/dist/eventline/types.js +67 -0
- package/dist/eventline/types.js.map +1 -0
- package/dist/protocols/A2aAdapter.d.ts +39 -0
- package/dist/protocols/A2aAdapter.d.ts.map +1 -0
- package/dist/protocols/A2aAdapter.js +48 -0
- package/dist/protocols/A2aAdapter.js.map +1 -0
- package/dist/protocols/IProtocolAdapter.d.ts +106 -0
- package/dist/protocols/IProtocolAdapter.d.ts.map +1 -0
- package/dist/protocols/IProtocolAdapter.js +57 -0
- package/dist/protocols/IProtocolAdapter.js.map +1 -0
- package/dist/protocols/McpAdapter.d.ts +23 -0
- package/dist/protocols/McpAdapter.d.ts.map +1 -0
- package/dist/protocols/McpAdapter.js +162 -0
- package/dist/protocols/McpAdapter.js.map +1 -0
- package/dist/protocols/index.d.ts +14 -0
- package/dist/protocols/index.d.ts.map +1 -0
- package/dist/protocols/index.js +24 -0
- package/dist/protocols/index.js.map +1 -0
- package/dist/scanner/index.d.ts +1 -0
- package/dist/scanner/index.d.ts.map +1 -1
- package/dist/scanner/index.js +97 -60
- package/dist/scanner/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ proofscan provides visibility into MCP (Model Context Protocol) server communica
|
|
|
10
10
|
- Captures all JSON-RPC messages (requests, responses, notifications)
|
|
11
11
|
- Stores events in SQLite for efficient querying and analysis
|
|
12
12
|
- Supports importing server configurations from mcp.so / Claude Desktop format
|
|
13
|
-
-
|
|
13
|
+
- Provides intuitive CLI commands for viewing and exploring data
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
@@ -24,122 +24,195 @@ Or run without installing:
|
|
|
24
24
|
npx proofscan --help
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
## CLI Commands
|
|
27
|
+
## CLI Commands (v0.3.0)
|
|
28
28
|
|
|
29
29
|
The CLI is available as both `pfscan` (short) and `proofscan` (full).
|
|
30
30
|
|
|
31
|
+
### Command Structure (git-style)
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Common Commands:
|
|
35
|
+
view, v View recent events timeline (default)
|
|
36
|
+
tree, t Show connector → session → rpc structure
|
|
37
|
+
explore, e Interactive data browser
|
|
38
|
+
scan, s Run a new scan
|
|
39
|
+
status, st Show system status
|
|
40
|
+
|
|
41
|
+
Management:
|
|
42
|
+
archive, a Archive and prune old data
|
|
43
|
+
config, c Configuration management
|
|
44
|
+
connectors Connector management
|
|
45
|
+
|
|
46
|
+
Shortcuts:
|
|
47
|
+
v=view t=tree e=explore s=scan st=status a=archive c=config
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Note:** Running `pfscan` without arguments is equivalent to `pfscan view`.
|
|
51
|
+
|
|
31
52
|
## Quickstart
|
|
32
53
|
|
|
33
54
|
### 1. Initialize Configuration
|
|
34
55
|
|
|
35
56
|
```bash
|
|
36
|
-
# Create config in OS-standard location
|
|
37
57
|
pfscan config init
|
|
38
|
-
|
|
39
|
-
# Check where config is stored
|
|
40
|
-
pfscan config path
|
|
58
|
+
pfscan config path # Show config location
|
|
41
59
|
```
|
|
42
60
|
|
|
43
|
-
### 2. Import MCP Server
|
|
44
|
-
|
|
45
|
-
Copy the `mcpServers` JSON from mcp.so or Claude Desktop settings and import via stdin:
|
|
61
|
+
### 2. Import MCP Server
|
|
46
62
|
|
|
47
63
|
```bash
|
|
48
|
-
#
|
|
49
|
-
echo '{
|
|
50
|
-
|
|
51
|
-
# Or just the server definition (requires --name)
|
|
52
|
-
echo '{ "command": "uvx", "args": ["mcp-server-time"] }' | pfscan connectors import --from mcpServers --stdin --name time
|
|
53
|
-
|
|
54
|
-
# Import from file
|
|
55
|
-
pfscan connectors import --from mcpServers --file ./servers.json
|
|
64
|
+
# From mcp.so / Claude Desktop format
|
|
65
|
+
echo '{"mcpServers":{"time":{"command":"uvx","args":["mcp-server-time"]}}}' \
|
|
66
|
+
| pfscan connectors import --from mcpServers --stdin
|
|
56
67
|
```
|
|
57
68
|
|
|
58
|
-
### 3.
|
|
69
|
+
### 3. Scan and View
|
|
59
70
|
|
|
60
71
|
```bash
|
|
61
|
-
pfscan
|
|
72
|
+
pfscan scan start --id time # Run scan
|
|
73
|
+
pfscan # View recent events (same as pfscan view)
|
|
74
|
+
pfscan tree # Show structure
|
|
75
|
+
pfscan status # Show system status
|
|
62
76
|
```
|
|
63
77
|
|
|
64
|
-
|
|
78
|
+
## View Command (Phase 2.1)
|
|
79
|
+
|
|
80
|
+
The `view` command displays a timeline of recent events with millisecond precision.
|
|
65
81
|
|
|
66
82
|
```bash
|
|
67
|
-
pfscan
|
|
83
|
+
$ pfscan view --limit 10
|
|
84
|
+
Time Sym Dir St Method Session Extra
|
|
85
|
+
-------------------------------------------------------------------------
|
|
86
|
+
21:01:58.743 → → ✓ initialize ses=f2442c... lat=269ms size=183B
|
|
87
|
+
21:01:59.018 ← ← ✓ initialize ses=f2442c...
|
|
88
|
+
21:01:59.025 • → notifications/initialized ses=f2442c...
|
|
89
|
+
21:01:59.037 → → ✓ tools/list ses=f2442c...
|
|
90
|
+
21:01:59.049 ← ← ✓ tools/list ses=f2442c... lat=12ms size=1.0KB
|
|
68
91
|
```
|
|
69
92
|
|
|
70
|
-
###
|
|
93
|
+
### View Options
|
|
71
94
|
|
|
72
95
|
```bash
|
|
73
|
-
#
|
|
74
|
-
pfscan
|
|
96
|
+
pfscan view --limit 50 # Show 50 events
|
|
97
|
+
pfscan view --since 24h # Events in last 24 hours
|
|
98
|
+
pfscan view --since 7d # Events in last 7 days
|
|
99
|
+
pfscan view --errors # Show only errors
|
|
100
|
+
pfscan view --method tools # Filter by method name
|
|
101
|
+
pfscan view --connector time # Filter by connector
|
|
102
|
+
pfscan view --session abc123 # Filter by session (partial match)
|
|
103
|
+
pfscan view --fulltime # Show full timestamp (YYYY-MM-DD HH:MM:SS.mmm)
|
|
104
|
+
pfscan view --with-sessions # Include session start/end events
|
|
105
|
+
pfscan view --json # Output as JSON (EventLine array)
|
|
106
|
+
```
|
|
75
107
|
|
|
76
|
-
|
|
77
|
-
pfscan sessions show --id <session_id>
|
|
108
|
+
### Event Symbols
|
|
78
109
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
110
|
+
| Symbol | Meaning |
|
|
111
|
+
|--------|---------|
|
|
112
|
+
| ▶ | Session start |
|
|
113
|
+
| ■ | Session end |
|
|
114
|
+
| → | Request (Client → Server) |
|
|
115
|
+
| ← | Response (Server → Client) |
|
|
116
|
+
| • | Notification |
|
|
117
|
+
| ✖ | Error |
|
|
82
118
|
|
|
83
|
-
##
|
|
119
|
+
## Tree Command (Phase 2.1)
|
|
84
120
|
|
|
85
|
-
|
|
121
|
+
The `tree` command shows a hierarchical view of connector → session → rpc.
|
|
86
122
|
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
123
|
+
```bash
|
|
124
|
+
$ pfscan tree
|
|
125
|
+
└── 📦 time
|
|
126
|
+
├── 📋 f2442c9b... (2 rpcs, 8 events)
|
|
127
|
+
│ ├── ↔️ ✓ tools/list (id=2, 12ms)
|
|
128
|
+
│ └── ↔️ ✓ initialize (id=1, 269ms)
|
|
129
|
+
└── 📋 3cf5a66e... (2 rpcs, 8 events)
|
|
130
|
+
├── ↔️ ✓ tools/list (id=2, 13ms)
|
|
131
|
+
└── ↔️ ✓ initialize (id=1, 271ms)
|
|
132
|
+
|
|
133
|
+
1 connector(s), 2 session(s), 4 rpc(s)
|
|
91
134
|
```
|
|
92
135
|
|
|
93
|
-
###
|
|
136
|
+
### Tree Options
|
|
94
137
|
|
|
95
138
|
```bash
|
|
96
|
-
pfscan
|
|
97
|
-
pfscan
|
|
98
|
-
pfscan
|
|
99
|
-
pfscan
|
|
139
|
+
pfscan tree time # Show specific connector
|
|
140
|
+
pfscan tree --sessions 10 # Show 10 sessions per connector
|
|
141
|
+
pfscan tree --rpc 20 # Show 20 RPCs per session
|
|
142
|
+
pfscan tree --rpc-all # Show all RPCs
|
|
143
|
+
pfscan tree --method init # Filter by method name
|
|
144
|
+
pfscan tree --status ok # Filter by status (ok, err, all)
|
|
145
|
+
pfscan tree --compact # Compact output (no icons)
|
|
146
|
+
pfscan tree --since 24h # Filter by time
|
|
147
|
+
pfscan tree --json # Output as JSON (TreeNode array)
|
|
100
148
|
```
|
|
101
149
|
|
|
102
|
-
|
|
150
|
+
## Explore Command (Phase 2.1)
|
|
151
|
+
|
|
152
|
+
The `explore` command provides interactive navigation through data.
|
|
103
153
|
|
|
104
154
|
```bash
|
|
105
|
-
pfscan
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
155
|
+
$ pfscan explore
|
|
156
|
+
═══════════════════════════════════════════════════════════════
|
|
157
|
+
proofscan explore
|
|
158
|
+
═══════════════════════════════════════════════════════════════
|
|
159
|
+
Path: connectors
|
|
160
|
+
───────────────────────────────────────────────────────────────
|
|
111
161
|
|
|
112
|
-
|
|
113
|
-
pfscan connectors import --from mcpServers --stdin
|
|
114
|
-
pfscan connectors import --from mcpServers --file <path> [--name <id>]
|
|
115
|
-
```
|
|
162
|
+
Connectors:
|
|
116
163
|
|
|
117
|
-
|
|
164
|
+
[1] time (3 sessions)
|
|
118
165
|
|
|
119
|
-
|
|
120
|
-
pfscan scan start --id <id> [--timeout <sec>]
|
|
166
|
+
> 1
|
|
121
167
|
```
|
|
122
168
|
|
|
123
|
-
###
|
|
169
|
+
### Explore Navigation
|
|
170
|
+
|
|
171
|
+
- **Number**: Select item
|
|
172
|
+
- **b**: Go back
|
|
173
|
+
- **t**: Show tree view
|
|
174
|
+
- **?**: Help
|
|
175
|
+
- **q**: Quit
|
|
176
|
+
- **p**: View request/response pair (in RPC view)
|
|
124
177
|
|
|
125
178
|
```bash
|
|
126
|
-
pfscan
|
|
179
|
+
pfscan explore # Start from connectors
|
|
180
|
+
pfscan explore --session abc123 # Jump to specific session
|
|
127
181
|
```
|
|
128
182
|
|
|
129
|
-
|
|
183
|
+
## Status Command (Phase 2.1)
|
|
184
|
+
|
|
185
|
+
The `status` command shows database and system status.
|
|
130
186
|
|
|
131
187
|
```bash
|
|
132
|
-
pfscan
|
|
133
|
-
|
|
134
|
-
|
|
188
|
+
$ pfscan status
|
|
189
|
+
proofscan Status
|
|
190
|
+
═════════════════════════════════════════════════════
|
|
191
|
+
|
|
192
|
+
Configuration:
|
|
193
|
+
Config file: /home/user/.config/proofscan/config.json
|
|
194
|
+
Data dir: /home/user/.config/proofscan
|
|
195
|
+
|
|
196
|
+
Database:
|
|
197
|
+
events.db: 72.0KB
|
|
198
|
+
proofs.db: 24.0KB
|
|
199
|
+
Schema ver: 1
|
|
200
|
+
Tables: sessions, rpc_calls, events
|
|
201
|
+
|
|
202
|
+
Data Summary:
|
|
203
|
+
Connectors: 1
|
|
204
|
+
Sessions: 3
|
|
205
|
+
RPC calls: 6
|
|
206
|
+
Events: 24
|
|
207
|
+
Latest: 2025-12-28T12:01:58.610Z
|
|
135
208
|
```
|
|
136
209
|
|
|
137
|
-
|
|
210
|
+
## Global Options
|
|
138
211
|
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
212
|
+
```
|
|
213
|
+
-c, --config <path> Path to config file
|
|
214
|
+
--json Output in JSON format
|
|
215
|
+
-v, --verbose Verbose output
|
|
143
216
|
```
|
|
144
217
|
|
|
145
218
|
## Config File Format
|
|
@@ -160,7 +233,7 @@ Config is stored in the OS-standard location:
|
|
|
160
233
|
"transport": {
|
|
161
234
|
"type": "stdio",
|
|
162
235
|
"command": "uvx",
|
|
163
|
-
"args": ["mcp-server-time"
|
|
236
|
+
"args": ["mcp-server-time"]
|
|
164
237
|
}
|
|
165
238
|
}
|
|
166
239
|
],
|
|
@@ -180,7 +253,7 @@ Config is stored in the OS-standard location:
|
|
|
180
253
|
| `raw_days` | 7 | Clear raw JSON after N days |
|
|
181
254
|
| `max_db_mb` | 500 | Target database size limit |
|
|
182
255
|
|
|
183
|
-
## Data Storage
|
|
256
|
+
## Data Storage
|
|
184
257
|
|
|
185
258
|
proofscan uses a 2-file SQLite structure:
|
|
186
259
|
|
|
@@ -191,244 +264,95 @@ proofscan uses a 2-file SQLite structure:
|
|
|
191
264
|
└── proofs.db # Immutable proof records (never pruned)
|
|
192
265
|
```
|
|
193
266
|
|
|
194
|
-
###
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
267
|
+
### EventLine Model (Phase 2.1)
|
|
268
|
+
|
|
269
|
+
Internally, all events are normalized to the `EventLine` format:
|
|
270
|
+
|
|
271
|
+
```typescript
|
|
272
|
+
interface EventLine {
|
|
273
|
+
ts_ms: number; // Timestamp (epoch ms)
|
|
274
|
+
kind: 'session_start' | 'session_end' | 'req' | 'res' | 'notify' | 'error';
|
|
275
|
+
direction?: '→' | '←'; // → = Client→Server, ← = Server→Client
|
|
276
|
+
label: string; // Method name or event type
|
|
277
|
+
connector_id?: string;
|
|
278
|
+
session_id?: string;
|
|
279
|
+
rpc_id?: string | number;
|
|
280
|
+
status: 'OK' | 'ERR' | '-';
|
|
281
|
+
latency_ms?: number;
|
|
282
|
+
size_bytes?: number;
|
|
283
|
+
raw_json?: string;
|
|
284
|
+
meta?: Record<string, unknown>;
|
|
285
|
+
}
|
|
286
|
+
```
|
|
207
287
|
|
|
208
|
-
|
|
209
|
-
# Initialize
|
|
210
|
-
$ pfscan config init
|
|
211
|
-
✓ Config created at: /home/user/.config/proofscan/config.json
|
|
288
|
+
This normalized model allows the schema to evolve without breaking the CLI.
|
|
212
289
|
|
|
213
|
-
|
|
214
|
-
$ echo '{"mcpServers":{"time":{"command":"uvx","args":["mcp-server-time"]}}}' \
|
|
215
|
-
| pfscan connectors import --from mcpServers --stdin
|
|
216
|
-
✓ Imported 1 connector(s): time
|
|
217
|
-
|
|
218
|
-
# List connectors
|
|
219
|
-
$ pfscan connectors list
|
|
220
|
-
ID Enabled Type Command/URL
|
|
221
|
-
-----------------------------------
|
|
222
|
-
time yes stdio uvx mcp-server-time
|
|
223
|
-
|
|
224
|
-
# Scan the server
|
|
225
|
-
$ pfscan scan start --id time
|
|
226
|
-
Scanning connector: time...
|
|
227
|
-
✓ Scan successful!
|
|
228
|
-
Connector: time
|
|
229
|
-
Session: dcaa519e-e14b-41ea-ac7c-7f2066cc8020
|
|
230
|
-
Tools found: 2
|
|
231
|
-
Tool names: get_current_time, convert_time
|
|
232
|
-
Events recorded: 8
|
|
233
|
-
|
|
234
|
-
# List sessions
|
|
235
|
-
$ pfscan sessions list
|
|
236
|
-
Session ID Connector Started Duration Status Events Protected
|
|
237
|
-
--------------------------------------------------------------------------------
|
|
238
|
-
dcaa519e... time 2025/01/15 10:30:00 450ms normal 8 no
|
|
239
|
-
|
|
240
|
-
# Show session details
|
|
241
|
-
$ pfscan sessions show --id dcaa519e-e14b-41ea-ac7c-7f2066cc8020
|
|
242
|
-
Session: dcaa519e-e14b-41ea-ac7c-7f2066cc8020
|
|
243
|
-
Connector: time
|
|
244
|
-
Started: 2025/01/15 10:30:00
|
|
245
|
-
Ended: 2025/01/15 10:30:00
|
|
246
|
-
Duration: 450ms
|
|
247
|
-
Status: normal
|
|
248
|
-
Protected: no
|
|
249
|
-
Events: 8
|
|
250
|
-
RPC Calls: 2
|
|
251
|
-
Proofs: 0
|
|
252
|
-
|
|
253
|
-
RPC Calls:
|
|
254
|
-
✓ initialize (id: 1)
|
|
255
|
-
✓ tools/list (id: 2)
|
|
256
|
-
|
|
257
|
-
# View events
|
|
258
|
-
$ pfscan monitor tail --id time --last 5
|
|
259
|
-
Recent events for 'time' (last 5):
|
|
260
|
-
|
|
261
|
-
Time Dir Status Kind Summary
|
|
262
|
-
----------------------------------------------------------------------
|
|
263
|
-
10:30:01 → ✓ request initialize
|
|
264
|
-
10:30:01 ← response
|
|
265
|
-
10:30:01 → notification notifications/initialized
|
|
266
|
-
10:30:01 → ✓ request tools/list
|
|
267
|
-
10:30:01 ← response
|
|
268
|
-
```
|
|
290
|
+
## Archive Command
|
|
269
291
|
|
|
270
|
-
|
|
292
|
+
Archive and prune old data based on retention settings.
|
|
271
293
|
|
|
272
294
|
```bash
|
|
273
|
-
#
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
events.db size: 80.0 KB
|
|
279
|
-
proofs.db size: 24.0 KB
|
|
280
|
-
|
|
281
|
-
Total sessions: 6
|
|
282
|
-
Protected sessions: 0
|
|
283
|
-
Total proofs: 0
|
|
284
|
-
raw_json storage: 4.8 KB
|
|
285
|
-
|
|
286
|
-
# View archive plan (based on retention settings)
|
|
287
|
-
$ pfscan archive plan
|
|
288
|
-
Archive Plan
|
|
289
|
-
============
|
|
290
|
-
|
|
291
|
-
Retention Settings:
|
|
292
|
-
keep_last_sessions: 3
|
|
293
|
-
raw_days: 7
|
|
294
|
-
max_db_mb: 500
|
|
295
|
-
|
|
296
|
-
Current Status:
|
|
297
|
-
events.db size: 80.0 KB
|
|
298
|
-
proofs.db size: 24.0 KB
|
|
299
|
-
|
|
300
|
-
Planned Actions:
|
|
301
|
-
|
|
302
|
-
Sessions to delete: 3
|
|
303
|
-
Session ID Connector Events Reason
|
|
304
|
-
--------------------------------------------------------------
|
|
305
|
-
c3f3ee9a... time 8 Exceeds keep_last_sessions (3)
|
|
306
|
-
050212d2... time 8 Exceeds keep_last_sessions (3)
|
|
307
|
-
dcaa519e... time 8 Exceeds keep_last_sessions (3)
|
|
308
|
-
|
|
309
|
-
raw_json to clear: 0 events
|
|
310
|
-
Estimated savings: ~0.0 MB
|
|
311
|
-
|
|
312
|
-
Run "pfscan archive run" to execute (or "pfscan archive run --yes" to confirm).
|
|
313
|
-
|
|
314
|
-
# Dry run (shows what would happen)
|
|
315
|
-
$ pfscan archive run
|
|
316
|
-
Archive Run (DRY RUN)
|
|
317
|
-
=====================
|
|
318
|
-
|
|
319
|
-
Sessions to delete: 3
|
|
320
|
-
raw_json to clear: 0 events
|
|
321
|
-
Estimated savings: ~0.0 MB
|
|
322
|
-
|
|
323
|
-
Run with --yes to actually execute.
|
|
324
|
-
|
|
325
|
-
# Execute archive with vacuum
|
|
326
|
-
$ pfscan archive run --yes --vacuum
|
|
327
|
-
Archive Run Complete
|
|
328
|
-
====================
|
|
329
|
-
|
|
330
|
-
Sessions deleted: 3
|
|
331
|
-
raw_json cleared: 0 events
|
|
332
|
-
Database vacuumed
|
|
333
|
-
|
|
334
|
-
Final events.db size: 72.0 KB
|
|
335
|
-
✓ Archive complete
|
|
336
|
-
|
|
337
|
-
# Verify sessions after archive
|
|
338
|
-
$ pfscan sessions list
|
|
339
|
-
Session ID Connector Started Duration Status Events Protected
|
|
340
|
-
--------------------------------------------------------------------------------
|
|
341
|
-
f2442c9b... time 2025/01/15 11:01:58 454ms normal 8 no
|
|
342
|
-
f641b379... time 2025/01/15 11:01:58 467ms normal 8 no
|
|
343
|
-
3cf5a66e... time 2025/01/15 11:01:57 449ms normal 8 no
|
|
295
|
+
pfscan archive status # Show database status
|
|
296
|
+
pfscan archive plan # Show what would be archived
|
|
297
|
+
pfscan archive run # Dry run
|
|
298
|
+
pfscan archive run --yes # Actually execute
|
|
299
|
+
pfscan archive run --yes --vacuum # Execute and reclaim space
|
|
344
300
|
```
|
|
345
301
|
|
|
346
302
|
## JSON Output
|
|
347
303
|
|
|
348
|
-
|
|
304
|
+
All commands support `--json` for machine-readable output:
|
|
349
305
|
|
|
350
306
|
```bash
|
|
351
|
-
$ pfscan
|
|
307
|
+
$ pfscan view --json --limit 3
|
|
352
308
|
[
|
|
353
309
|
{
|
|
354
|
-
"
|
|
355
|
-
"
|
|
356
|
-
"
|
|
357
|
-
"
|
|
358
|
-
|
|
310
|
+
"ts_ms": 1766923317974,
|
|
311
|
+
"kind": "req",
|
|
312
|
+
"direction": "→",
|
|
313
|
+
"label": "tools/list",
|
|
314
|
+
"connector_id": "time",
|
|
315
|
+
"session_id": "3cf5a66e-...",
|
|
316
|
+
"rpc_id": "2",
|
|
317
|
+
"status": "OK",
|
|
318
|
+
"size_bytes": 58
|
|
319
|
+
},
|
|
320
|
+
...
|
|
359
321
|
]
|
|
360
322
|
|
|
361
|
-
$ pfscan
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
$ pfscan archive status --json
|
|
372
|
-
{
|
|
373
|
-
"events_db_size": 81920,
|
|
374
|
-
"proofs_db_size": 24576,
|
|
375
|
-
"total_sessions": 6,
|
|
376
|
-
"protected_sessions": 0,
|
|
377
|
-
"total_proofs": 0,
|
|
378
|
-
"raw_json_size": 4896
|
|
379
|
-
}
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
## Supported mcpServers Input Formats
|
|
383
|
-
|
|
384
|
-
proofscan accepts several JSON formats for import:
|
|
385
|
-
|
|
386
|
-
### A) Full wrapper
|
|
387
|
-
|
|
388
|
-
```json
|
|
389
|
-
{
|
|
390
|
-
"mcpServers": {
|
|
391
|
-
"time": { "command": "uvx", "args": ["mcp-server-time"] }
|
|
323
|
+
$ pfscan tree --json
|
|
324
|
+
[
|
|
325
|
+
{
|
|
326
|
+
"type": "connector",
|
|
327
|
+
"id": "time",
|
|
328
|
+
"label": "time",
|
|
329
|
+
"meta": { "session_count": 3 },
|
|
330
|
+
"children": [...]
|
|
392
331
|
}
|
|
393
|
-
|
|
332
|
+
]
|
|
394
333
|
```
|
|
395
334
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
```json
|
|
399
|
-
{
|
|
400
|
-
"time": { "command": "uvx", "args": ["mcp-server-time"] }
|
|
401
|
-
}
|
|
402
|
-
```
|
|
335
|
+
## Connector Management
|
|
403
336
|
|
|
404
|
-
|
|
337
|
+
```bash
|
|
338
|
+
pfscan connectors list # List all
|
|
339
|
+
pfscan connectors show --id <id> # Show details
|
|
340
|
+
pfscan connectors add --id <id> --stdio "cmd" # Add connector
|
|
341
|
+
pfscan connectors enable --id <id> # Enable
|
|
342
|
+
pfscan connectors disable --id <id> # Disable
|
|
343
|
+
pfscan connectors remove --id <id> # Remove
|
|
405
344
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
"args": ["mcp-server-time"]
|
|
410
|
-
}
|
|
345
|
+
# Import from mcpServers format
|
|
346
|
+
pfscan connectors import --from mcpServers --stdin
|
|
347
|
+
pfscan connectors import --from mcpServers --file <path>
|
|
411
348
|
```
|
|
412
349
|
|
|
413
|
-
##
|
|
414
|
-
|
|
415
|
-
Failures are always recorded as events. Even if a scan fails, you can inspect what happened:
|
|
350
|
+
## Session Management
|
|
416
351
|
|
|
417
352
|
```bash
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
Connector: broken-server
|
|
422
|
-
Session: abc123...
|
|
423
|
-
Error: Initialize failed: Request timeout for method: initialize
|
|
424
|
-
Events recorded: 3
|
|
425
|
-
|
|
426
|
-
$ pfscan monitor tail --id broken-server --last 5
|
|
427
|
-
Time Dir Status Kind Summary
|
|
428
|
-
----------------------------------------------------------------------
|
|
429
|
-
10:35:01 → transport [connect_attempt]
|
|
430
|
-
10:35:01 ← transport [connected]
|
|
431
|
-
10:35:31 → transport [initialize_failed] Initialize failed: Request timeout...
|
|
353
|
+
pfscan sessions list [--connector <id>] [--last <N>]
|
|
354
|
+
pfscan sessions show --id <session_id>
|
|
355
|
+
pfscan sessions prune [--before <date>] [--keep-last <N>] [--yes]
|
|
432
356
|
```
|
|
433
357
|
|
|
434
358
|
## Development
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analyzer Interface
|
|
3
|
+
*
|
|
4
|
+
* Phase 2.1: Skeleton for event analysis hooks
|
|
5
|
+
* Full implementation in Phase 3
|
|
6
|
+
*/
|
|
7
|
+
import type { EventLine, EventLinePair } from '../eventline/types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Analysis result
|
|
10
|
+
*/
|
|
11
|
+
export interface AnalysisResult {
|
|
12
|
+
/** Analyzer identifier */
|
|
13
|
+
analyzer: string;
|
|
14
|
+
/** Analysis timestamp */
|
|
15
|
+
ts_ms: number;
|
|
16
|
+
/** Findings from analysis */
|
|
17
|
+
findings: AnalysisFinding[];
|
|
18
|
+
/** Statistics */
|
|
19
|
+
stats?: Record<string, unknown>;
|
|
20
|
+
/** Metadata */
|
|
21
|
+
meta?: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Individual finding from analysis
|
|
25
|
+
*/
|
|
26
|
+
export interface AnalysisFinding {
|
|
27
|
+
/** Finding type */
|
|
28
|
+
type: 'info' | 'warning' | 'error' | 'suggestion';
|
|
29
|
+
/** Finding category */
|
|
30
|
+
category: string;
|
|
31
|
+
/** Human-readable message */
|
|
32
|
+
message: string;
|
|
33
|
+
/** Related event(s) */
|
|
34
|
+
events?: EventLine[];
|
|
35
|
+
/** Related pair(s) */
|
|
36
|
+
pairs?: EventLinePair[];
|
|
37
|
+
/** Additional context */
|
|
38
|
+
context?: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Analyzer interface
|
|
42
|
+
*
|
|
43
|
+
* Analyzers process events and produce findings
|
|
44
|
+
*/
|
|
45
|
+
export interface IAnalyzer {
|
|
46
|
+
/** Analyzer name */
|
|
47
|
+
readonly name: string;
|
|
48
|
+
/** Analyzer version */
|
|
49
|
+
readonly version: string;
|
|
50
|
+
/** Description */
|
|
51
|
+
readonly description: string;
|
|
52
|
+
/**
|
|
53
|
+
* Analyze a batch of events
|
|
54
|
+
* @param events - Events to analyze
|
|
55
|
+
* @returns Analysis result
|
|
56
|
+
*/
|
|
57
|
+
analyze(events: EventLine[]): Promise<AnalysisResult>;
|
|
58
|
+
/**
|
|
59
|
+
* Analyze RPC pairs
|
|
60
|
+
* @param pairs - RPC pairs to analyze
|
|
61
|
+
* @returns Analysis result
|
|
62
|
+
*/
|
|
63
|
+
analyzePairs(pairs: EventLinePair[]): Promise<AnalysisResult>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Analyzer registry
|
|
67
|
+
*/
|
|
68
|
+
export declare class AnalyzerRegistry {
|
|
69
|
+
private analyzers;
|
|
70
|
+
/**
|
|
71
|
+
* Register an analyzer
|
|
72
|
+
*/
|
|
73
|
+
register(analyzer: IAnalyzer): void;
|
|
74
|
+
/**
|
|
75
|
+
* Get analyzer by name
|
|
76
|
+
*/
|
|
77
|
+
get(name: string): IAnalyzer | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Get all registered analyzers
|
|
80
|
+
*/
|
|
81
|
+
getAll(): IAnalyzer[];
|
|
82
|
+
/**
|
|
83
|
+
* Run all analyzers on events
|
|
84
|
+
*/
|
|
85
|
+
analyzeAll(events: EventLine[]): Promise<AnalysisResult[]>;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=IAnalyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAnalyzer.d.ts","sourceRoot":"","sources":["../../src/analyzers/IAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,0BAA0B;IAC1B,QAAQ,EAAE,MAAM,CAAC;IAEjB,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IAEd,6BAA6B;IAC7B,QAAQ,EAAE,eAAe,EAAE,CAAC;IAE5B,iBAAiB;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEhC,eAAe;IACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,mBAAmB;IACnB,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,YAAY,CAAC;IAElD,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAC;IAEjB,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAEhB,uBAAuB;IACvB,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IAErB,sBAAsB;IACtB,KAAK,CAAC,EAAE,aAAa,EAAE,CAAC;IAExB,yBAAyB;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,oBAAoB;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,uBAAuB;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,kBAAkB;IAClB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAEtD;;;;OAIG;IACH,YAAY,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC/D;AAED;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,SAAS,CAAqC;IAEtD;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,GAAG,IAAI;IAInC;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAIxC;;OAEG;IACH,MAAM,IAAI,SAAS,EAAE;IAIrB;;OAEG;IACG,UAAU,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;CAejE"}
|