@uvrn/mcp 1.0.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 (42) hide show
  1. package/README.md +446 -0
  2. package/dist/__tests__/fixtures/bundles.d.ts +4 -0
  3. package/dist/__tests__/fixtures/bundles.d.ts.map +1 -0
  4. package/dist/__tests__/fixtures/bundles.js +75 -0
  5. package/dist/__tests__/fixtures/bundles.js.map +1 -0
  6. package/dist/config.d.ts +8 -0
  7. package/dist/config.d.ts.map +1 -0
  8. package/dist/config.js +26 -0
  9. package/dist/config.js.map +1 -0
  10. package/dist/index.d.ts +7 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +33 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/logger.d.ts +17 -0
  15. package/dist/logger.d.ts.map +1 -0
  16. package/dist/logger.js +45 -0
  17. package/dist/logger.js.map +1 -0
  18. package/dist/prompts/templates.d.ts +34 -0
  19. package/dist/prompts/templates.d.ts.map +1 -0
  20. package/dist/prompts/templates.js +102 -0
  21. package/dist/prompts/templates.js.map +1 -0
  22. package/dist/resources/handlers.d.ts +33 -0
  23. package/dist/resources/handlers.d.ts.map +1 -0
  24. package/dist/resources/handlers.js +94 -0
  25. package/dist/resources/handlers.js.map +1 -0
  26. package/dist/server.d.ts +14 -0
  27. package/dist/server.d.ts.map +1 -0
  28. package/dist/server.js +256 -0
  29. package/dist/server.js.map +1 -0
  30. package/dist/tools/handlers.d.ts +21 -0
  31. package/dist/tools/handlers.d.ts.map +1 -0
  32. package/dist/tools/handlers.js +141 -0
  33. package/dist/tools/handlers.js.map +1 -0
  34. package/dist/tools/schemas.d.ts +147 -0
  35. package/dist/tools/schemas.d.ts.map +1 -0
  36. package/dist/tools/schemas.js +109 -0
  37. package/dist/tools/schemas.js.map +1 -0
  38. package/dist/types.d.ts +70 -0
  39. package/dist/types.d.ts.map +1 -0
  40. package/dist/types.js +43 -0
  41. package/dist/types.js.map +1 -0
  42. package/package.json +50 -0
