midnight-mcp 0.1.26 → 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 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
- **24 Tools** — Search, analyze, validate, version tracking, AI generation, compound operations
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.26";
11
+ const CURRENT_VERSION = "0.1.27";
12
12
  const SERVER_INFO = {
13
13
  name: "midnight-mcp",
14
14
  version: CURRENT_VERSION,
@@ -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.26";
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)`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "midnight-mcp",
3
- "version": "0.1.26",
3
+ "version": "0.1.27",
4
4
  "description": "Model Context Protocol Server for Midnight Blockchain Development",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",