midnight-mcp 0.2.17 → 0.2.18

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 CHANGED
@@ -8,6 +8,8 @@
8
8
 
9
9
  MCP server that gives AI assistants access to Midnight blockchain—search contracts, analyze code, and explore documentation.
10
10
 
11
+ This project extends the Midnight Network with additional developer tooling.
12
+
11
13
  ## Requirements
12
14
 
13
15
  - **Node.js 20+** (LTS recommended)
@@ -124,7 +126,7 @@ All tools are prefixed with `midnight-` (e.g., `midnight-search-compact`).
124
126
  The `midnight-compile-contract` tool validates Compact code using a hosted compiler service:
125
127
 
126
128
  ```
127
- ✅ Compilation successful (Compiler v0.18.0) in 2841ms
129
+ ✅ Compilation successful (Compiler v0.29.0) in 2841ms
128
130
  ```
129
131
 
130
132
  - **Fast mode** (`skipZk=true`): Syntax validation in ~1-2 seconds
@@ -137,7 +139,7 @@ This catches semantic errors that static analysis misses (sealed fields, disclos
137
139
 
138
140
  | Capability | Feature |
139
141
  | --------------- | ----------------------------------------------- |
140
- | **Tools** | 28 tools with `listChanged` notifications |
142
+ | **Tools** | 29 tools with `listChanged` notifications |
141
143
  | **Resources** | 9 embedded resources with subscription support |
142
144
  | **Prompts** | 5 workflow prompts |
143
145
  | **Logging** | Client-controllable log level |
@@ -149,7 +151,7 @@ This catches semantic errors that static analysis misses (sealed fields, disclos
149
151
 
150
152
  Quick references available offline:
151
153
 
152
- - Compact syntax guide (v0.16-0.18)
154
+ - Compact syntax guide (v0.16-0.21)
153
155
  - SDK API reference
154
156
  - OpenZeppelin contracts
155
157
  - Tokenomics overview
@@ -164,7 +166,7 @@ Quick references available offline:
164
166
  | ------------------------- | -------- | ------------------------------------------------------- |
165
167
  | `deprecated_ledger_block` | P0 | Catches `ledger { }` → use `export ledger field: Type;` |
166
168
  | `invalid_void_type` | P0 | Catches `Void` → use `[]` (empty tuple) |
167
- | `invalid_pragma_format` | P0 | Catches old pragma → use `>= 0.16 && <= 0.18` |
169
+ | `invalid_pragma_format` | P0 | Catches old pragma → use `>= 0.16 && <= 0.21` |
168
170
  | `unexported_enum` | P1 | Enums need `export` for TypeScript access |
169
171
  | `module_level_const` | P0 | Use `pure circuit` instead |
170
172
  | + 10 more checks | P1-P2 | Overflow, division, assertions, etc. |
@@ -269,6 +271,11 @@ Add `"GITHUB_TOKEN": "ghp_..."` for higher GitHub API rate limits (60 → 5000 r
269
271
  ```bash
270
272
  git clone https://github.com/Olanetsoft/midnight-mcp.git && cd midnight-mcp
271
273
  npm install && npm run build && npm test
274
+
275
+ # Lint & format
276
+ npm run lint # ESLint (typescript-eslint)
277
+ npm run lint:fix # Auto-fix lint issues
278
+ npm run format # Prettier
272
279
  ```
273
280
 
274
281
  The hosted API runs on Cloudflare Workers + Vectorize. See [api/README.md](./api/README.md) for backend details.
package/dist/bin.js CHANGED
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  startHttpServer,
4
4
  startServer
5
- } from "./chunk-GDUMSS3E.js";
5
+ } from "./chunk-TSXIIBEH.js";
6
6
  import {
7
7
  setOutputFormat
8
- } from "./chunk-S33OTE35.js";
8
+ } from "./chunk-WVMAQ2LK.js";
9
9
 
10
10
  // src/bin.ts
11
11
  import { config } from "dotenv";
@@ -13,7 +13,7 @@ import { resolve } from "path";
13
13
  import yargs from "yargs";
14
14
  import { hideBin } from "yargs/helpers";
15
15
  config({ path: resolve(process.cwd(), ".env") });
