midnight-mcp 0.1.36 → 0.1.38
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 +15 -6
- package/dist/config/compact-version.js +15 -0
- package/dist/resources/content/docs-content.js +30 -7
- package/dist/server.js +15 -14
- package/dist/tools/health.js +3 -3
- package/dist/tools/repository/handlers.js +10 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -71,19 +71,28 @@ Add to `~/.codeium/windsurf/mcp_config.json`:
|
|
|
71
71
|
|
|
72
72
|
**No API keys required.** Restart your editor after adding the config.
|
|
73
73
|
|
|
74
|
-
###
|
|
74
|
+
### Updating to Latest Version
|
|
75
75
|
|
|
76
|
-
Using `midnight-mcp@latest` ensures you
|
|
76
|
+
Using `midnight-mcp@latest` in your config ensures you get updates automatically on restart.
|
|
77
77
|
|
|
78
|
-
**
|
|
79
|
-
|
|
80
|
-
Or manually update your config:
|
|
78
|
+
**Already using an older version without `@latest`?** Update your config manually:
|
|
81
79
|
|
|
82
80
|
```diff
|
|
83
81
|
- "args": ["-y", "midnight-mcp"]
|
|
84
82
|
+ "args": ["-y", "midnight-mcp@latest"]
|
|
85
83
|
```
|
|
86
84
|
|
|
85
|
+
**Then clear npm cache and restart:**
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Clear npx cache (required to fetch new version)
|
|
89
|
+
rm -rf ~/.npm/_npx
|
|
90
|
+
|
|
91
|
+
# Restart your editor (Cmd+Q on Mac, then reopen)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
> **Note:** AI agents cannot auto-update your config because they run in a sandboxed environment without access to your local filesystem.
|
|
95
|
+
|
|
87
96
|
---
|
|
88
97
|
|
|
89
98
|
## What's Included
|
|
@@ -98,7 +107,7 @@ Or manually update your config:
|
|
|
98
107
|
| **Versioning** | `get-version-info`, `check-breaking-changes`, `get-migration-guide`, `get-file-at-version`, `compare-syntax`, `get-latest-syntax` | Version tracking and migration |
|
|
99
108
|
| **AI Generation** | `generate-contract`, `review-contract`, `document-contract` | AI-powered code generation _(requires sampling)_ |
|
|
100
109
|
| **Compound** | `upgrade-check`, `get-repo-context` | Multi-step operations _(saves 50-70% tokens)_ |
|
|
101
|
-
| **Health** | `health-check`, `get-status`, `check-version
|
|
110
|
+
| **Health** | `health-check`, `get-status`, `check-version` | Server status and version checking |
|
|
102
111
|
| **Discovery** | `list-tool-categories`, `list-category-tools` | Explore available tools |
|
|
103
112
|
|
|
104
113
|
All tools are prefixed with `midnight-` (e.g., `midnight-search-compact`).
|
|
@@ -358,5 +358,20 @@ witness lookup_value(key: Bytes<32>): Field;`,
|
|
|
358
358
|
WRONG: Choice::rock, GameState::waiting
|
|
359
359
|
CORRECT: Choice.rock, GameState.waiting`,
|
|
360
360
|
},
|
|
361
|
+
{
|
|
362
|
+
error: 'parse error: found "{" after witness declaration',
|
|
363
|
+
cause: "Trying to add implementation body to witness",
|
|
364
|
+
fix: `Witnesses are declarations only - no body allowed:
|
|
365
|
+
WRONG: witness get_caller(): Bytes<32> { return ...; }
|
|
366
|
+
CORRECT: witness get_caller(): Bytes<32>;
|
|
367
|
+
Implementation goes in TypeScript prover, not Compact.`,
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
error: 'unbound identifier "function"',
|
|
371
|
+
cause: 'Using "pure function" instead of "pure circuit"',
|
|
372
|
+
fix: `Use "pure circuit" for helper functions:
|
|
373
|
+
WRONG: pure function helper(...): Type { }
|
|
374
|
+
CORRECT: pure circuit helper(...): Type { }`,
|
|
375
|
+
},
|
|
361
376
|
];
|
|
362
377
|
//# sourceMappingURL=compact-version.js.map
|
|
@@ -197,18 +197,20 @@ export pure circuit hash(x: Field): Bytes<32> // No state access
|
|
|
197
197
|
|
|
198
198
|
Witnesses provide off-chain/private data to circuits. They run locally, not on-chain.
|
|
199
199
|
|
|
200
|
+
**CRITICAL**: Witnesses are declarations only - NO implementation body in Compact!
|
|
201
|
+
The implementation goes in your TypeScript prover.
|
|
202
|
+
|
|
200
203
|
\`\`\`compact
|
|
201
|
-
//
|
|
204
|
+
// ✅ CORRECT - declaration only, semicolon at end
|
|
202
205
|
witness local_secret_key(): Bytes<32>;
|
|
203
|
-
|
|
204
|
-
// Witness with parameters
|
|
205
206
|
witness get_merkle_path(leaf: Bytes<32>): MerkleTreePath<10, Bytes<32>>;
|
|
206
|
-
|
|
207
|
-
// Witness that returns nothing (side effect only)
|
|
208
207
|
witness store_locally(data: Field): [];
|
|
209
|
-
|
|
210
|
-
// Witness returning optional
|
|
211
208
|
witness find_user(id: Bytes<32>): Maybe<UserData>;
|
|
209
|
+
|
|
210
|
+
// ❌ WRONG - witnesses cannot have bodies
|
|
211
|
+
witness get_caller(): Bytes<32> {
|
|
212
|
+
return public_key(local_secret_key()); // ERROR!
|
|
213
|
+
}
|
|
212
214
|
\`\`\`
|
|
213
215
|
|
|
214
216
|
---
|
|
@@ -229,6 +231,27 @@ constructor(initNonce: Bytes<32>) {
|
|
|
229
231
|
|
|
230
232
|
---
|
|
231
233
|
|
|
234
|
+
## 7.5 Pure Circuits (Helper Functions)
|
|
235
|
+
|
|
236
|
+
Use \`pure circuit\` for helper functions that don't modify ledger state:
|
|
237
|
+
|
|
238
|
+
\`\`\`compact
|
|
239
|
+
// ✅ CORRECT - use "pure circuit"
|
|
240
|
+
pure circuit determine_winner(p1: Choice, p2: Choice): Result {
|
|
241
|
+
if (p1 == p2) {
|
|
242
|
+
return Result.draw;
|
|
243
|
+
}
|
|
244
|
+
// ... logic
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// ❌ WRONG - "function" keyword doesn't exist
|
|
248
|
+
pure function determine_winner(p1: Choice, p2: Choice): Result {
|
|
249
|
+
// ERROR: unbound identifier "function"
|
|
250
|
+
}
|
|
251
|
+
\`\`\`
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
232
255
|
## 8. Common Patterns
|
|
233
256
|
|
|
234
257
|
### Authentication Pattern
|
package/dist/server.js
CHANGED
|
@@ -354,24 +354,25 @@ function registerToolHandlers(server) {
|
|
|
354
354
|
// Include prominent update prompt in ALL responses when outdated
|
|
355
355
|
const updateWarning = getUpdateWarning();
|
|
356
356
|
if (updateWarning && versionCheckResult.isOutdated) {
|
|
357
|
-
// Prepend
|
|
357
|
+
// Prepend update notice with MANUAL instructions (auto-update not possible in sandbox)
|
|
358
358
|
const updatePrompt = {
|
|
359
|
-
"🚨
|
|
360
|
-
message: `You are using
|
|
361
|
-
|
|
362
|
-
instruction: "
|
|
363
|
-
tool: "midnight-auto-update-config",
|
|
359
|
+
"🚨 UPDATE AVAILABLE": {
|
|
360
|
+
message: `You are using v${CURRENT_VERSION} but v${versionCheckResult.latestVersion} is available.`,
|
|
361
|
+
userAction: {
|
|
362
|
+
instruction: "Tell the user to update manually. Auto-update is NOT possible because you run in a sandboxed environment without access to local files.",
|
|
364
363
|
steps: [
|
|
365
|
-
"1.
|
|
366
|
-
"2.
|
|
367
|
-
"3.
|
|
368
|
-
"4. Save the file",
|
|
369
|
-
"5. Tell user: 'I've updated your config! Please restart your editor to use the latest version.'",
|
|
364
|
+
"1. Edit config file to use 'midnight-mcp@latest' instead of 'midnight-mcp'",
|
|
365
|
+
"2. Run: rm -rf ~/.npm/_npx (to clear npm cache)",
|
|
366
|
+
"3. Restart the editor completely (Cmd+Q on Mac, then reopen)",
|
|
370
367
|
],
|
|
368
|
+
configLocations: {
|
|
369
|
+
claudeDesktop: "~/Library/Application Support/Claude/claude_desktop_config.json",
|
|
370
|
+
cursor: ".cursor/mcp.json",
|
|
371
|
+
vscode: ".vscode/mcp.json",
|
|
372
|
+
windsurf: "~/.codeium/windsurf/mcp_config.json",
|
|
373
|
+
},
|
|
371
374
|
},
|
|
372
|
-
|
|
373
|
-
ifAutoUpdateFails: "Ask user to manually update config to use midnight-mcp@latest",
|
|
374
|
-
},
|
|
375
|
+
note: "If user already has @latest in config, they just need to clear cache (rm -rf ~/.npm/_npx) and restart.",
|
|
375
376
|
},
|
|
376
377
|
result,
|
|
377
378
|
};
|
package/dist/tools/health.js
CHANGED
|
@@ -332,9 +332,9 @@ export const healthTools = [
|
|
|
332
332
|
},
|
|
333
333
|
{
|
|
334
334
|
name: "midnight-auto-update-config",
|
|
335
|
-
description: "
|
|
336
|
-
"
|
|
337
|
-
"
|
|
335
|
+
description: "⚠️ DEPRECATED: Auto-update is NOT possible because AI agents run in sandboxed environments without access to local filesystems. " +
|
|
336
|
+
"Instead, tell users to manually update their config to use midnight-mcp@latest, then run: rm -rf ~/.npm/_npx && restart their editor. " +
|
|
337
|
+
"This tool only returns config file paths for reference.",
|
|
338
338
|
inputSchema: {
|
|
339
339
|
type: "object",
|
|
340
340
|
properties: {},
|
|
@@ -416,6 +416,16 @@ export circuit increment(): [] {
|
|
|
416
416
|
correct: "Choice.rock (dot notation)",
|
|
417
417
|
error: 'parse error: found ":" looking for ")"',
|
|
418
418
|
},
|
|
419
|
+
{
|
|
420
|
+
wrong: "witness fn(): T { ... }",
|
|
421
|
+
correct: "witness fn(): T; // declaration only, no body",
|
|
422
|
+
error: "parse error after witness declaration",
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
wrong: "pure function helper(): T",
|
|
426
|
+
correct: "pure circuit helper(): T",
|
|
427
|
+
error: 'unbound identifier "function"',
|
|
428
|
+
},
|
|
419
429
|
],
|
|
420
430
|
syntaxReference: compactReference,
|
|
421
431
|
sections: [
|