package/README.md ADDED
@@ -0,0 +1,446 @@
1
+ # @uvrn/mcp
2
+
3
+ **MCP Server for UVRN Delta Engine - AI-Native Bundle Processing**
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@uvrn/mcp.svg)](https://www.npmjs.com/package/@uvrn/mcp)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ ## Overview
9
+
10
+ The Delta Engine MCP server exposes UVRN's Delta Engine functionality to AI assistants through the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/). This enables AI assistants like Claude Desktop to process bundles, validate data structures, and verify receipts without any adapter code.
11
+
12
+ ### What is MCP?
13
+
14
+ **Model Context Protocol (MCP)** is an open standard for connecting AI assistants to external tools and data sources. Think of it as a universal "plugin system" for AI assistants.
15
+
16
+ ### Why Use This Server?
17
+
18
+ - **AI-Native Integration**: Use Delta Engine directly from Claude Desktop or any MCP-compatible client
19
+ - **Zero Adapter Code**: No need to write custom integrations—just configure and go
20
+ - **Type-Safe Operations**: Full TypeScript type safety with comprehensive validation
21
+ - **Production Ready**: Battle-tested validation, error handling, and logging
22
+
23
+ ## Features
24
+
25
+ ### 🔧 Three MCP Tools
26
+
27
+ | Tool | Description |
28
+ |------|-------------|
29
+ | **`delta_run_engine`** | Execute Delta Engine on bundles to verify data consensus across sources |
30
+ | **`delta_validate_bundle`** | Validate bundle structure without executing (fast pre-flight check) |
31
+ | **`delta_verify_receipt`** | Verify receipt integrity by recomputing hashes |
32
+
33
+ ### 📦 Four MCP Resources
34
+
35
+ | Resource URI | Description |
36
+ |--------------|-------------|
37
+ | `mcp://delta-engine/schema/bundle` | JSON schema for DeltaBundle structure |
38
+ | `mcp://delta-engine/schema/receipt` | JSON schema for DeltaReceipt structure |
39
+ | `mcp://delta-engine/receipts/{uvrn}` | Retrieve receipts by UVRN *(storage not yet implemented)* |
40
+ | `mcp://delta-engine/bundles/{id}` | Retrieve bundles by ID *(storage not yet implemented)* |
41
+
42
+ ### 💡 Three MCP Prompts
43
+
44
+ | Prompt | Description |
45
+ |--------|-------------|
46
+ | **`verify_data`** | Template for data verification queries |
47
+ | **`create_bundle`** | Guided bundle creation with placeholder data |
48
+ | **`analyze_receipt`** | Receipt analysis and explanation template |
49
+
50
+ ## Installation
51
+
52
+ ### Global Installation (Recommended for CLI use)
53
+
54
+ ```bash
55
+ npm install -g @uvrn/mcp
56
+ ```
57
+
58
+ ### Local Project Installation
59
+
60
+ ```bash
61
+ npm install @uvrn/mcp
62
+ ```
63
+
64
+ ### Requirements
65
+
66
+ - Node.js >= 18.0.0
67
+ - npm >= 9.0.0
68
+
69
+ ## Quick Start
70
+
71
+ ### Claude Desktop Configuration
72
+
73
+ Add to your `claude_desktop_config.json`:
74
+
75
+ **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
76
+ **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
77
+
78
+ ```json
79
+ {
80
+ "mcpServers": {
81
+ "delta-engine": {
82
+ "command": "npx",
83
+ "args": ["-y", "@uvrn/mcp"]
84
+ }
85
+ }
86
+ }
87
+ ```
88
+
89
+ **With environment variables:**
90
+
91
+ ```json
92
+ {
93
+ "mcpServers": {
94
+ "delta-engine": {
95
+ "command": "npx",
96
+ "args": ["-y", "@uvrn/mcp"],
97
+ "env": {
98
+ "LOG_LEVEL": "info",
99
+ "MAX_BUNDLE_SIZE": "10485760"
100
+ }
101
+ }
102
+ }
103
+ }
104
+ ```
105
+
106
+ Restart Claude Desktop, and the Delta Engine tools will be available!
107
+
108
+ ### Running Standalone
109
+
110
+ ```bash
111
+ # Global installation
112
+ uvrn-mcp
113
+
114
+ # Using npx
115
+ npx @uvrn/mcp
116
+
117
+ # Local installation
118
+ node node_modules/@uvrn/mcp/dist/index.js
119
+ ```
120
+
121
+ ## Tools Reference
122
+
123
+ ### `delta_run_engine`
124
+
125
+ Execute the Delta Engine on a bundle to verify data consensus.
126
+
127
+ **Input:**
128
+ ```json
129
+ {
130
+ "bundle": {
131
+ "bundleId": "test-bundle-001",
132
+ "claim": "Product X has 10,000 sales",
133
+ "dataSpecs": [
134
+ {
135
+ "id": "source-1",
136
+ "label": "Internal CRM",
137
+ "sourceKind": "report",
138
+ "originDocIds": ["crm-2024-01"],
139
+ "metrics": [
140
+ { "key": "sales_count", "value": 10000 }
141
+ ]
142
+ },
143
+ {
144
+ "id": "source-2",
145
+ "label": "Analytics Platform",
146
+ "sourceKind": "metric",
147
+ "originDocIds": ["analytics-dashboard"],
148
+ "metrics": [
149
+ { "key": "sales_count", "value": 9950 }
150
+ ]
151
+ }
152
+ ],
153
+ "thresholdPct": 0.05
154
+ }
155
+ }
156
+ ```
157
+
158
+ **Output:**
159
+ ```json
160
+ {
161
+ "receipt": {
162
+ "bundleId": "test-bundle-001",
163
+ "deltaFinal": 50,
164
+ "outcome": "consensus",
165
+ "rounds": [...],
166
+ "hash": "sha256:abc123...",
167
+ "ts": "2026-01-15T12:00:00Z"
168
+ },
169
+ "success": true
170
+ }
171
+ ```
172
+
173
+ **Error Scenarios:**
174
+ - `VALIDATION_ERROR`: Bundle structure invalid or thresholdPct out of range
175
+ - `EXECUTION_ERROR`: Engine execution failed (check bundle data)
176
+
177
+ ---
178
+
179
+ ### `delta_validate_bundle`
180
+
181
+ Validate bundle structure without executing the engine.
182
+
183
+ **Input:**
184
+ ```json
185
+ {
186
+ "bundle": {
187
+ "bundleId": "test-bundle-001",
188
+ "claim": "...",
189
+ "dataSpecs": [...],
190
+ "thresholdPct": 0.05
191
+ }
192
+ }
193
+ ```
194
+
195
+ **Output (Success):**
196
+ ```json
197
+ {
198
+ "valid": true,
199
+ "details": "Bundle \"test-bundle-001\" is valid with 2 data specs"
200
+ }
201
+ ```
202
+
203
+ **Output (Failure):**
204
+ ```json
205
+ {
206
+ "valid": false,
207
+ "error": "thresholdPct must be > 0 and <= 1",
208
+ "details": "thresholdPct must be > 0 and <= 1"
209
+ }
210
+ ```
211
+
212
+ ---
213
+
214
+ ### `delta_verify_receipt`
215
+
216
+ Verify receipt integrity by recomputing its hash.
217
+
218
+ **Input:**
219
+ ```json
220
+ {
221
+ "receipt": {
222
+ "bundleId": "test-bundle-001",
223
+ "deltaFinal": 50,
224
+ "sources": ["source-1", "source-2"],
225
+ "rounds": [...],
226
+ "outcome": "consensus",
227
+ "hash": "sha256:abc123...",
228
+ "ts": "2026-01-15T12:00:00Z"
229
+ }
230
+ }
231
+ ```
232
+
233
+ **Output (Valid):**
234
+ ```json
235
+ {
236
+ "verified": true,
237
+ "recomputedHash": "sha256:abc123...",
238
+ "details": "Receipt for bundle \"test-bundle-001\" is valid. Hash verified: sha256:abc123..."
239
+ }
240
+ ```
241
+
242
+ **Output (Invalid):**
243
+ ```json
244
+ {
245
+ "verified": false,
246
+ "error": "Hash mismatch",
247
+ "details": "Expected sha256:abc123..., got sha256:def456..."
248
+ }
249
+ ```
250
+
251
+ ## Resources Reference
252
+
253
+ ### Schema Resources
254
+
255
+ **Get Bundle Schema:**
256
+ ```
257
+ URI: mcp://delta-engine/schema/bundle
258
+ Returns: JSON Schema for DeltaBundle
259
+ ```
260
+
261
+ **Get Receipt Schema:**
262
+ ```
263
+ URI: mcp://delta-engine/schema/receipt
264
+ Returns: JSON Schema for DeltaReceipt
265
+ ```
266
+
267
+ ### Data Resources (Not Yet Implemented)
268
+
269
+ > [!NOTE]
270
+ > Receipt and bundle retrieval resources are declared but not functional in Phase A.3 (storage layer not implemented).
271
+
272
+ **Get Receipt by UVRN:**
273
+ ```
274
+ URI: mcp://delta-engine/receipts/{uvrn}
275
+ Status: Planned for future phase
276
+ ```
277
+
278
+ **Get Bundle by ID:**
279
+ ```
280
+ URI: mcp://delta-engine/bundles/{id}
281
+ Status: Planned for future phase
282
+ ```
283
+
284
+ ## Prompts Reference
285
+
286
+ ### `verify_data`
287
+
288
+ Template for data verification queries.
289
+
290
+ **Usage in Claude:**
291
+ ```
292
+ Use the verify_data prompt to help me verify this claim: "..."
293
+ ```
294
+
295
+ ### `create_bundle`
296
+
297
+ Guided bundle creation with examples.
298
+
299
+ **Usage in Claude:**
300
+ ```
301
+ Use the create_bundle prompt to help me create a bundle for verifying revenue data
302
+ ```
303
+
304
+ ### `analyze_receipt`
305
+
306
+ Receipt analysis and explanation.
307
+
308
+ **Usage in Claude:**
309
+ ```
310
+ Use the analyze_receipt prompt to explain this receipt: {...}
311
+ ```
312
+
313
+ ## Configuration
314
+
315
+ See [ENVIRONMENT.md](./ENVIRONMENT.md) for detailed configuration options.
316
+
317
+ ### Environment Variables
318
+
319
+ | Variable | Default | Description |
320
+ |----------|---------|-------------|
321
+ | `LOG_LEVEL` | `info` | Logging verbosity (`debug`, `info`, `warn`, `error`) |
322
+ | `MAX_BUNDLE_SIZE` | `10485760` | Maximum bundle size in bytes (10 MB) |
323
+ | `VERBOSE_ERRORS` | `false` | Include stack traces in error responses |
324
+ | `STORAGE_PATH` | (none) | Optional storage path (not yet implemented) |
325
+
326
+ **Example:**
327
+ ```bash
328
+ LOG_LEVEL=debug MAX_BUNDLE_SIZE=20971520 npx @uvrn/mcp
329
+ ```
330
+
331
+ ## Troubleshooting
332
+
333
+ ### Server doesn't appear in Claude Desktop
334
+
335
+ 1. Check your `claude_desktop_config.json` syntax (must be valid JSON)
336
+ 2. Verify the file path is correct for your OS
337
+ 3. Restart Claude Desktop completely
338
+ 4. Check Claude Desktop logs for errors
339
+
340
+ **macOS Logs:**
341
+ ```bash
342
+ tail -f ~/Library/Logs/Claude/mcp*.log
343
+ ```
344
+
345
+ ### Tool execution fails
346
+
347
+ **Check bundle validation first:**
348
+ ```json
349
+ {
350
+ "tool": "delta_validate_bundle",
351
+ "arguments": {
352
+ "bundle": { ...your bundle... }
353
+ }
354
+ }
355
+ ```
356
+
357
+ **Common issues:**
358
+ - `thresholdPct` must be > 0 and <= 1
359
+ - Need at least 2 data specs
360
+ - Each metric must have `key` and `value`
361
+
362
+ ### Performance issues
363
+
364
+ **Reduce bundle size:**
365
+ - Limit number of data specs
366
+ - Reduce metrics per data spec
367
+ - Set lower `MAX_BUNDLE_SIZE`
368
+
369
+ **Enable debug logging:**
370
+ ```bash
371
+ LOG_LEVEL=debug npx @uvrn/mcp
372
+ ```
373
+
374
+ ### Type errors in TypeScript projects
375
+
376
+ Ensure you're importing types correctly:
377
+
378
+ ```typescript
379
+ import type { DeltaBundle, DeltaReceipt } from '@uvrn/mcp';
380
+ ```
381
+
382
+ ## Development
383
+
384
+ ### Building from Source
385
+
386
+ ```bash
387
+ git clone https://github.com/your-repo/lc_delta-core.git
388
+ cd lc_delta-core/packages/uvrn-mcp
389
+ npm install
390
+ npm run build
391
+ ```
392
+
393
+ ### Running Tests
394
+
395
+ ```bash
396
+ npm test
397
+ ```
398
+
399
+ ### Local Development with Claude Desktop
400
+
401
+ ```json
402
+ {
403
+ "mcpServers": {
404
+ "delta-engine-dev": {
405
+ "command": "node",
406
+ "args": ["/absolute/path/to/packages/uvrn-mcp/dist/index.js"],
407
+ "env": {
408
+ "LOG_LEVEL": "debug",
409
+ "VERBOSE_ERRORS": "true"
410
+ }
411
+ }
412
+ }
413
+ }
414
+ ```
415
+
416
+ ## Architecture
417
+
418
+ For detailed architecture information, see [MCP_INTEGRATION.md](../docs/MCP_INTEGRATION.md).
419
+
420
+ ```mermaid
421
+ graph LR
422
+ A[Claude Desktop] -->|MCP Protocol| B[Delta Engine MCP Server]
423
+ B -->|Executes| C[Delta Engine Core]
424
+ C -->|Returns| D[DeltaReceipt]
425
+ D -->|via MCP| A
426
+ ```
427
+
428
+ ## Related Documentation
429
+
430
+ - [MCP Integration Guide](../../docs/MCP_INTEGRATION.md) - Detailed integration patterns
431
+ - [ENVIRONMENT.md](./ENVIRONMENT.md) - Configuration reference
432
+ - [CLAUDE_DESKTOP_SETUP.md](./CLAUDE_DESKTOP_SETUP.md) - Setup guide
433
+ - [Phase A.3 Task List](../../admin/docs/build-plans/phase_a3_task_list.md) - Implementation details
434
+
435
+ ## License
436
+
437
+ MIT
438
+
439
+ ## Related Projects
440
+
441
+ - [Loosechain Delta Engine Core](../uvrn-core) - Core engine functionality
442
+ - [MCP Protocol Specification](https://modelcontextprotocol.io/) - Official MCP docs
443
+
444
+ ---
445
+
446
+ **Loosechain** - _Receipts are truth. Interfaces are untrusted. Verification comes first._
@@ -0,0 +1,4 @@
1
+ import type { DeltaBundle } from '@uvrn/core';
2
+ export declare function createTestBundle(overrides?: Partial<DeltaBundle>): DeltaBundle;
3
+ export declare function createDivergentBundle(overrides?: Partial<DeltaBundle>): DeltaBundle;
4
+ //# sourceMappingURL=bundles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundles.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/bundles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAsC9C,wBAAgB,gBAAgB,CAAC,SAAS,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,WAAW,CAMlF;AAED,wBAAgB,qBAAqB,CACnC,SAAS,GAAE,OAAO,CAAC,WAAW,CAAM,GACnC,WAAW,CA4Bb"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createTestBundle = createTestBundle;
4
+ exports.createDivergentBundle = createDivergentBundle;
5
+ const baseBundle = {
6
+ bundleId: 'test-bundle-001',
7
+ claim: 'Q1 revenue is approximately $1.2M',
8
+ thresholdPct: 0.05,
9
+ dataSpecs: [
10
+ {
11
+ id: 'source-a',
12
+ label: 'Source A',
13
+ sourceKind: 'report',
14
+ originDocIds: ['doc-a'],
15
+ metrics: [
16
+ {
17
+ key: 'revenue',
18
+ value: 1200000,
19
+ unit: 'USD',
20
+ ts: '2024-04-01T00:00:00Z',
21
+ },
22
+ ],
23
+ },
24
+ {
25
+ id: 'source-b',
26
+ label: 'Source B',
27
+ sourceKind: 'report',
28
+ originDocIds: ['doc-b'],
29
+ metrics: [
30
+ {
31
+ key: 'revenue',
32
+ value: 1195000,
33
+ unit: 'USD',
34
+ ts: '2024-04-01T00:00:00Z',
35
+ },
36
+ ],
37
+ },
38
+ ],
39
+ };
40
+ function createTestBundle(overrides = {}) {
41
+ return {
42
+ ...baseBundle,
43
+ ...overrides,
44
+ dataSpecs: overrides.dataSpecs ?? baseBundle.dataSpecs,
45
+ };
46
+ }
47
+ function createDivergentBundle(overrides = {}) {
48
+ const divergent = {
49
+ bundleId: 'divergent-bundle-001',
50
+ claim: 'Revenue is $1.0M',
51
+ thresholdPct: 0.05,
52
+ dataSpecs: [
53
+ {
54
+ id: 'source-a',
55
+ label: 'Source A',
56
+ sourceKind: 'report',
57
+ originDocIds: ['doc-a'],
58
+ metrics: [{ key: 'revenue', value: 0 }],
59
+ },
60
+ {
61
+ id: 'source-b',
62
+ label: 'Source B',
63
+ sourceKind: 'report',
64
+ originDocIds: ['doc-b'],
65
+ metrics: [{ key: 'revenue', value: 1000000 }],
66
+ },
67
+ ],
68
+ };
69
+ return {
70
+ ...divergent,
71
+ ...overrides,
72
+ dataSpecs: overrides.dataSpecs ?? divergent.dataSpecs,
73
+ };
74
+ }
75
+ //# sourceMappingURL=bundles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundles.js","sourceRoot":"","sources":["../../../src/__tests__/fixtures/bundles.ts"],"names":[],"mappings":";;AAsCA,4CAMC;AAED,sDA8BC;AA1ED,MAAM,UAAU,GAAgB;IAC9B,QAAQ,EAAE,iBAAiB;IAC3B,KAAK,EAAE,mCAAmC;IAC1C,YAAY,EAAE,IAAI;IAClB,SAAS,EAAE;QACT;YACE,EAAE,EAAE,UAAU;YACd,KAAK,EAAE,UAAU;YACjB,UAAU,EAAE,QAAQ;YACpB,YAAY,EAAE,CAAC,OAAO,CAAC;YACvB,OAAO,EAAE;gBACP;oBACE,GAAG,EAAE,SAAS;oBACd,KAAK,EAAE,OAAO;oBACd,IAAI,EAAE,KAAK;oBACX,EAAE,EAAE,sBAAsB;iBAC3B;aACF;SACF;QACD;YACE,EAAE,EAAE,UAAU;YACd,KAAK,EAAE,UAAU;YACjB,UAAU,EAAE,QAAQ;YACpB,YAAY,EAAE,CAAC,OAAO,CAAC;YACvB,OAAO,EAAE;gBACP;oBACE,GAAG,EAAE,SAAS;oBACd,KAAK,EAAE,OAAO;oBACd,IAAI,EAAE,KAAK;oBACX,EAAE,EAAE,sBAAsB;iBAC3B;aACF;SACF;KACF;CACF,CAAC;AAEF,SAAgB,gBAAgB,CAAC,YAAkC,EAAE;IACnE,OAAO;QACL,GAAG,UAAU;QACb,GAAG,SAAS;QACZ,SAAS,EAAE,SAAS,CAAC,SAAS,IAAI,UAAU,CAAC,SAAS;KACvD,CAAC;AACJ,CAAC;AAED,SAAgB,qBAAqB,CACnC,YAAkC,EAAE;IAEpC,MAAM,SAAS,GAAgB;QAC7B,QAAQ,EAAE,sBAAsB;QAChC,KAAK,EAAE,kBAAkB;QACzB,YAAY,EAAE,IAAI;QAClB,SAAS,EAAE;YACT;gBACE,EAAE,EAAE,UAAU;gBACd,KAAK,EAAE,UAAU;gBACjB,UAAU,EAAE,QAAQ;gBACpB,YAAY,EAAE,CAAC,OAAO,CAAC;gBACvB,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;aACxC;YACD;gBACE,EAAE,EAAE,UAAU;gBACd,KAAK,EAAE,UAAU;gBACjB,UAAU,EAAE,QAAQ;gBACpB,YAAY,EAAE,CAAC,OAAO,CAAC;gBACvB,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;aAC9C;SACF;KACF,CAAC;IAEF,OAAO;QACL,GAAG,SAAS;QACZ,GAAG,SAAS;QACZ,SAAS,EAAE,SAAS,CAAC,SAAS,IAAI,SAAS,CAAC,SAAS;KACtD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Configuration Management
3
+ * Loads configuration from environment variables
4
+ */
5
+ import { ServerConfig } from './types';
6
+ export declare function loadConfig(): ServerConfig;
7
+ export declare const config: ServerConfig;
8
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,wBAAgB,UAAU,IAAI,YAAY,CAiBzC;AAED,eAAO,MAAM,MAAM,cAAe,CAAC"}
package/dist/config.js ADDED
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /**
3
+ * Configuration Management
4
+ * Loads configuration from environment variables
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.config = void 0;
8
+ exports.loadConfig = loadConfig;
9
+ function loadConfig() {
10
+ const logLevel = (process.env.LOG_LEVEL || 'info');
11
+ // Validate log level
12
+ const validLevels = ['debug', 'info', 'warn', 'error'];
13
+ if (!validLevels.includes(logLevel)) {
14
+ throw new Error(`Invalid LOG_LEVEL: ${logLevel}. Must be one of: ${validLevels.join(', ')}`);
15
+ }
16
+ return {
17
+ logLevel,
18
+ storagePath: process.env.STORAGE_PATH,
19
+ maxBundleSize: process.env.MAX_BUNDLE_SIZE
20
+ ? parseInt(process.env.MAX_BUNDLE_SIZE, 10)
21
+ : 10485760, // 10MB default
22
+ verboseErrors: process.env.VERBOSE_ERRORS === 'true',
23
+ };
24
+ }
25
+ exports.config = loadConfig();
26
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,gCAiBC;AAjBD,SAAgB,UAAU;IACxB,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,MAAM,CAA6B,CAAC;IAE/E,qBAAqB;IACrB,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACvD,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,sBAAsB,QAAQ,qBAAqB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED,OAAO;QACL,QAAQ;QACR,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY;QACrC,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe;YACxC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,EAAE,CAAC;YAC3C,CAAC,CAAC,QAAQ,EAAE,eAAe;QAC7B,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,MAAM;KACrD,CAAC;AACJ,CAAC;AAEY,QAAA,MAAM,GAAG,UAAU,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Delta Engine MCP Server
4
+ * Entry point for the Model Context Protocol server
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;GAGG"}
package/dist/index.js ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /**
4
+ * Delta Engine MCP Server
5
+ * Entry point for the Model Context Protocol server
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ const server_js_1 = require("./server.js");
9
+ const logger_js_1 = require("./logger.js");
10
+ // Handle process termination
11
+ process.on('SIGINT', () => {
12
+ logger_js_1.logger.info('Received SIGINT, shutting down gracefully...');
13
+ process.exit(0);
14
+ });
15
+ process.on('SIGTERM', () => {
16
+ logger_js_1.logger.info('Received SIGTERM, shutting down gracefully...');
17
+ process.exit(0);
18
+ });
19
+ // Handle uncaught errors
20
+ process.on('uncaughtException', (error) => {
21
+ logger_js_1.logger.error('Uncaught exception:', error);
22
+ process.exit(1);
23
+ });
24
+ process.on('unhandledRejection', (reason) => {
25
+ logger_js_1.logger.error('Unhandled rejection:', reason);
26
+ process.exit(1);
27
+ });
28
+ // Start the server
29
+ (0, server_js_1.startServer)().catch((error) => {
30
+ logger_js_1.logger.error('Failed to start server:', error);
31
+ process.exit(1);
32
+ });
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAEA;;;GAGG;;AAEH,2CAA0C;AAC1C,2CAAqC;AAErC,6BAA6B;AAC7B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;IACxB,kBAAM,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;IAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;IACzB,kBAAM,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;IAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,yBAAyB;AACzB,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE;IACxC,kBAAM,CAAC,KAAK,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;IAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,EAAE;IAC1C,kBAAM,CAAC,KAAK,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;IAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,mBAAmB;AACnB,IAAA,uBAAW,GAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAC5B,kBAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;IAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Simple Logger for MCP Server
3
+ * Respects LOG_LEVEL configuration
4
+ */
5
+ type LogLevel = 'debug' | 'info' | 'warn' | 'error';
6
+ declare class Logger {
7
+ private level;
8
+ constructor(levelName?: LogLevel);
9
+ private shouldLog;
10
+ debug(message: string, ...args: unknown[]): void;
11
+ info(message: string, ...args: unknown[]): void;
12
+ warn(message: string, ...args: unknown[]): void;
13
+ error(message: string, ...args: unknown[]): void;
14
+ }
15
+ export declare const logger: Logger;
16
+ export {};
17
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,KAAK,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AASpD,cAAM,MAAM;IACV,OAAO,CAAC,KAAK,CAAS;gBAEV,SAAS,GAAE,QAAiB;IAIxC,OAAO,CAAC,SAAS;IAIjB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAMhD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAM/C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAM/C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;CAKjD;AAED,eAAO,MAAM,MAAM,QAA8B,CAAC"}
package/dist/logger.js ADDED
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ /**
3
+ * Simple Logger for MCP Server
4
+ * Respects LOG_LEVEL configuration
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.logger = void 0;
8
+ const config_1 = require("./config");
9
+ const levels = {
10
+ debug: 0,
11
+ info: 1,
12
+ warn: 2,
13
+ error: 3,
14
+ };
15
+ class Logger {
16
+ level;
17
+ constructor(levelName = 'info') {
18
+ this.level = levels[levelName];
19
+ }
20
+ shouldLog(level) {
21
+ return levels[level] >= this.level;
22
+ }
23
+ debug(message, ...args) {
24
+ if (this.shouldLog('debug')) {
25
+ console.error('[DEBUG]', message, ...args);
26
+ }
27
+ }
28
+ info(message, ...args) {
29
+ if (this.shouldLog('info')) {
30
+ console.error('[INFO]', message, ...args);
31
+ }
32
+ }
33
+ warn(message, ...args) {
34
+ if (this.shouldLog('warn')) {
35
+ console.warn('[WARN]', message, ...args);
36
+ }
37
+ }
38
+ error(message, ...args) {
39
+ if (this.shouldLog('error')) {
40
+ console.error('[ERROR]', message, ...args);
41
+ }
42
+ }
43
+ }
44
+ exports.logger = new Logger(config_1.config.logLevel);
45
+ //# sourceMappingURL=logger.js.map