@pcircle/evidencemcp-server 0.1.0 → 0.2.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.
Files changed (56) hide show
  1. package/README.md +27 -297
  2. package/dist/index.d.ts +1 -15
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +55 -123
  5. package/dist/index.js.map +1 -1
  6. package/dist/lib/crypto/decrypt.d.ts +11 -0
  7. package/dist/lib/crypto/decrypt.d.ts.map +1 -0
  8. package/dist/lib/crypto/decrypt.js +30 -0
  9. package/dist/lib/crypto/decrypt.js.map +1 -0
  10. package/dist/lib/crypto/encrypt.d.ts +13 -0
  11. package/dist/lib/crypto/encrypt.d.ts.map +1 -0
  12. package/dist/lib/crypto/encrypt.js +24 -0
  13. package/dist/lib/crypto/encrypt.js.map +1 -0
  14. package/dist/lib/crypto/index.d.ts +6 -0
  15. package/dist/lib/crypto/index.d.ts.map +1 -0
  16. package/dist/lib/crypto/index.js +5 -0
  17. package/dist/lib/crypto/index.js.map +1 -0
  18. package/dist/lib/crypto/key-derivation.d.ts +30 -0
  19. package/dist/lib/crypto/key-derivation.d.ts.map +1 -0
  20. package/dist/lib/crypto/key-derivation.js +63 -0
  21. package/dist/lib/crypto/key-derivation.js.map +1 -0
  22. package/dist/lib/crypto/types.d.ts +22 -0
  23. package/dist/lib/crypto/types.d.ts.map +1 -0
  24. package/dist/lib/crypto/types.js +10 -0
  25. package/dist/lib/crypto/types.js.map +1 -0
  26. package/dist/lib/storage/database.d.ts +66 -0
  27. package/dist/lib/storage/database.d.ts.map +1 -0
  28. package/dist/lib/storage/database.js +195 -0
  29. package/dist/lib/storage/database.js.map +1 -0
  30. package/dist/lib/storage/export.d.ts +26 -0
  31. package/dist/lib/storage/export.d.ts.map +1 -0
  32. package/dist/lib/storage/export.js +113 -0
  33. package/dist/lib/storage/export.js.map +1 -0
  34. package/dist/lib/storage/git.d.ts +16 -0
  35. package/dist/lib/storage/git.d.ts.map +1 -0
  36. package/dist/lib/storage/git.js +55 -0
  37. package/dist/lib/storage/git.js.map +1 -0
  38. package/dist/lib/storage/index.d.ts +6 -0
  39. package/dist/lib/storage/index.d.ts.map +1 -0
  40. package/dist/lib/storage/index.js +5 -0
  41. package/dist/lib/storage/index.js.map +1 -0
  42. package/dist/lib/storage/schema.d.ts +17 -0
  43. package/dist/lib/storage/schema.d.ts.map +1 -0
  44. package/dist/lib/storage/schema.js +103 -0
  45. package/dist/lib/storage/schema.js.map +1 -0
  46. package/dist/lib/storage/types.d.ts +26 -0
  47. package/dist/lib/storage/types.d.ts.map +1 -0
  48. package/dist/lib/storage/types.js +2 -0
  49. package/dist/lib/storage/types.js.map +1 -0
  50. package/dist/test-helpers.d.ts +12 -30
  51. package/dist/test-helpers.d.ts.map +1 -1
  52. package/dist/test-helpers.js +59 -121
  53. package/dist/test-helpers.js.map +1 -1
  54. package/dist/types.d.ts +0 -25
  55. package/dist/types.d.ts.map +1 -1
  56. package/package.json +7 -3
