midnight-mcp 0.1.22 β 0.1.24
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 +20 -14
- package/dist/tools/analyze.js +5 -1
- package/dist/tools/health.d.ts +27 -0
- package/dist/tools/health.js +95 -0
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js +1 -1
- package/dist/tools/repository/tools.js +13 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,11 +15,13 @@ MCP server that gives AI assistants access to Midnight blockchainβsearch contr
|
|
|
15
15
|
```json
|
|
16
16
|
{
|
|
17
17
|
"mcpServers": {
|
|
18
|
-
"midnight": { "command": "npx", "args": ["-y", "midnight-mcp"] }
|
|
18
|
+
"midnight": { "command": "npx", "args": ["-y", "midnight-mcp@latest"] }
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
```
|
|
22
22
|
|
|
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
|
+
|
|
23
25
|
**Cursor** β One-click install:
|
|
24
26
|
|
|
25
27
|
[](https://cursor.com/en-US/install-mcp?name=midnight&config=eyJjb21tYW5kIjoibnB4IC15IG1pZG5pZ2h0LW1jcCJ9)
|
|
@@ -73,19 +75,23 @@ Restart your editor after adding the config. **No API keys required.**
|
|
|
73
75
|
|
|
74
76
|
## Features
|
|
75
77
|
|
|
76
|
-
**
|
|
77
|
-
|
|
78
|
-
| Category
|
|
79
|
-
|
|
|
80
|
-
| Search
|
|
81
|
-
| Analysis
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
|
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
88
|
-
|
|
78
|
+
**24 Tools** β Search, analyze, validate, version tracking, AI generation, compound operations
|
|
79
|
+
|
|
80
|
+
| Category | Tools |
|
|
81
|
+
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
82
|
+
| Search | `midnight-search-compact`, `midnight-search-typescript`, `midnight-search-docs` |
|
|
83
|
+
| Analysis | `midnight-analyze-contract`, `midnight-explain-circuit` |
|
|
84
|
+
| **Validation** | `midnight-validate-contract` β, `midnight-extract-contract-structure` |
|
|
85
|
+
| Repository | `midnight-get-file`, `midnight-list-examples`, `midnight-get-latest-updates` |
|
|
86
|
+
| Versioning | `midnight-get-version-info`, `midnight-check-breaking-changes`, `midnight-get-migration-guide`, `midnight-get-file-at-version`, `midnight-compare-syntax`, `midnight-get-latest-syntax` |
|
|
87
|
+
| AI Generation | `midnight-generate-contract`, `midnight-review-contract`, `midnight-document-contract` _(requires sampling)_ |
|
|
88
|
+
| Compound | `midnight-upgrade-check`, `midnight-get-repo-context` _(saves 50-70% tokens)_ |
|
|
89
|
+
| Health | `midnight-health-check`, `midnight-get-status`, `midnight-check-version` π |
|
|
90
|
+
| Discovery | `midnight-list-tool-categories`, `midnight-list-category-tools` |
|
|
91
|
+
|
|
92
|
+
> **β Key Tool:** `midnight-validate-contract` compiles code using the **real Compact compiler** - essential for verifying contracts actually work before deployment.
|
|
93
|
+
>
|
|
94
|
+
> **π New:** `midnight-check-version` tells you if you're running the latest version with update instructions.
|
|
89
95
|
|
|
90
96
|
**9 Embedded Resources** β Quick references available offline: Compact syntax, SDK API, OpenZeppelin contracts, tokenomics, wallet integration, common errors
|
|
91
97
|
|
package/dist/tools/analyze.js
CHANGED
|
@@ -377,7 +377,11 @@ const explainCircuitOutputSchema = {
|
|
|
377
377
|
export const analyzeTools = [
|
|
378
378
|
{
|
|
379
379
|
name: "midnight-analyze-contract",
|
|
380
|
-
description: "
|
|
380
|
+
description: "β οΈ STATIC ANALYSIS ONLY - Analyze contract structure and patterns. " +
|
|
381
|
+
"π« THIS DOES NOT COMPILE THE CONTRACT. Cannot catch: sealed field rules, disclose() requirements, semantic errors. " +
|
|
382
|
+
"π ALWAYS call 'midnight-validate-contract' FIRST to verify the code actually compiles. " +
|
|
383
|
+
"Use this for: understanding structure, security pattern analysis, recommendations. " +
|
|
384
|
+
"NEVER claim a contract 'works' or 'compiles' based on this tool alone.",
|
|
381
385
|
inputSchema: {
|
|
382
386
|
type: "object",
|
|
383
387
|
properties: {
|
package/dist/tools/health.d.ts
CHANGED
|
@@ -11,8 +11,10 @@ export declare const HealthCheckInputSchema: z.ZodObject<{
|
|
|
11
11
|
detailed?: boolean | undefined;
|
|
12
12
|
}>;
|
|
13
13
|
export declare const GetStatusInputSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
14
|
+
export declare const CheckVersionInputSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
14
15
|
export type HealthCheckInput = z.infer<typeof HealthCheckInputSchema>;
|
|
15
16
|
export type GetStatusInput = z.infer<typeof GetStatusInputSchema>;
|
|
17
|
+
export type CheckVersionInput = z.infer<typeof CheckVersionInputSchema>;
|
|
16
18
|
/**
|
|
17
19
|
* Perform health check on the MCP server
|
|
18
20
|
*/
|
|
@@ -64,5 +66,30 @@ export declare function getStatus(_input: GetStatusInput): Promise<{
|
|
|
64
66
|
metadata: import("../utils/cache.js").CacheStats;
|
|
65
67
|
};
|
|
66
68
|
}>;
|
|
69
|
+
/**
|
|
70
|
+
* Check if current version is up to date with npm
|
|
71
|
+
*/
|
|
72
|
+
export declare function checkVersion(_input: CheckVersionInput): Promise<{
|
|
73
|
+
currentVersion: string;
|
|
74
|
+
latestVersion: string;
|
|
75
|
+
isUpToDate: boolean;
|
|
76
|
+
error: string;
|
|
77
|
+
message?: undefined;
|
|
78
|
+
updateInstructions?: undefined;
|
|
79
|
+
newFeatures?: undefined;
|
|
80
|
+
} | {
|
|
81
|
+
currentVersion: string;
|
|
82
|
+
latestVersion: string;
|
|
83
|
+
isUpToDate: boolean;
|
|
84
|
+
message: string;
|
|
85
|
+
updateInstructions: {
|
|
86
|
+
step1: string;
|
|
87
|
+
step2: string;
|
|
88
|
+
step3: string;
|
|
89
|
+
alternative: string;
|
|
90
|
+
} | null;
|
|
91
|
+
newFeatures: string[] | null;
|
|
92
|
+
error?: undefined;
|
|
93
|
+
}>;
|
|
67
94
|
export declare const healthTools: ExtendedToolDefinition[];
|
|
68
95
|
//# sourceMappingURL=health.d.ts.map
|
package/dist/tools/health.js
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
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
|
+
// Current version - should match package.json
|
|
8
|
+
const CURRENT_VERSION = "0.1.24";
|
|
7
9
|
// Schema definitions
|
|
8
10
|
export const HealthCheckInputSchema = z.object({
|
|
9
11
|
detailed: z
|
|
@@ -13,6 +15,7 @@ export const HealthCheckInputSchema = z.object({
|
|
|
13
15
|
.describe("Include detailed checks (slower but more comprehensive)"),
|
|
14
16
|
});
|
|
15
17
|
export const GetStatusInputSchema = z.object({});
|
|
18
|
+
export const CheckVersionInputSchema = z.object({});
|
|
16
19
|
/**
|
|
17
20
|
* Perform health check on the MCP server
|
|
18
21
|
*/
|
|
@@ -61,6 +64,56 @@ export async function getStatus(_input) {
|
|
|
61
64
|
},
|
|
62
65
|
};
|
|
63
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Check if current version is up to date with npm
|
|
69
|
+
*/
|
|
70
|
+
export async function checkVersion(_input) {
|
|
71
|
+
try {
|
|
72
|
+
const response = await fetch("https://registry.npmjs.org/midnight-mcp/latest");
|
|
73
|
+
if (!response.ok) {
|
|
74
|
+
return {
|
|
75
|
+
currentVersion: CURRENT_VERSION,
|
|
76
|
+
latestVersion: "unknown",
|
|
77
|
+
isUpToDate: true, // Assume up to date if we can't check
|
|
78
|
+
error: "Could not fetch latest version from npm",
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const data = (await response.json());
|
|
82
|
+
const latestVersion = data.version;
|
|
83
|
+
const isUpToDate = CURRENT_VERSION === latestVersion;
|
|
84
|
+
return {
|
|
85
|
+
currentVersion: CURRENT_VERSION,
|
|
86
|
+
latestVersion,
|
|
87
|
+
isUpToDate,
|
|
88
|
+
message: isUpToDate
|
|
89
|
+
? "β
You are running the latest version!"
|
|
90
|
+
: `β οΈ UPDATE AVAILABLE: v${latestVersion} (you have v${CURRENT_VERSION})`,
|
|
91
|
+
updateInstructions: isUpToDate
|
|
92
|
+
? null
|
|
93
|
+
: {
|
|
94
|
+
step1: "Clear npx cache: rm -rf ~/.npm/_npx (macOS/Linux) or del /s /q %LocalAppData%\\npm-cache\\_npx (Windows)",
|
|
95
|
+
step2: "Restart Claude Desktop completely (Cmd+Q / Alt+F4, then reopen)",
|
|
96
|
+
step3: "Or update config to use: npx -y midnight-mcp@latest (forces latest)",
|
|
97
|
+
alternative: "You can also install globally: npm install -g midnight-mcp@latest",
|
|
98
|
+
},
|
|
99
|
+
newFeatures: isUpToDate
|
|
100
|
+
? null
|
|
101
|
+
: [
|
|
102
|
+
"midnight-validate-contract - Compile with REAL Compact compiler",
|
|
103
|
+
"midnight-extract-contract-structure - Static analysis with 10 pre-compilation checks",
|
|
104
|
+
"Pre-compilation detection: division operator, Counter.value, overflow, disclose() requirements",
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
return {
|
|
110
|
+
currentVersion: CURRENT_VERSION,
|
|
111
|
+
latestVersion: "unknown",
|
|
112
|
+
isUpToDate: true,
|
|
113
|
+
error: `Failed to check version: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
64
117
|
// Output schemas for health tools
|
|
65
118
|
const healthCheckOutputSchema = {
|
|
66
119
|
type: "object",
|
|
@@ -160,5 +213,47 @@ export const healthTools = [
|
|
|
160
213
|
},
|
|
161
214
|
handler: getStatus,
|
|
162
215
|
},
|
|
216
|
+
{
|
|
217
|
+
name: "midnight-check-version",
|
|
218
|
+
description: "π Check if you're running the latest version of midnight-mcp. " +
|
|
219
|
+
"Compares your installed version against npm registry and provides update instructions if outdated. " +
|
|
220
|
+
"Use this if tools seem missing or you want to ensure you have the latest features like midnight-validate-contract.",
|
|
221
|
+
inputSchema: {
|
|
222
|
+
type: "object",
|
|
223
|
+
properties: {},
|
|
224
|
+
},
|
|
225
|
+
outputSchema: {
|
|
226
|
+
type: "object",
|
|
227
|
+
properties: {
|
|
228
|
+
currentVersion: {
|
|
229
|
+
type: "string",
|
|
230
|
+
description: "Your installed version",
|
|
231
|
+
},
|
|
232
|
+
latestVersion: { type: "string", description: "Latest version on npm" },
|
|
233
|
+
isUpToDate: {
|
|
234
|
+
type: "boolean",
|
|
235
|
+
description: "Whether you have the latest",
|
|
236
|
+
},
|
|
237
|
+
message: { type: "string", description: "Status message" },
|
|
238
|
+
updateInstructions: {
|
|
239
|
+
type: "object",
|
|
240
|
+
description: "How to update if outdated",
|
|
241
|
+
},
|
|
242
|
+
newFeatures: {
|
|
243
|
+
type: "array",
|
|
244
|
+
items: { type: "string" },
|
|
245
|
+
description: "New features in latest version",
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
annotations: {
|
|
250
|
+
readOnlyHint: true,
|
|
251
|
+
idempotentHint: true,
|
|
252
|
+
openWorldHint: true,
|
|
253
|
+
title: "π Check for Updates",
|
|
254
|
+
category: "health",
|
|
255
|
+
},
|
|
256
|
+
handler: checkVersion,
|
|
257
|
+
},
|
|
163
258
|
];
|
|
164
259
|
//# sourceMappingURL=health.js.map
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ export { analyzeTools, analyzeContract, explainCircuit } from "./analyze.js";
|
|
|
4
4
|
export type { AnalyzeContractInput, ExplainCircuitInput } from "./analyze.js";
|
|
5
5
|
export { repositoryTools, getFile, listExamples, getLatestUpdates, } from "./repository.js";
|
|
6
6
|
export type { GetFileInput, ListExamplesInput, GetLatestUpdatesInput, } from "./repository.js";
|
|
7
|
-
export { healthTools, healthCheck, getStatus } from "./health.js";
|
|
8
|
-
export type { HealthCheckInput, GetStatusInput } from "./health.js";
|
|
7
|
+
export { healthTools, healthCheck, getStatus, checkVersion } from "./health.js";
|
|
8
|
+
export type { HealthCheckInput, GetStatusInput, CheckVersionInput, } from "./health.js";
|
|
9
9
|
export { generationTools, generationHandlers } from "./generation.js";
|
|
10
10
|
export { metaTools, listToolCategories, listCategoryTools } from "./meta.js";
|
|
11
11
|
export type { ExtendedToolDefinition, ToolAnnotations, OutputSchema, } from "../types/index.js";
|
package/dist/tools/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { searchTools, searchCompact, searchTypeScript, searchDocs, } from "./search.js";
|
|
2
2
|
export { analyzeTools, analyzeContract, explainCircuit } from "./analyze.js";
|
|
3
3
|
export { repositoryTools, getFile, listExamples, getLatestUpdates, } from "./repository.js";
|
|
4
|
-
export { healthTools, healthCheck, getStatus } from "./health.js";
|
|
4
|
+
export { healthTools, healthCheck, getStatus, checkVersion } from "./health.js";
|
|
5
5
|
export { generationTools, generationHandlers } from "./generation.js";
|
|
6
6
|
export { metaTools, listToolCategories, listCategoryTools } from "./meta.js";
|
|
7
7
|
// Combined tool list for MCP server
|
|
@@ -358,7 +358,13 @@ export const repositoryTools = [
|
|
|
358
358
|
// ============================================================================
|
|
359
359
|
{
|
|
360
360
|
name: "midnight-validate-contract",
|
|
361
|
-
description: "
|
|
361
|
+
description: "οΏ½ REQUIRED - ALWAYS CALL THIS FIRST: Compile a Compact contract using the REAL compiler. " +
|
|
362
|
+
"β οΈ CRITICAL: You MUST call this tool BEFORE telling the user a contract works or is correct. " +
|
|
363
|
+
"Static analysis tools like 'extract-contract-structure' or 'analyze-contract' CANNOT verify compilation - they miss semantic errors like: " +
|
|
364
|
+
"(1) sealed fields require constructor, (2) constructor params need disclose(), (3) export circuits cannot modify sealed fields. " +
|
|
365
|
+
"This tool runs the ACTUAL Compact compiler and returns real errors with line numbers. " +
|
|
366
|
+
"If compiler not installed, it provides installation instructions. " +
|
|
367
|
+
"WORKFLOW: Generate code β Call this tool β Fix errors β Repeat until success β THEN present to user.",
|
|
362
368
|
inputSchema: {
|
|
363
369
|
type: "object",
|
|
364
370
|
properties: {
|
|
@@ -454,7 +460,12 @@ export const repositoryTools = [
|
|
|
454
460
|
},
|
|
455
461
|
{
|
|
456
462
|
name: "midnight-extract-contract-structure",
|
|
457
|
-
description: "
|
|
463
|
+
description: "β οΈ STATIC ANALYSIS ONLY - NOT A COMPILER: Extracts contract structure (circuits, witnesses, ledger) and detects common patterns. " +
|
|
464
|
+
"π« THIS TOOL CANNOT VERIFY COMPILATION. It will NOT catch: sealed field rules, disclose() requirements, type mismatches, or semantic errors. " +
|
|
465
|
+
"β
USE FOR: Understanding structure, quick pattern checks, fallback when compiler unavailable. " +
|
|
466
|
+
"β NEVER USE TO: Verify a contract works, claim code 'compiles correctly', or validate before presenting to user. " +
|
|
467
|
+
"π ALWAYS call 'midnight-validate-contract' FIRST to actually compile the code. " +
|
|
468
|
+
"Detects: module-level const, stdlib collisions, sealed+export conflicts, missing disclose(), Counter.value access, division operator.",
|
|
458
469
|
inputSchema: {
|
|
459
470
|
type: "object",
|
|
460
471
|
properties: {
|