@pcircle/evidencemcp-server 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 PCIRCLE, LLC
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,350 @@
1
+ # @pcircle/evidencemcp-server
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@pcircle/evidencemcp-server)](https://www.npmjs.com/package/@pcircle/evidencemcp-server)
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
+
8
+ Model Context Protocol (MCP) server for EvidenceMCP - automatically captures and encrypts LLM conversations as legal evidence.
9
+
10
+ ## Why EvidenceMCP?
11
+
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
35
+
36
+ ## Installation
37
+
38
+ ```bash
39
+ pnpm add @pcircle/evidencemcp-server
40
+ ```
41
+
42
+ ## Quick Start
43
+
44
+ ### 1. Set Environment Variables
45
+
46
+ ```bash
47
+ export EVIDENCEMCP_DB_PATH="./evidence.db"
48
+ export EVIDENCEMCP_PASSWORD="your-secure-password"
49
+ ```
50
+
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
+
61
+ ```json
62
+ {
63
+ "mcpServers": {
64
+ "evidencemcp": {
65
+ "command": "npx",
66
+ "args": ["evidencemcp-mcp"],
67
+ "env": {
68
+ "EVIDENCEMCP_DB_PATH": "/path/to/evidence.db",
69
+ "EVIDENCEMCP_PASSWORD": "your-password"
70
+ }
71
+ }
72
+ }
73
+ }
74
+ ```
75
+
76
+ ## MCP Tools
77
+
78
+ ### capture-evidence
79
+
80
+ Capture and encrypt an LLM conversation.
81
+
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
88
+
89
+ **Output:**
90
+ ```json
91
+ {
92
+ "id": "uuid-v4",
93
+ "timestamp": "2024-01-24T00:00:00Z",
94
+ "gitCommitHash": "abc123...",
95
+ "success": true
96
+ }
97
+ ```
98
+
99
+ ### 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
+ ```
123
+
124
+ ### 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
+ ```
147
+
148
+ ### 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
+ ```
191
+
192
+ ## Security
193
+
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
344
+
345
+ MIT - See LICENSE file
346
+
347
+ ## Support
348
+
349
+ - Issues: https://github.com/evidencemcp/evidencemcp/issues
350
+ - Docs: https://evidencemcp.dev
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+ import type { ServerConfig } from './types.js';
3
+ /**
4
+ * EvidenceMCP Server
5
+ *
6
+ * Captures LLM conversations and stores them as encrypted evidence
7
+ * with Git timestamps and export capabilities.
8
+ */
9
+ export declare class EvidenceMCPServer {
10
+ private server;
11
+ private config;
12
+ private db;
13
+ private derivedKey;
14
+ constructor(config: ServerConfig);
15
+ /**
16
+ * Derive encryption key from password (lazy initialization)
17
+ */
18
+ private getDerivedKey;
19
+ /**
20
+ * Register MCP tools for evidence management
21
+ */
22
+ private registerTools;
23
+ /**
24
+ * Register MCP resources for evidence access
25
+ */
26
+ private registerResources;
27
+ /**
28
+ * Start the MCP server with stdio transport
29
+ */
30
+ start(): Promise<void>;
31
+ }
32
+ export { EvidenceMCPTestHelpers } from './test-helpers.js';
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
package/dist/index.js ADDED
@@ -0,0 +1,340 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer, ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
+ import { EvidenceDatabase, getCurrentCommit } from '@evidencemcp/storage';
5
+ import { deriveKey, encrypt, decrypt } from '@evidencemcp/crypto';
6
+ import * as z from 'zod';
7
+ import * as crypto from 'crypto';
8
+ /**
9
+ * EvidenceMCP Server
10
+ *
11
+ * Captures LLM conversations and stores them as encrypted evidence
12
+ * with Git timestamps and export capabilities.
13
+ */
14
+ export class EvidenceMCPServer {
15
+ server;
16
+ config;
17
+ db;
18
+ derivedKey = null;
19
+ constructor(config) {
20
+ this.config = config;
21
+ try {
22
+ // Initialize database with error handling
23
+ this.db = new EvidenceDatabase(config.dbPath);
24
+ }
25
+ catch (error) {
26
+ const errorMsg = error instanceof Error ? error.message : 'Unknown error';
27
+ throw new Error(`Failed to initialize database: ${errorMsg}`);
28
+ }
29
+ // Initialize MCP server
30
+ this.server = new McpServer({
31
+ name: config.name || 'traceguard-mcp',
32
+ version: config.version || '0.1.0'
33
+ });
34
+ // Register tools and resources (will implement in later steps)
35
+ this.registerTools();
36
+ this.registerResources();
37
+ }
38
+ /**
39
+ * Derive encryption key from password (lazy initialization)
40
+ */
41
+ async getDerivedKey() {
42
+ if (!this.derivedKey) {
43
+ const result = await deriveKey(this.config.password);
44
+ this.derivedKey = result.key;
45
+ }
46
+ return this.derivedKey;
47
+ }
48
+ /**
49
+ * Register MCP tools for evidence management
50
+ */
51
+ registerTools() {
52
+ // Tool 1: capture-evidence
53
+ this.server.registerTool('capture-evidence', {
54
+ title: 'Capture Evidence',
55
+ description: 'Capture and encrypt LLM conversation as evidence',
56
+ inputSchema: {
57
+ conversationId: z.string().describe('Conversation ID'),
58
+ llmProvider: z.string().describe('LLM provider name (e.g., Claude Sonnet 4.5)'),
59
+ content: z.string().describe('Conversation content (messages, prompts, responses)'),
60
+ messageCount: z.number().int().positive().describe('Number of messages'),
61
+ tags: z.string().optional().describe('Optional tags (comma-separated)')
62
+ },
63
+ outputSchema: {
64
+ id: z.string(),
65
+ timestamp: z.string(),
66
+ gitCommitHash: z.string().nullable(),
67
+ success: z.boolean()
68
+ }
69
+ }, async (params) => {
70
+ try {
71
+ // Input validation
72
+ if (!params.content || params.content.trim().length === 0) {
73
+ throw new Error('Content cannot be empty');
74
+ }
75
+ if (params.messageCount <= 0) {
76
+ throw new Error('Message count must be positive');
77
+ }
78
+ // Derive encryption key
79
+ const key = await this.getDerivedKey();
80
+ // Encrypt content
81
+ const encrypted = await encrypt(params.content, key);
82
+ // Get Git timestamp
83
+ const gitInfo = await getCurrentCommit();
84
+ // Calculate content hash
85
+ const hash = crypto.createHash('sha256');
86
+ hash.update(params.content);
87
+ const contentHash = hash.digest('hex');
88
+ // Store evidence
89
+ const id = this.db.create({
90
+ timestamp: new Date().toISOString(),
91
+ conversationId: params.conversationId,
92
+ llmProvider: params.llmProvider,
93
+ encryptedContent: encrypted.ciphertext,
94
+ nonce: encrypted.nonce,
95
+ contentHash,
96
+ messageCount: params.messageCount,
97
+ gitCommitHash: gitInfo?.commitHash || null,
98
+ gitTimestamp: gitInfo?.timestamp || null,
99
+ tags: params.tags || null
100
+ });
101
+ const output = {
102
+ id,
103
+ timestamp: new Date().toISOString(),
104
+ gitCommitHash: gitInfo?.commitHash || null,
105
+ success: true
106
+ };
107
+ return {
108
+ content: [{
109
+ type: 'text',
110
+ text: `Evidence captured successfully. ID: ${id}`
111
+ }],
112
+ structuredContent: output
113
+ };
114
+ }
115
+ catch (error) {
116
+ const errorMsg = error instanceof Error ? error.message : 'Unknown error';
117
+ throw new Error(`[Tool: capture-evidence] ${errorMsg}`);
118
+ }
119
+ });
120
+ // Tool 2: list-evidences
121
+ this.server.registerTool('list-evidences', {
122
+ title: 'List Evidences',
123
+ description: 'List all captured evidence with pagination',
124
+ inputSchema: {
125
+ limit: z.number().int().positive().optional().describe('Maximum results'),
126
+ offset: z.number().int().min(0).optional().describe('Pagination offset')
127
+ },
128
+ outputSchema: {
129
+ evidences: z.array(z.object({
130
+ id: z.string(),
131
+ timestamp: z.string(),
132
+ conversationId: z.string(),
133
+ llmProvider: z.string(),
134
+ messageCount: z.number(),
135
+ tags: z.string().nullable()
136
+ })),
137
+ total: z.number()
138
+ }
139
+ }, async (params) => {
140
+ try {
141
+ // Input validation
142
+ if (params.limit !== undefined && params.limit <= 0) {
143
+ throw new Error('Limit must be positive');
144
+ }
145
+ if (params.offset !== undefined && params.offset < 0) {
146
+ throw new Error('Offset cannot be negative');
147
+ }
148
+ const evidences = this.db.list({
149
+ limit: params.limit,
150
+ offset: params.offset
151
+ });
152
+ const output = {
153
+ evidences: evidences.map(e => ({
154
+ id: e.id,
155
+ timestamp: e.timestamp,
156
+ conversationId: e.conversationId,
157
+ llmProvider: e.llmProvider,
158
+ messageCount: e.messageCount,
159
+ tags: e.tags
160
+ })),
161
+ total: evidences.length
162
+ };
163
+ return {
164
+ content: [{
165
+ type: 'text',
166
+ text: `Found ${evidences.length} evidence(s)`
167
+ }],
168
+ structuredContent: output
169
+ };
170
+ }
171
+ catch (error) {
172
+ const errorMsg = error instanceof Error ? error.message : 'Unknown error';
173
+ throw new Error(`[Tool: list-evidences] ${errorMsg}`);
174
+ }
175
+ });
176
+ // Tool 3: export-evidences
177
+ this.server.registerTool('export-evidences', {
178
+ title: 'Export Evidences',
179
+ description: 'Export evidences to encrypted ZIP archive',
180
+ inputSchema: {
181
+ evidenceIds: z.array(z.string()).optional().describe('Specific IDs (empty = all)'),
182
+ includeGitInfo: z.boolean().optional().describe('Include Git timestamps')
183
+ },
184
+ outputSchema: {
185
+ filename: z.string(),
186
+ checksum: z.string(),
187
+ evidenceCount: z.number(),
188
+ success: z.boolean()
189
+ }
190
+ }, async (params) => {
191
+ try {
192
+ const { exportEvidences } = await import('@evidencemcp/storage');
193
+ const result = await exportEvidences(this.db, {
194
+ evidenceIds: params.evidenceIds,
195
+ includeGitInfo: params.includeGitInfo ?? false
196
+ });
197
+ // Write ZIP to file
198
+ const fs = await import('fs');
199
+ fs.writeFileSync(result.filename, result.zipData);
200
+ const output = {
201
+ filename: result.filename,
202
+ checksum: result.checksum,
203
+ evidenceCount: result.evidenceCount,
204
+ success: true
205
+ };
206
+ return {
207
+ content: [{
208
+ type: 'text',
209
+ text: `Exported ${result.evidenceCount} evidence(s) to ${result.filename}`
210
+ }],
211
+ structuredContent: output
212
+ };
213
+ }
214
+ catch (error) {
215
+ const errorMsg = error instanceof Error ? error.message : 'Unknown error';
216
+ throw new Error(`[Tool: export-evidences] ${errorMsg}`);
217
+ }
218
+ });
219
+ // Tool 4: get-evidence
220
+ this.server.registerTool('get-evidence', {
221
+ title: 'Get Evidence',
222
+ description: 'Retrieve and decrypt specific evidence by ID',
223
+ inputSchema: {
224
+ id: z.string().describe('Evidence ID')
225
+ },
226
+ outputSchema: {
227
+ id: z.string(),
228
+ timestamp: z.string(),
229
+ conversationId: z.string(),
230
+ llmProvider: z.string(),
231
+ content: z.string(),
232
+ messageCount: z.number(),
233
+ gitInfo: z.object({
234
+ commitHash: z.string(),
235
+ timestamp: z.string()
236
+ }).nullable(),
237
+ tags: z.string().nullable()
238
+ }
239
+ }, async (params) => {
240
+ try {
241
+ const evidence = this.db.findById(params.id);
242
+ if (!evidence) {
243
+ throw new Error(`Evidence not found: ${params.id}`);
244
+ }
245
+ // Decrypt content
246
+ const { decrypt } = await import('@evidencemcp/crypto');
247
+ const key = await this.getDerivedKey();
248
+ const decrypted = decrypt(evidence.encryptedContent, evidence.nonce, key);
249
+ const output = {
250
+ id: evidence.id,
251
+ timestamp: evidence.timestamp,
252
+ conversationId: evidence.conversationId,
253
+ llmProvider: evidence.llmProvider,
254
+ content: decrypted,
255
+ messageCount: evidence.messageCount,
256
+ gitInfo: evidence.gitCommitHash ? {
257
+ commitHash: evidence.gitCommitHash,
258
+ timestamp: evidence.gitTimestamp
259
+ } : null,
260
+ tags: evidence.tags
261
+ };
262
+ return {
263
+ content: [{
264
+ type: 'text',
265
+ text: `Evidence ID: ${evidence.id}\nContent: ${decrypted.substring(0, 100)}...`
266
+ }],
267
+ structuredContent: output
268
+ };
269
+ }
270
+ catch (error) {
271
+ const errorMsg = error instanceof Error ? error.message : 'Unknown error';
272
+ throw new Error(`[Tool: get-evidence] ${errorMsg}`);
273
+ }
274
+ });
275
+ }
276
+ /**
277
+ * Register MCP resources for evidence access
278
+ */
279
+ registerResources() {
280
+ // Resource: evidence://{id}
281
+ this.server.registerResource('evidence', new ResourceTemplate('evidence://{id}', { list: undefined }), {
282
+ title: 'Evidence Content',
283
+ description: 'Access encrypted evidence record by ID',
284
+ mimeType: 'text/plain'
285
+ }, async (uri, { id }) => {
286
+ try {
287
+ // Find evidence by ID
288
+ const evidence = this.db.findById(id);
289
+ if (!evidence) {
290
+ throw new Error(`Evidence with ID ${id} not found`);
291
+ }
292
+ // Decrypt content using correct 3-argument signature
293
+ const key = await this.getDerivedKey();
294
+ const decrypted = decrypt(evidence.encryptedContent, evidence.nonce, key);
295
+ return {
296
+ contents: [{
297
+ uri: uri.href,
298
+ mimeType: 'text/plain',
299
+ text: decrypted
300
+ }]
301
+ };
302
+ }
303
+ catch (error) {
304
+ const errorMsg = error instanceof Error ? error.message : 'Unknown error';
305
+ throw new Error(`Failed to access evidence resource: ${errorMsg}`);
306
+ }
307
+ });
308
+ }
309
+ /**
310
+ * Start the MCP server with stdio transport
311
+ */
312
+ async start() {
313
+ const transport = new StdioServerTransport();
314
+ await this.server.connect(transport);
315
+ }
316
+ }
317
+ // CLI entry point
318
+ async function main() {
319
+ // Read config from environment variables
320
+ const config = {
321
+ dbPath: process.env.EVIDENCEMCP_DB_PATH || './evidence.db',
322
+ password: process.env.EVIDENCEMCP_PASSWORD || ''
323
+ };
324
+ if (!config.password) {
325
+ console.error('Error: EVIDENCEMCP_PASSWORD environment variable required');
326
+ process.exit(1);
327
+ }
328
+ const server = new EvidenceMCPServer(config);
329
+ await server.start();
330
+ }
331
+ // Run if called directly
332
+ if (import.meta.url === `file://${process.argv[1]}`) {
333
+ main().catch((error) => {
334
+ console.error('Server error:', error);
335
+ process.exit(1);
336
+ });
337
+ }
338
+ // Export test helpers for testing
339
+ export { EvidenceMCPTestHelpers } from './test-helpers.js';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AC;IACpD,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACrB,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,kCAAkC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Test Helper Utilities for EvidenceMCP Server
3
+ *
4
+ * This module provides type-safe testing utilities without exposing
5
+ * internal implementation details through `as any` casts.
6
+ */
7
+ import type { EvidenceMCPServer } from './index.js';
8
+ /**
9
+ * Tool information for testing
10
+ */
11
+ export interface ToolInfo {
12
+ name: string;
13
+ description: string;
14
+ }
15
+ /**
16
+ * Resource information for testing
17
+ */
18
+ export interface ResourceInfo {
19
+ name: string;
20
+ uriTemplate: string;
21
+ description: string;
22
+ mimeType: string;
23
+ }
24
+ /**
25
+ * Test Helpers for EvidenceMCP Server
26
+ */
27
+ export declare class EvidenceMCPTestHelpers {
28
+ private server;
29
+ constructor(server: EvidenceMCPServer);
30
+ /**
31
+ * Get list of registered tools (for testing)
32
+ */
33
+ getTools(): Promise<ToolInfo[]>;
34
+ /**
35
+ * Get list of registered resources (for testing)
36
+ */
37
+ getResources(): Promise<ResourceInfo[]>;
38
+ /**
39
+ * Read a resource by URI (for testing)
40
+ */
41
+ readResource(uri: string): Promise<any>;
42
+ /**
43
+ * Execute a tool by name (for testing)
44
+ */
45
+ executeTool(toolName: string, params: any): Promise<any>;
46
+ /**
47
+ * Call a tool directly (for testing)
48
+ */
49
+ callTool(name: string, params: any): Promise<any>;
50
+ }
51
+ //# sourceMappingURL=test-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["../src/test-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAwCD;;GAEG;AACH,qBAAa,sBAAsB;IACrB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,iBAAiB;IAE7C;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAwBrC;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IA8B7C;;OAEG;IACG,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IA2C7C;;OAEG;IACG,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IA4B9D;;OAEG;IACG,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;CAQxD"}
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Test Helper Utilities for EvidenceMCP Server
3
+ *
4
+ * This module provides type-safe testing utilities without exposing
5
+ * internal implementation details through `as any` casts.
6
+ */
7
+ /**
8
+ * Helper to safely access registry using Reflection API
9
+ */
10
+ function getRegistry(obj, key) {
11
+ return Reflect.get(obj, key);
12
+ }
13
+ /**
14
+ * Extract items from Map, Array, or Object registry
15
+ */
16
+ function extractFromRegistry(registry, mapExtractor, arrayExtractor, objectExtractor) {
17
+ if (!registry) {
18
+ return [];
19
+ }
20
+ // Check if it's a Map
21
+ if (registry instanceof Map || (registry && typeof registry.entries === 'function')) {
22
+ return mapExtractor(registry.entries());
23
+ }
24
+ // Check if it's an Array
25
+ if (Array.isArray(registry)) {
26
+ return arrayExtractor(registry);
27
+ }
28
+ // Check if it's an Object
29
+ if (typeof registry === 'object') {
30
+ return objectExtractor(Object.entries(registry));
31
+ }
32
+ return [];
33
+ }
34
+ /**
35
+ * Test Helpers for EvidenceMCP Server
36
+ */
37
+ export class EvidenceMCPTestHelpers {
38
+ server;
39
+ constructor(server) {
40
+ this.server = server;
41
+ }
42
+ /**
43
+ * Get list of registered tools (for testing)
44
+ */
45
+ async getTools() {
46
+ const serverInternal = this.server;
47
+ const tools = getRegistry(serverInternal.server, '_registeredTools');
48
+ return extractFromRegistry(tools,
49
+ // Map extractor
50
+ (entries) => Array.from(entries).map(([name, tool]) => ({
51
+ name,
52
+ description: tool.description || tool.title
53
+ })),
54
+ // Array extractor
55
+ (items) => items.map((tool) => ({
56
+ name: tool.name,
57
+ description: tool.description
58
+ })),
59
+ // Object extractor
60
+ (entries) => entries.map(([name, tool]) => ({
61
+ name,
62
+ description: tool.description || tool.title
63
+ })));
64
+ }
65
+ /**
66
+ * Get list of registered resources (for testing)
67
+ */
68
+ async getResources() {
69
+ const serverInternal = this.server;
70
+ const templates = getRegistry(serverInternal.server, '_registeredResourceTemplates');
71
+ return extractFromRegistry(templates,
72
+ // Map extractor
73
+ (entries) => Array.from(entries).map(([name, template]) => ({
74
+ name,
75
+ uriTemplate: template.uriTemplate,
76
+ description: template.description || '',
77
+ mimeType: template.mimeType || 'text/plain'
78
+ })),
79
+ // Array extractor
80
+ (items) => items.map((template) => ({
81
+ name: template.name,
82
+ uriTemplate: template.uriTemplate,
83
+ description: template.description || '',
84
+ mimeType: template.mimeType || 'text/plain'
85
+ })),
86
+ // Object extractor
87
+ (entries) => entries.map(([name, template]) => ({
88
+ name,
89
+ uriTemplate: template.resourceTemplate?._uriTemplate?.template || template.uriTemplate || '',
90
+ description: template.metadata?.description || template.description || '',
91
+ mimeType: template.metadata?.mimeType || template.mimeType || 'text/plain'
92
+ })));
93
+ }
94
+ /**
95
+ * Read a resource by URI (for testing)
96
+ */
97
+ async readResource(uri) {
98
+ const serverInternal = this.server;
99
+ const templates = getRegistry(serverInternal.server, '_registeredResourceTemplates');
100
+ if (!templates) {
101
+ throw new Error('No resources registered');
102
+ }
103
+ // Parse URI to get resource name and ID
104
+ const match = uri.match(/^(\w+):\/\/(.+)$/);
105
+ if (!match) {
106
+ throw new Error('Unknown resource');
107
+ }
108
+ const [, resourceName, id] = match;
109
+ // Find matching template
110
+ let handler = null;
111
+ if (templates instanceof Map) {
112
+ handler = templates.get(resourceName);
113
+ }
114
+ else if (Array.isArray(templates)) {
115
+ handler = templates.find((t) => t.name === resourceName);
116
+ }
117
+ else if (typeof templates === 'object') {
118
+ handler = templates[resourceName];
119
+ }
120
+ if (!handler) {
121
+ throw new Error('Unknown resource');
122
+ }
123
+ // The handler might be in readCallback or handler field
124
+ const handlerFn = handler.readCallback || handler.handler;
125
+ if (!handlerFn) {
126
+ throw new Error('Unknown resource');
127
+ }
128
+ // Call the handler with parsed parameters
129
+ const result = await handlerFn({ href: uri }, { id });
130
+ return result;
131
+ }
132
+ /**
133
+ * Execute a tool by name (for testing)
134
+ */
135
+ async executeTool(toolName, params) {
136
+ const serverInternal = this.server;
137
+ const tools = getRegistry(serverInternal.server, '_registeredTools');
138
+ if (!tools) {
139
+ throw new Error('No tools registered');
140
+ }
141
+ // Find the tool
142
+ let tool = null;
143
+ if (tools instanceof Map) {
144
+ tool = tools.get(toolName);
145
+ }
146
+ else if (Array.isArray(tools)) {
147
+ tool = tools.find((t) => t.name === toolName);
148
+ }
149
+ else if (typeof tools === 'object') {
150
+ tool = tools[toolName];
151
+ }
152
+ if (!tool || !tool.handler) {
153
+ throw new Error(`Tool ${toolName} not found`);
154
+ }
155
+ // Execute the tool handler
156
+ const result = await tool.handler(params);
157
+ return result.structuredContent || result;
158
+ }
159
+ /**
160
+ * Call a tool directly (for testing)
161
+ */
162
+ async callTool(name, params) {
163
+ const result = await this.executeTool(name, params);
164
+ // Wrap in expected response format for compatibility
165
+ return {
166
+ structuredContent: result
167
+ };
168
+ }
169
+ }
170
+ //# sourceMappingURL=test-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-helpers.js","sourceRoot":"","sources":["../src/test-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAsBH;;GAEG;AACH,SAAS,WAAW,CAAC,GAAQ,EAAE,GAAW;IACxC,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC/B,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB,CAC1B,QAAa,EACb,YAAuD,EACvD,cAAqC,EACrC,eAAkD;IAElD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,sBAAsB;IACtB,IAAI,QAAQ,YAAY,GAAG,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,CAAC,OAAO,KAAK,UAAU,CAAC,EAAE,CAAC;QACpF,OAAO,YAAY,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,yBAAyB;IACzB,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,OAAO,cAAc,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED,0BAA0B;IAC1B,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,sBAAsB;IACb;IAApB,YAAoB,MAAyB;QAAzB,WAAM,GAAN,MAAM,CAAmB;IAAG,CAAC;IAEjD;;OAEG;IACH,KAAK,CAAC,QAAQ;QACZ,MAAM,cAAc,GAAG,IAAI,CAAC,MAAa,CAAC;QAC1C,MAAM,KAA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ath: string;
7
+ /** Password for encrypting/decrypting evidence */
8
+ password: string;
9
+ /** Server name (for MCP protocol) */
10
+ name?: string;
11
+ /** Server version */
12
+ version?: string;
13
+ }
14
+ /**
15
+ * Evidence capture request parameters
16
+ */
17
+ export interface CaptureEvidenceParams {
18
+ /** Conversation ID (e.g., Claude session ID) */
19
+ conversationId: string;
20
+ /** LLM provider name */
21
+ llmProvider: string;
22
+ /** Conversation content (messages, prompts, responses) */
23
+ content: string;
24
+ /** Number of messages in conversation */
25
+ messageCount: number;
26
+ /** Optional tags for categorization */
27
+ tags?: string;
28
+ }
29
+ /**
30
+ * Evidence list request parameters
31
+ */
32
+ export interface ListEvidencesParams {
33
+ /** Maximum number of results */
34
+ limit?: number;
35
+ /** Offset for pagination */
36
+ offset?: number;
37
+ }
38
+ /**
39
+ * Evidence export request parameters
40
+ */
41
+ export interface ExportEvidencesParams {
42
+ /** Specific evidence IDs to export (empty = all) */
43
+ evidenceIds?: string[];
44
+ /** Include git info in export */
45
+ includeGitInfo?: boolean;
46
+ }
47
+ /**
48
+ * Get evidence request parameters
49
+ */
50
+ export interface GetEvidenceParams {
51
+ /** Evidence ID to retrieve */
52
+ id: string;
53
+ }
54
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IAEf,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;IAEjB,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,qBAAqB;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,gDAAgD;IAChD,cAAc,EAAE,MAAM,CAAC;IAEvB,wBAAwB;IACxB,WAAW,EAAE,MAAM,CAAC;IAEpB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;IAEhB,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAC;IAErB,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAEvB,iCAAiC;IACjC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,8BAA8B;IAC9B,EAAE,EAAE,MAAM,CAAC;CACZ"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@pcircle/evidencemcp-server",
3
+ "version": "0.1.0",
4
+ "description": "Model Context Protocol (MCP) server for EvidenceMCP - automatically capture and encrypt LLM conversations as legal evidence with Git timestamps",
5
+ "keywords": [
6
+ "mcp",
7
+ "model-context-protocol",
8
+ "llm",
9
+ "evidence",
10
+ "encryption",
11
+ "evidencemcp",
12
+ "claude",
13
+ "chatgpt",
14
+ "legal",
15
+ "audit",
16
+ "timestamp"
17
+ ],
18
+ "author": "PCIRCLE, LLC",
19
+ "license": "MIT",
20
+ "type": "module",
21
+ "main": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
23
+ "bin": {
24
+ "evidencemcp": "./dist/index.js"
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "README.md",
29
+ "LICENSE"
30
+ ],
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/PCIRCLE-AI/evidencemcp-server.git"
34
+ },
35
+ "bugs": {
36
+ "url": "https://github.com/PCIRCLE-AI/evidencemcp-server/issues"
37
+ },
38
+ "homepage": "https://evidencemcp.cc",
39
+ "scripts": {
40
+ "build": "tsc",
41
+ "dev": "tsc --watch",
42
+ "test": "vitest",
43
+ "test:run": "vitest run",
44
+ "clean": "rm -rf dist",
45
+ "prepublishOnly": "pnpm clean && pnpm build && pnpm test:run"
46
+ },
47
+ "dependencies": {
48
+ "@modelcontextprotocol/sdk": "^1.0.4",
49
+ "@evidencemcp/crypto": "workspace:*",
50
+ "@evidencemcp/storage": "workspace:*",
51
+ "zod": "^3.23.8"
52
+ },
53
+ "devDependencies": {
54
+ "@types/node": "^22.10.5",
55
+ "tsx": "^4.21.0",
56
+ "typescript": "^5.9.3",
57
+ "vitest": "^1.6.1"
58
+ },
59
+ "engines": {
60
+ "node": ">=22.0.0"
61
+ }
62
+ }