package/README.md CHANGED
@@ -2,62 +2,31 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@pcircle/evidencemcp-server)](https://www.npmjs.com/package/@pcircle/evidencemcp-server)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5
- [![Tests](https://img.shields.io/badge/tests-19%20passing-brightgreen)](tests/)
6
- [![Node.js](https://img.shields.io/badge/node-%3E%3D22.0.0-brightgreen)](package.json)
7
5
 
8
- Model Context Protocol (MCP) server for EvidenceMCP - automatically captures and encrypts LLM conversations as legal evidence.
6
+ Model Context Protocol (MCP) server that automatically captures and encrypts LLM conversations as legal evidence.
9
7
 
10
8
  ## Why EvidenceMCP?
11
9
 
12
- ### For Developers & Content Creators
13
- - **Prove IP Ownership** - Timestamped evidence of LLM-assisted work for copyright protection
14
- - **Zero Effort** - Automatic capture via MCP protocol, no manual logging required
15
- - **Legally Valid** - Git timestamps + encryption provide tamper-proof evidence
16
- - **Privacy First** - All data encrypted locally, never leaves your machine
17
-
18
- ### For Researchers & Academics
19
- - **Research Integrity** - Document AI-assisted research with provable timestamps
20
- - **Audit Trail** - Complete conversation history for methodology transparency
21
- - **Compliance Ready** - Meet institutional requirements for AI usage disclosure
22
-
23
- ### For Teams & Organizations
24
- - **Risk Mitigation** - Legal protection against IP disputes over AI-generated content
25
- - **Quality Assurance** - Review and audit LLM interactions for compliance
26
- - **Knowledge Management** - Searchable archive of all LLM conversations
27
-
28
- ## Features
29
-
30
- - 🔐 **End-to-End Encryption** - XChaCha20-Poly1305 authenticated encryption
31
- - 📝 **Automatic Capture** - Intercepts LLM conversations via MCP protocol
32
- - 🕒 **Git Timestamps** - Provable timestamps from Git commits
33
- - 📦 **Evidence Export** - ZIP archives with SHA-256 checksums
34
- - 🔍 **Evidence Management** - List, retrieve, and decrypt stored evidence
10
+ - **Prove IP Ownership** - Timestamped evidence of LLM-assisted work
11
+ - **Zero Effort** - Automatic capture via MCP protocol
12
+ - **Privacy First** - End-to-end encrypted, locally stored
13
+ - **Legally Valid** - Git timestamps + SHA-256 checksums
35
14
 
36
15
  ## Installation
37
16
 
38
17
  ```bash
39
- pnpm add @pcircle/evidencemcp-server
18
+ npm install -g @pcircle/evidencemcp-server
40
19
  ```
41
20
 
42
21
  ## Quick Start
43
22
 
44
- ### 1. Set Environment Variables
45
-
23
+ 1. **Set environment variables:**
46
24
  ```bash
47
25
  export EVIDENCEMCP_DB_PATH="./evidence.db"
48
26
  export EVIDENCEMCP_PASSWORD="your-secure-password"
49
27
  ```
50
28
 
51
- ### 2. Run MCP Server
52
-
53
- ```bash
54
- npx evidencemcp-mcp
55
- ```
56
-
57
- ### 3. Configure Claude Desktop
58
-
59
- Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
60
-
29
+ 2. **Configure Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json`):
61
30
  ```json
62
31
  {
63
32
  "mcpServers": {
@@ -73,278 +42,39 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
73
42
  }
74
43
  ```
75
44
 
76
- ## MCP Tools
45
+ 3. **Restart Claude Desktop** - Evidence collection starts automatically
77
46
 
78
- ### capture-evidence
47
+ ## Features
79
48
 
80
- Capture and encrypt an LLM conversation.
49
+ - 🔐 XChaCha20-Poly1305 encryption
50
+ - 🕒 Git commit timestamps
51
+ - 📦 Tamper-proof ZIP exports
52
+ - 🔍 Search and retrieve evidence
81
53
 
82
- **Input:**
83
- - `conversationId` (string) - Unique conversation identifier
84
- - `llmProvider` (string) - LLM provider name (e.g., "Claude Sonnet 4.5")
85
- - `content` (string) - Conversation content
86
- - `messageCount` (number) - Number of messages
87
- - `tags` (string, optional) - Comma-separated tags
54
+ ## MCP Tools
88
55
 
89
- **Output:**
90
- ```json
91
- {
92
- "id": "uuid-v4",
93
- "timestamp": "2024-01-24T00:00:00Z",
94
- "gitCommitHash": "abc123...",
95
- "success": true
96
- }
97
- ```
56
+ ### capture-evidence
57
+ Captures and encrypts an LLM conversation.
98
58
 
99
59
  ### list-evidences
100
-
101
- List all captured evidence with pagination.
102
-
103
- **Input:**
104
- - `limit` (number, optional) - Maximum results
105
- - `offset` (number, optional) - Pagination offset
106
-
107
- **Output:**
108
- ```json
109
- {
110
- "evidences": [
111
- {
112
- "id": "uuid",
113
- "timestamp": "2024-01-24T00:00:00Z",
114
- "conversationId": "conv-001",
115
- "llmProvider": "Claude Sonnet 4.5",
116
- "messageCount": 10,
117
- "tags": "legal,contract"
118
- }
119
- ],
120
- "total": 1
121
- }
122
- ```
60
+ Lists all captured evidence with pagination.
123
61
 
124
62
  ### get-evidence
125
-
126
- Retrieve and decrypt specific evidence.
127
-
128
- **Input:**
129
- - `id` (string) - Evidence ID
130
-
131
- **Output:**
132
- ```json
133
- {
134
- "id": "uuid",
135
- "timestamp": "2024-01-24T00:00:00Z",
136
- "conversationId": "conv-001",
137
- "llmProvider": "Claude Sonnet 4.5",
138
- "content": "User: ...\nAssistant: ...",
139
- "messageCount": 10,
140
- "gitInfo": {
141
- "commitHash": "abc123",
142
- "timestamp": "2024-01-24T00:00:00Z"
143
- },
144
- "tags": "legal"
145
- }
146
- ```
63
+ Retrieves and decrypts specific evidence by ID.
147
64
 
148
65
  ### export-evidences
149
-
150
- Export evidences to encrypted ZIP archive.
151
-
152
- **Input:**
153
- - `evidenceIds` (string[], optional) - Specific IDs (empty = all)
154
- - `includeGitInfo` (boolean, optional) - Include Git timestamps
155
-
156
- **Output:**
157
- ```json
158
- {
159
- "filename": "evidence-export-2024-01-24.zip",
160
- "checksum": "sha256-hash",
161
- "evidenceCount": 5,
162
- "success": true
163
- }
164
- ```
165
-
166
- ## MCP Resources
167
-
168
- ### evidence://{id}
169
-
170
- Access decrypted evidence content via URI.
171
-
172
- **Example:**
173
- ```
174
- evidence://550e8400-e29b-41d4-a716-446655440000
175
- ```
176
-
177
- Returns plain text content of the evidence.
178
-
179
- ## Programmatic Usage
180
-
181
- ```typescript
182
- import { EvidenceMCPServer } from '@pcircle/evidencemcp-server';
183
-
184
- const server = new EvidenceMCPServer({
185
- dbPath: './evidence.db',
186
- password: 'your-password'
187
- });
188
-
189
- await server.start();
190
- ```
66
+ Exports evidence to encrypted ZIP archive.
191
67
 
192
68
  ## Security
193
69
 
194
- - **Encryption**: XChaCha20-Poly1305 (256-bit keys)
195
- - **Key Derivation**: Argon2id (OWASP recommended params)
196
- - **Content Integrity**: SHA-256 hashing
197
- - **Local Storage**: SQLite with encrypted BLOB fields
198
-
199
- ⚠️ **Important**: Store your `EVIDENCEMCP_PASSWORD` securely (e.g., macOS Keychain). Loss of password means permanent data loss.
200
-
201
- ## Architecture
202
-
203
- ```
204
- ┌─────────────────┐
205
- │ LLM Client │ (Claude Desktop, ChatGPT, etc.)
206
- │ (MCP Client) │
207
- └────────┬────────┘
208
- │ MCP Protocol (stdio)
209
-
210
- ┌─────────────────┐
211
- │ EvidenceMCP MCP │
212
- │ Server │
213
- ├─────────────────┤
214
- │ Tools: │
215
- │ - capture │
216
- │ - list │
217
- │ - export │
218
- │ - get │
219
- ├─────────────────┤
220
- │ Resources: │
221
- │ - evidence:// │
222
- └────────┬────────┘
223
-
224
-
225
- ┌─────────────────┐ ┌──────────────┐
226
- │ @evidencemcp/ │────▶│ XChaCha20 │
227
- │ crypto │ │ -Poly1305 │
228
- └─────────────────┘ └──────────────┘
229
-
230
-
231
- ┌─────────────────┐ ┌──────────────┐
232
- │ @evidencemcp/ │────▶│ SQLite │
233
- │ storage │ │ (encrypted) │
234
- └─────────────────┘ └──────────────┘
235
- ```
236
-
237
- ## Troubleshooting
238
-
239
- ### "EVIDENCEMCP_PASSWORD environment variable required"
240
-
241
- **Problem**: Server fails to start with this error message.
242
-
243
- **Solution**:
244
- 1. Ensure `EVIDENCEMCP_PASSWORD` is set in your environment
245
- 2. For Claude Desktop, verify the `env` section in `claude_desktop_config.json`:
246
- ```json
247
- {
248
- "mcpServers": {
249
- "evidencemcp": {
250
- "env": {
251
- "EVIDENCEMCP_PASSWORD": "your-secure-password"
252
- }
253
- }
254
- }
255
- }
256
- ```
257
- 3. For command line: `export EVIDENCEMCP_PASSWORD="your-password"`
258
- 4. Never commit passwords to version control
259
-
260
- ### "Database locked" or "SQLITE_BUSY"
261
-
262
- **Problem**: Multiple processes trying to access the same database file.
263
-
264
- **Solution**:
265
- 1. Ensure only one EvidenceMCP instance is running
266
- 2. Check for orphaned processes: `ps aux | grep evidencemcp-mcp`
267
- 3. Use unique database paths for different instances:
268
- ```json
269
- {
270
- "evidencemcp-dev": {
271
- "env": {
272
- "EVIDENCEMCP_DB_PATH": "/Users/you/evidencemcp-dev.db"
273
- }
274
- },
275
- "evidencemcp-prod": {
276
- "env": {
277
- "EVIDENCEMCP_DB_PATH": "/Users/you/evidencemcp-prod.db"
278
- }
279
- }
280
- }
281
- ```
282
-
283
- ### "Git not found" or "Git command failed"
284
-
285
- **Problem**: Git timestamp capture fails.
286
-
287
- **Solution**:
288
- 1. Install Git if not present: `brew install git` (macOS) or `apt-get install git` (Linux)
289
- 2. Verify Git is in PATH: `which git`
290
- 3. Git timestamps are optional - evidence capture will succeed without them
291
- 4. Check `.git` directory exists if running in a repository
292
-
293
- ### "Permission denied" on database file
294
-
295
- **Problem**: Cannot read/write database file.
296
-
297
- **Solution**:
298
- 1. Check file permissions: `ls -l /path/to/evidence.db`
299
- 2. Ensure the directory exists and is writable
300
- 3. Verify the user running Claude Desktop has write access
301
- 4. On macOS, grant Full Disk Access if needed (System Settings → Privacy & Security)
302
-
303
- ### "Failed to decrypt evidence" or "Wrong password"
304
-
305
- **Problem**: Cannot decrypt previously stored evidence.
306
-
307
- **Solution**:
308
- 1. Verify you're using the same password that was used to encrypt
309
- 2. Passwords are case-sensitive
310
- 3. Check for trailing spaces or special characters in password
311
- 4. If password is lost, evidence cannot be recovered (by design)
312
-
313
- ### "Export failed" or "ZIP creation error"
314
-
315
- **Problem**: Evidence export fails.
316
-
317
- **Solution**:
318
- 1. Ensure sufficient disk space
319
- 2. Check write permissions in current directory
320
- 3. Verify evidence IDs exist: use `list-evidences` first
321
- 4. Try exporting single evidence item to isolate the issue
322
-
323
- ### High memory usage
324
-
325
- **Problem**: Server consuming excessive memory.
326
-
327
- **Solution**:
328
- 1. Evidence files are loaded into memory during encryption/decryption
329
- 2. For large conversations (>10MB), use pagination with `list-evidences`
330
- 3. Export in smaller batches instead of all at once
331
- 4. Restart Claude Desktop to free memory
332
-
333
- ### TypeScript errors in development
334
-
335
- **Problem**: TypeScript compilation errors.
336
-
337
- **Solution**:
338
- 1. Ensure you're using TypeScript 5.9+: `pnpm add -D typescript@^5.9.3`
339
- 2. Clean build artifacts: `pnpm clean && pnpm build`
340
- 3. Check Node.js version: `node --version` (requires 22+)
341
- 4. Verify dependencies: `pnpm install`
342
-
343
- ## License
70
+ - **Encryption**: XChaCha20-Poly1305 (256-bit)
71
+ - **Key Derivation**: Argon2id (OWASP recommended)
72
+ - **Storage**: Local SQLite with encrypted BLOBs
344
73
 
345
- MIT - See LICENSE file
74
+ ⚠️ **Store your password securely** - Loss means permanent data loss.
346
75
 
347
76
  ## Support
348
77
 
349
- - Issues: https://github.com/evidencemcp/evidencemcp/issues
350
- - Docs: https://evidencemcp.dev
78
+ - [Documentation](https://github.com/PCIRCLE-AI/evidencemcp-server#readme)
79
+ - [Issues](https://github.com/PCIRCLE-AI/evidencemcp-server/issues)
80
+ - [License](https://github.com/PCIRCLE-AI/evidencemcp-server/blob/main/LICENSE)
package/dist/index.d.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import type { ServerConfig } from './types.js';
3
3
  /**
4
- * EvidenceMCP Server
5
- *
6
- * Captures LLM conversations and stores them as encrypted evidence
4
+ * EvidenceMCP Server - Captures LLM conversations as encrypted evidence
7
5
  * with Git timestamps and export capabilities.
8
6
  */
9
7
  export declare class EvidenceMCPServer {
@@ -12,21 +10,9 @@ export declare class EvidenceMCPServer {
12
10
  private db;
13
11
  private derivedKey;
14
12
  constructor(config: ServerConfig);
15
- /**
16
- * Derive encryption key from password (lazy initialization)
17
- */
18
13
  private getDerivedKey;
19
- /**
20
- * Register MCP tools for evidence management
21
- */
22
14
  private registerTools;
23
- /**
24
- * Register MCP resources for evidence access
25
- */
26
15
  private registerResources;
27
- /**
28
- * Start the MCP server with stdio transport
29
- */
30
16
  start(): Promise<void>;
31
17
  }
32
18
  export { EvidenceMCPTestHelpers } from './test-helpers.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAOA,OAAO,KAAK,EAAE,YAAY,EAAyB,MAAM,YAAY,CAAC;AAGtE;;;;;GAKG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,EAAE,CAAmB;IAC7B,OAAO,CAAC,UAAU,CAA2B;gBAEjC,MAAM,EAAE,YAAY;IAsBhC;;OAEG;YACW,aAAa;IAQ3B;;OAEG;IACH,OAAO,CAAC,aAAa;IA0QrB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA0CzB;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7B;AA4BD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAQA,OAAO,KAAK,EAAE,YAAY,EAAyB,MAAM,YAAY,CAAC;AAMtE;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,EAAE,CAAmB;IAC7B,OAAO,CAAC,UAAU,CAA2B;gBAEjC,MAAM,EAAE,YAAY;YAkBlB,aAAa;IAQ3B,OAAO,CAAC,aAAa;IAmNrB,OAAO,CAAC,iBAAiB;IA6BnB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7B;AAwBD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC"}