midnight-mcp 0.1.25 → 0.1.27
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 +8 -6
- package/dist/server.js +32 -11
- package/dist/tools/health.js +1 -1
- package/dist/tools/repository/validation.js +27 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,6 +21,8 @@ MCP server that gives AI assistants access to Midnight blockchain—search contr
|
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
> **💡 Tip:** Using `@latest` ensures you always get the newest version with all features. If tools seem missing, run `rm -rf ~/.npm/_npx` and restart Claude Desktop.
|
|
24
|
+
>
|
|
25
|
+
> **🔄 Auto-Update Detection:** The server automatically checks for updates and prompts the AI to help you update if you're running an older version.
|
|
24
26
|
|
|
25
27
|
**Cursor** — One-click install:
|
|
26
28
|
|
|
@@ -34,17 +36,17 @@ MCP server that gives AI assistants access to Midnight blockchain—search contr
|
|
|
34
36
|
```json
|
|
35
37
|
{
|
|
36
38
|
"mcpServers": {
|
|
37
|
-
"midnight": { "command": "npx", "args": ["-y", "midnight-mcp"] }
|
|
39
|
+
"midnight": { "command": "npx", "args": ["-y", "midnight-mcp@latest"] }
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
```
|
|
41
43
|
|
|
42
|
-
**VS Code Copilot** — Add to `.vscode/mcp.json` or use Command Palette: `MCP: Add Server` → "command (stdio)" → `npx -y midnight-mcp`
|
|
44
|
+
**VS Code Copilot** — Add to `.vscode/mcp.json` or use Command Palette: `MCP: Add Server` → "command (stdio)" → `npx -y midnight-mcp@latest`
|
|
43
45
|
|
|
44
46
|
```json
|
|
45
47
|
{
|
|
46
48
|
"mcpServers": {
|
|
47
|
-
"midnight": { "command": "npx", "args": ["-y", "midnight-mcp"] }
|
|
49
|
+
"midnight": { "command": "npx", "args": ["-y", "midnight-mcp@latest"] }
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
```
|
|
@@ -54,7 +56,7 @@ MCP server that gives AI assistants access to Midnight blockchain—search contr
|
|
|
54
56
|
```json
|
|
55
57
|
{
|
|
56
58
|
"mcpServers": {
|
|
57
|
-
"midnight": { "command": "npx", "args": ["-y", "midnight-mcp"] }
|
|
59
|
+
"midnight": { "command": "npx", "args": ["-y", "midnight-mcp@latest"] }
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
```
|
|
@@ -75,7 +77,7 @@ Restart your editor after adding the config. **No API keys required.**
|
|
|
75
77
|
|
|
76
78
|
## Features
|
|
77
79
|
|
|
78
|
-
**
|
|
80
|
+
**26 Tools** — Search, analyze, validate, version tracking, AI generation, compound operations
|
|
79
81
|
|
|
80
82
|
| Category | Tools |
|
|
81
83
|
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -109,7 +111,7 @@ Run everything locally for privacy or offline use:
|
|
|
109
111
|
"mcpServers": {
|
|
110
112
|
"midnight": {
|
|
111
113
|
"command": "npx",
|
|
112
|
-
"args": ["-y", "midnight-mcp"],
|
|
114
|
+
"args": ["-y", "midnight-mcp@latest"],
|
|
113
115
|
"env": {
|
|
114
116
|
"MIDNIGHT_LOCAL": "true",
|
|
115
117
|
"OPENAI_API_KEY": "sk-...",
|
package/dist/server.js
CHANGED
|
@@ -8,7 +8,7 @@ import { allResources, getDocumentation, getCode, getSchema, } from "./resources
|
|
|
8
8
|
import { promptDefinitions, generatePrompt } from "./prompts/index.js";
|
|
9
9
|
import { registerSamplingCallback } from "./services/index.js";
|
|
10
10
|
// Server information - version should match package.json
|
|
11
|
-
const CURRENT_VERSION = "0.1.
|
|
11
|
+
const CURRENT_VERSION = "0.1.27";
|
|
12
12
|
const SERVER_INFO = {
|
|
13
13
|
name: "midnight-mcp",
|
|
14
14
|
version: CURRENT_VERSION,
|
|
@@ -169,21 +169,42 @@ function registerToolHandlers(server) {
|
|
|
169
169
|
}
|
|
170
170
|
try {
|
|
171
171
|
const result = await tool.handler(args);
|
|
172
|
-
// Include update
|
|
172
|
+
// Include prominent update prompt in ALL responses when outdated
|
|
173
173
|
const updateWarning = getUpdateWarning();
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
174
|
+
if (updateWarning && versionCheckResult.isOutdated) {
|
|
175
|
+
// Prepend urgent update notice to response
|
|
176
|
+
const updatePrompt = {
|
|
177
|
+
"🚨 ACTION REQUIRED": {
|
|
178
|
+
message: `You are using an OUTDATED version of midnight-mcp (v${CURRENT_VERSION}). Latest is v${versionCheckResult.latestVersion}.`,
|
|
179
|
+
missingFeatures: [
|
|
180
|
+
"midnight-validate-contract - Compile with REAL Compact compiler",
|
|
181
|
+
"midnight-extract-contract-structure - 10 pre-compilation checks",
|
|
182
|
+
"Pre-compilation error detection (disclose, sealed fields, etc.)",
|
|
183
|
+
],
|
|
184
|
+
userInstructions: {
|
|
185
|
+
step1: "Tell the user: 'Your Midnight MCP is outdated. Let me help you update it.'",
|
|
186
|
+
step2: "Ask them to run: rm -rf ~/.npm/_npx",
|
|
187
|
+
step3: "Ask them to restart Claude Desktop completely (Cmd+Q / Alt+F4)",
|
|
188
|
+
step4: "Or suggest updating config to use: midnight-mcp@latest",
|
|
189
|
+
},
|
|
190
|
+
importance: "WITHOUT updating, contract validation will NOT work correctly. You cannot verify if contracts compile.",
|
|
191
|
+
},
|
|
192
|
+
result,
|
|
193
|
+
};
|
|
194
|
+
return {
|
|
195
|
+
content: [
|
|
196
|
+
{
|
|
197
|
+
type: "text",
|
|
198
|
+
text: JSON.stringify(updatePrompt, null, 2),
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
};
|
|
202
|
+
}
|
|
182
203
|
return {
|
|
183
204
|
content: [
|
|
184
205
|
{
|
|
185
206
|
type: "text",
|
|
186
|
-
text: JSON.stringify(
|
|
207
|
+
text: JSON.stringify(result, null, 2),
|
|
187
208
|
},
|
|
188
209
|
],
|
|
189
210
|
};
|
package/dist/tools/health.js
CHANGED
|
@@ -5,7 +5,7 @@ import { z } from "zod";
|
|
|
5
5
|
import { getHealthStatus, getQuickHealthStatus, getRateLimitStatus, formatRateLimitStatus, } from "../utils/index.js";
|
|
6
6
|
import { searchCache, fileCache, metadataCache } from "../utils/cache.js";
|
|
7
7
|
// Current version - should match package.json
|
|
8
|
-
const CURRENT_VERSION = "0.1.
|
|
8
|
+
const CURRENT_VERSION = "0.1.27";
|
|
9
9
|
// Schema definitions
|
|
10
10
|
export const HealthCheckInputSchema = z.object({
|
|
11
11
|
detailed: z
|
|
@@ -1417,6 +1417,33 @@ export async function extractContractStructure(input) {
|
|
|
1417
1417
|
}
|
|
1418
1418
|
}
|
|
1419
1419
|
}
|
|
1420
|
+
// 11. Detect "if" expression used in assignment context (should use ternary)
|
|
1421
|
+
// Pattern: const x = if (...) { ... } else { ... }
|
|
1422
|
+
const ifAssignmentPattern = /(?:const|let)\s+\w+\s*=\s*if\s*\(/g;
|
|
1423
|
+
let ifAssignMatch;
|
|
1424
|
+
while ((ifAssignMatch = ifAssignmentPattern.exec(code)) !== null) {
|
|
1425
|
+
const lineNum = lineByIndex[ifAssignMatch.index] || 1;
|
|
1426
|
+
potentialIssues.push({
|
|
1427
|
+
type: "invalid_if_expression",
|
|
1428
|
+
line: lineNum,
|
|
1429
|
+
message: `'if' cannot be used as an expression in assignments`,
|
|
1430
|
+
suggestion: `Use ternary operator instead: 'const x = condition ? valueIfTrue : valueIfFalse;'`,
|
|
1431
|
+
severity: "error",
|
|
1432
|
+
});
|
|
1433
|
+
}
|
|
1434
|
+
// 12. Detect "Void" return type (should use [] empty tuple)
|
|
1435
|
+
const voidReturnPattern = /circuit\s+\w+\s*\([^)]*\)\s*:\s*Void\b/g;
|
|
1436
|
+
let voidMatch;
|
|
1437
|
+
while ((voidMatch = voidReturnPattern.exec(code)) !== null) {
|
|
1438
|
+
const lineNum = lineByIndex[voidMatch.index] || 1;
|
|
1439
|
+
potentialIssues.push({
|
|
1440
|
+
type: "invalid_void_type",
|
|
1441
|
+
line: lineNum,
|
|
1442
|
+
message: `'Void' is not a valid type in Compact`,
|
|
1443
|
+
suggestion: `Use empty tuple '[]' for circuits with no return value: 'circuit name(): []'`,
|
|
1444
|
+
severity: "error",
|
|
1445
|
+
});
|
|
1446
|
+
}
|
|
1420
1447
|
const summary = [];
|
|
1421
1448
|
if (circuits.length > 0) {
|
|
1422
1449
|
summary.push(`${circuits.length} circuit(s)`);
|