16
- var CURRENT_VERSION = "0.2.17";
16
+ var CURRENT_VERSION = "0.2.18";
17
17
  process.on("uncaughtException", (error) => {
18
18
  console.error("Uncaught exception:", error);
19
19
  process.exit(1);
@@ -25,7 +25,7 @@ import {
25
25
  validateNumber,
26
26
  validateQuery,
27
27
  vectorStore
28
- } from "./chunk-S33OTE35.js";
28
+ } from "./chunk-WVMAQ2LK.js";
29
29
 
30
30
  // src/tools/search/schemas.ts
31
31
  import { z } from "zod";
@@ -1914,7 +1914,7 @@ import { randomUUID } from "crypto";
1914
1914
 
1915
1915
  // src/resources/content/docs-content.ts
1916
1916
  var EMBEDDED_DOCS = {
1917
- "midnight://docs/compact-reference": `# Compact Language Syntax Reference (v0.16 - v0.18)
1917
+ "midnight://docs/compact-reference": `# Compact Language Syntax Reference (v0.16 - v0.21)
1918
1918
 
1919
1919
  > **CRITICAL**: This reference is derived from **actual compiling contracts** in the Midnight ecosystem.
1920
1920
  > Always verify syntax against this reference before generating contracts.
@@ -1924,7 +1924,7 @@ var EMBEDDED_DOCS = {
1924
1924
  Use this as a starting point - it compiles successfully:
1925
1925
 
1926
1926
  \`\`\`compact
1927
- pragma language_version >= 0.16 && <= 0.18;
1927
+ pragma language_version >= 0.16 && <= 0.21;
1928
1928
 
1929
1929
  import CompactStandardLibrary;
1930
1930
 
@@ -1947,13 +1947,13 @@ export circuit increment(): [] {
1947
1947
 
1948
1948
  **CORRECT** - use bounded range without patch version:
1949
1949
  \`\`\`compact
1950
- pragma language_version >= 0.16 && <= 0.18;
1950
+ pragma language_version >= 0.16 && <= 0.21;
1951
1951
  \`\`\`
1952
1952
 
1953
1953
  **WRONG** - these will cause parse errors:
1954
1954
  \`\`\`compact
1955
1955
  pragma language_version >= 0.14.0; // \u274C patch version not needed
1956
- pragma language_version >= 0.16.0 < 0.19.0; // \u274C wrong operator format
1956
+ pragma language_version >= 0.20.0 < 0.22.0; // \u274C wrong operator format
1957
1957
  \`\`\`
1958
1958
 
1959
1959
  ---
@@ -2201,7 +2201,7 @@ export circuit authenticated_action(): [] {
2201
2201
 
2202
2202
  ### Commit-Reveal Pattern (COMPLETE, VALIDATED)
2203
2203
  \`\`\`compact
2204
- pragma language_version >= 0.16 && <= 0.18;
2204
+ pragma language_version >= 0.16 && <= 0.21;
2205
2205
 
2206
2206
  import CompactStandardLibrary;
2207
2207
 
@@ -2441,7 +2441,7 @@ assert(disclose(caller == owner), "Not authorized");
2441
2441
  |---------|---------|
2442
2442
  | \`ledger { field: Type; }\` | \`export ledger field: Type;\` |
2443
2443
  | \`circuit fn(): Void\` | \`circuit fn(): []\` |
2444
- | \`pragma >= 0.16.0\` | \`pragma >= 0.16 && <= 0.18\` |
2444
+ | \`pragma >= 0.20.0\` | \`pragma >= 0.16 && <= 0.21\` |
2445
2445
  | \`enum State { ... }\` | \`export enum State { ... }\` |
2446
2446
  | \`if (witness_val == x)\` | \`if (disclose(witness_val == x))\` |
2447
2447
  | \`Cell<Field>\` | \`Field\` (Cell is deprecated) |
@@ -2774,7 +2774,7 @@ npm install @openzeppelin/compact-contracts
2774
2774
  ## Usage Example
2775
2775
 
2776
2776
  \`\`\`compact
2777
- pragma language_version >= 0.18.0;
2777
+ pragma language_version >= 0.16 && <= 0.21;
2778
2778
 
2779
2779
  import CompactStandardLibrary;
2780
2780
  import "@openzeppelin/compact-contracts/src/token/FungibleToken"
@@ -2815,7 +2815,7 @@ The recommended standard for privacy-preserving tokens on Midnight.
2815
2815
  ## Basic Usage
2816
2816
 
2817
2817
  \`\`\`compact
2818
- pragma language_version >= 0.18.0;
2818
+ pragma language_version >= 0.16 && <= 0.21;
2819
2819
 
2820
2820
  import CompactStandardLibrary;
2821
2821
  import "@openzeppelin/compact-contracts/src/token/FungibleToken"
@@ -3406,7 +3406,7 @@ var EMBEDDED_CODE = {
3406
3406
  "midnight://code/examples/counter": `// Counter Example Contract
3407
3407
  // A simple contract demonstrating basic Compact concepts
3408
3408
 
3409
- pragma language_version >= 0.16 && <= 0.18;
3409
+ pragma language_version >= 0.16 && <= 0.21;
3410
3410
 
3411
3411
  import CompactStandardLibrary;
3412
3412
 
@@ -3455,7 +3455,7 @@ export circuit isLessThan(threshold: Uint<64>): Boolean {
3455
3455
  "midnight://code/examples/bboard": `// Bulletin Board Example Contract
3456
3456
  // Demonstrates private messaging with selective disclosure
3457
3457
 
3458
- pragma language_version >= 0.16 && <= 0.18;
3458
+ pragma language_version >= 0.16 && <= 0.21;
3459
3459
 
3460
3460
  import CompactStandardLibrary;
3461
3461
 
@@ -3504,7 +3504,7 @@ export circuit getMessageCount(): Uint<64> {
3504
3504
  "midnight://code/patterns/state-management": `// State Management Pattern
3505
3505
  // Best practices for managing public and private state
3506
3506
 
3507
- pragma language_version >= 0.16 && <= 0.18;
3507
+ pragma language_version >= 0.16 && <= 0.21;
3508
3508
 
3509
3509
  import CompactStandardLibrary;
3510
3510
 
@@ -3555,7 +3555,7 @@ export circuit revealBalance(user: Opaque<"address">): Field {
3555
3555
  "midnight://code/patterns/access-control": `// Access Control Pattern
3556
3556
  // Implementing permissions and authorization
3557
3557
 
3558
- pragma language_version >= 0.16 && <= 0.18;
3558
+ pragma language_version >= 0.16 && <= 0.21;
3559
3559
 
3560
3560
  import CompactStandardLibrary;
3561
3561
 
@@ -3610,7 +3610,7 @@ export circuit timeLockedAction(unlockTime: Field): [] {
3610
3610
  "midnight://code/patterns/privacy-preserving": `// Privacy-Preserving Patterns
3611
3611
  // Techniques for maintaining privacy in smart contracts
3612
3612
 
3613
- pragma language_version >= 0.16 && <= 0.18;
3613
+ pragma language_version >= 0.16 && <= 0.21;
3614
3614
 
3615
3615
  import CompactStandardLibrary;
3616
3616
 
@@ -3715,7 +3715,7 @@ export circuit proveMembership(
3715
3715
  "midnight://code/templates/token": `// Privacy-Preserving Token Template
3716
3716
  // Starter template for token contracts with privacy features
3717
3717
 
3718
- pragma language_version >= 0.16 && <= 0.18;
3718
+ pragma language_version >= 0.16 && <= 0.21;
3719
3719
 
3720
3720
  import CompactStandardLibrary;
3721
3721
 
@@ -3774,7 +3774,7 @@ export circuit mint(to: Opaque<"address">, amount: Uint<64>): Boolean {
3774
3774
  "midnight://code/templates/voting": `// Private Voting Template
3775
3775
  // Starter template for privacy-preserving voting contracts
3776
3776
 
3777
- pragma language_version >= 0.16 && <= 0.18;
3777
+ pragma language_version >= 0.16 && <= 0.21;
3778
3778
 
3779
3779
  import CompactStandardLibrary;
3780
3780
 
@@ -3854,7 +3854,7 @@ export circuit addVoter(voter: Opaque<"address">): [] {
3854
3854
  "midnight://code/examples/nullifier": `// Nullifier Pattern Example
3855
3855
  // Demonstrates how to create and use nullifiers to prevent double-spending/actions
3856
3856
 
3857
- pragma language_version >= 0.16 && <= 0.18;
3857
+ pragma language_version >= 0.16 && <= 0.21;
3858
3858
 
3859
3859
  import CompactStandardLibrary;
3860
3860
 
@@ -3921,7 +3921,7 @@ export circuit voteWithNullifier(
3921
3921
  "midnight://code/examples/hash": `// Hash Functions in Compact
3922
3922
  // Examples of using hash functions for various purposes
3923
3923
 
3924
- pragma language_version >= 0.16 && <= 0.18;
3924
+ pragma language_version >= 0.16 && <= 0.21;
3925
3925
 
3926
3926
  import CompactStandardLibrary;
3927
3927
 
@@ -3968,7 +3968,7 @@ export circuit reveal(value: Field, randomness: Field): Field {
3968
3968
  "midnight://code/examples/simple-counter": `// Simple Counter Contract
3969
3969
  // Minimal example for learning Compact basics
3970
3970
 
3971
- pragma language_version >= 0.16 && <= 0.18;
3971
+ pragma language_version >= 0.16 && <= 0.21;
3972
3972
 
3973
3973
  import CompactStandardLibrary;
3974
3974
 
@@ -4006,7 +4006,7 @@ export circuit reset(): [] {
4006
4006
  "midnight://code/templates/basic": `// Basic Compact Contract Template
4007
4007
  // Starting point for new contracts
4008
4008
 
4009
- pragma language_version >= 0.16 && <= 0.18;
4009
+ pragma language_version >= 0.16 && <= 0.21;
4010
4010
 
4011
4011
  import CompactStandardLibrary;
4012
4012
 
@@ -4796,7 +4796,7 @@ function generateCreateContractPrompt(args) {
4796
4796
  Call \`midnight-get-latest-syntax\` FIRST to get:
4797
4797
  - The \`quickStartTemplate\` (use as your base)
4798
4798
  - The \`commonMistakes\` array (avoid these errors)
4799
- - Current pragma format: \`pragma language_version >= 0.16 && <= 0.18;\`
4799
+ - Current pragma format: \`pragma language_version >= 0.16 && <= 0.21;\`
4800
4800
 
4801
4801
  ### Step 2: Generate Contract
4802
4802
  Based on syntax reference, generate the contract using:
@@ -4897,7 +4897,7 @@ ${contractCode}
4897
4897
  Call \`midnight-extract-contract-structure\` with the contract code to check for:
4898
4898
  - deprecated_ledger_block (should use \`export ledger field: Type;\`)
4899
4899
  - invalid_void_type (should use \`[]\` not \`Void\`)
4900
- - invalid_pragma_format (should use \`>= 0.16 && <= 0.18\`)
4900
+ - invalid_pragma_format (should use \`>= 0.16 && <= 0.21\`)
4901
4901
  - unexported_enum (enums need \`export\`)
4902
4902
  - deprecated_cell_wrapper
4903
4903
 
@@ -5066,7 +5066,7 @@ ${contractCode}
5066
5066
  Call \`midnight-extract-contract-structure\` FIRST to check for common syntax errors:
5067
5067
  - deprecated_ledger_block \u2192 should use \`export ledger field: Type;\`
5068
5068
  - invalid_void_type \u2192 should use \`[]\` not \`Void\`
5069
- - invalid_pragma_format \u2192 should use \`>= 0.16 && <= 0.18\`
5069
+ - invalid_pragma_format \u2192 should use \`>= 0.16 && <= 0.21\`
5070
5070
  - unexported_enum \u2192 enums need \`export\` keyword
5071
5071
 
5072
5072
  ### Step 2: Get Correct Syntax
@@ -5190,7 +5190,7 @@ Key Compact syntax (REQUIRED):
5190
5190
  - \`export ledger field: Type;\` - Individual ledger declarations (NOT ledger { } blocks)
5191
5191
  - \`export circuit fn(): []\` - Public functions return empty tuple [] (NOT Void)
5192
5192
  - \`witness fn(): T;\` - Declaration only, no body
5193
- - \`pragma language_version >= 0.16 && <= 0.18;\` - Version pragma
5193
+ - \`pragma language_version >= 0.16 && <= 0.21;\` - Version pragma
5194
5194
  - \`import CompactStandardLibrary;\` - Standard imports
5195
5195
  - \`Counter\`, \`Map<K,V>\`, \`Set<T>\` - Built-in collection types
5196
5196
  - \`Field\`, \`Boolean\`, \`Uint<N>\`, \`Bytes<N>\` - Primitive types
@@ -6540,9 +6540,9 @@ var COMPACT_VERSION = {
6540
6540
  /** Minimum supported version */
6541
6541
  min: "0.16",
6542
6542
  /** Maximum supported version */
6543
- max: "0.18",
6543
+ max: "0.21",
6544
6544
  /** When this config was last updated */
6545
- lastUpdated: "2025-01-26",
6545
+ lastUpdated: "2026-03-24",
6546
6546
  /** Source of truth for syntax patterns */
6547
6547
  referenceSource: "https://github.com/piotr-iohk/template-contract"
6548
6548
  };
@@ -7387,7 +7387,7 @@ async function extractContractStructure(input) {
7387
7387
  type: "invalid_pragma_format",
7388
7388
  line: lineNum,
7389
7389
  message: `Pragma includes patch version which may cause parse errors`,
7390
- suggestion: `Use bounded range format: 'pragma language_version >= 0.16 && <= 0.18;'`,
7390
+ suggestion: `Use bounded range format: 'pragma language_version >= 0.16 && <= 0.21;'`,
7391
7391
  severity: "error"
7392
7392
  });
7393
7393
  }
@@ -11172,4 +11172,4 @@ export {
11172
11172
  startServer,
11173
11173
  startHttpServer
11174
11174
  };
11175
- //# sourceMappingURL=chunk-GDUMSS3E.js.map
11175
+ //# sourceMappingURL=chunk-TSXIIBEH.js.map
@@ -1091,6 +1091,25 @@ function parseCompactFile(path, content) {
1091
1091
  });
1092
1092
  }
1093
1093
  }
1094
+ const newLedgerRegex = /(?:(export)\s+)?ledger\s+(\w+)\s*:\s*([^;]+);/gm;
1095
+ let newLedgerMatch;
1096
+ while ((newLedgerMatch = newLedgerRegex.exec(content)) !== null) {
1097
+ hasLedger = true;
1098
+ const isExport = newLedgerMatch[1] === "export";
1099
+ const fieldName = newLedgerMatch[2];
1100
+ const fieldType = newLedgerMatch[3].trim();
1101
+ const startLine = content.substring(0, newLedgerMatch.index).split("\n").length;
1102
+ codeUnits.push({
1103
+ type: "ledger",
1104
+ name: fieldName,
1105
+ code: newLedgerMatch[0].trim(),
1106
+ startLine,
1107
+ endLine: startLine,
1108
+ isPublic: isExport,
1109
+ isPrivate: !isExport,
1110
+ returnType: fieldType
1111
+ });
1112
+ }
1094
1113
  const circuitRegex = /(export\s+)?circuit\s+(\w+)\s*\(([^)]*)\)\s*(?::\s*(\w+))?\s*\{/g;
1095
1114
  let circuitMatch;
1096
1115
  while ((circuitMatch = circuitRegex.exec(content)) !== null) {
@@ -1605,7 +1624,7 @@ var releaseTracker = new ReleaseTracker();
1605
1624
 
1606
1625
  // src/utils/health.ts
1607
1626
  var startTime = Date.now();
1608
- var VERSION = "0.2.17";
1627
+ var VERSION = "0.2.18";
1609
1628
  async function checkGitHubAPI() {
1610
1629
  const start = Date.now();
1611
1630
  try {
@@ -1633,7 +1652,7 @@ async function checkGitHubAPI() {
1633
1652
  }
1634
1653
  async function checkVectorStore() {
1635
1654
  try {
1636
- const { vectorStore: vectorStore2 } = await import("./db-SWEQRS2S.js");
1655
+ const { vectorStore: vectorStore2 } = await import("./db-B4AOK42O.js");
1637
1656
  if (vectorStore2) {
1638
1657
  return {
1639
1658
  status: "pass",
@@ -2109,7 +2128,7 @@ function serialize(data) {
2109
2128
  }
2110
2129
 
2111
2130
  // src/utils/version.ts
2112
- var CURRENT_VERSION = "0.2.17";
2131
+ var CURRENT_VERSION = "0.2.18";
2113
2132
 
2114
2133
  // src/db/vectorStore.ts
2115
2134
  var VectorStore = class {
@@ -2332,4 +2351,4 @@ export {
2332
2351
  serialize,
2333
2352
  CURRENT_VERSION
2334
2353
  };
2335
- //# sourceMappingURL=chunk-S33OTE35.js.map
2354
+ //# sourceMappingURL=chunk-WVMAQ2LK.js.map
@@ -0,0 +1,7 @@
1
+ import {
2
+ vectorStore
3
+ } from "./chunk-WVMAQ2LK.js";
4
+ export {
5
+ vectorStore
6
+ };
7
+ //# sourceMappingURL=db-B4AOK42O.js.map
package/dist/index.js CHANGED
@@ -9,10 +9,10 @@ import {
9
9
  promptDefinitions,
10
10
  startHttpServer,
11
11
  startServer
12
- } from "./chunk-GDUMSS3E.js";
12
+ } from "./chunk-TSXIIBEH.js";
13
13
  import {
14
14
  logger
15
- } from "./chunk-S33OTE35.js";
15
+ } from "./chunk-WVMAQ2LK.js";
16
16
  export {
17
17
  allResources,
18
18
  allTools,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "midnight-mcp",
3
- "version": "0.2.17",
3
+ "version": "0.2.18",
4
4
  "description": "Model Context Protocol Server for Midnight Blockchain Development",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,7 +0,0 @@
1
- import {
2
- vectorStore
3
- } from "./chunk-S33OTE35.js";
4
- export {
5
- vectorStore
6
- };
7
- //# sourceMappingURL=db-SWEQRS2S.js.map