midnight-mcp 0.1.41 → 0.2.2

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.
Files changed (103) hide show
  1. package/README.md +32 -1
  2. package/dist/bin.d.ts +1 -0
  3. package/dist/bin.js +60 -0
  4. package/dist/chunk-HOWO4K5A.js +2197 -0
  5. package/dist/chunk-S7G4OHA4.js +8306 -0
  6. package/dist/db-YDGUWI5K.js +7 -0
  7. package/dist/index.d.ts +205 -3
  8. package/dist/index.js +28 -16
  9. package/package.json +16 -6
  10. package/dist/config/compact-version.d.ts +0 -183
  11. package/dist/config/compact-version.js +0 -423
  12. package/dist/db/index.d.ts +0 -3
  13. package/dist/db/index.js +0 -2
  14. package/dist/db/vectorStore.d.ts +0 -69
  15. package/dist/db/vectorStore.js +0 -196
  16. package/dist/pipeline/embeddings.d.ts +0 -25
  17. package/dist/pipeline/embeddings.js +0 -103
  18. package/dist/pipeline/github.d.ts +0 -84
  19. package/dist/pipeline/github.js +0 -399
  20. package/dist/pipeline/index.d.ts +0 -11
  21. package/dist/pipeline/index.js +0 -6
  22. package/dist/pipeline/indexer.d.ts +0 -41
  23. package/dist/pipeline/indexer.js +0 -254
  24. package/dist/pipeline/parser.d.ts +0 -46
  25. package/dist/pipeline/parser.js +0 -436
  26. package/dist/pipeline/releases.d.ts +0 -112
  27. package/dist/pipeline/releases.js +0 -298
  28. package/dist/pipeline/repository.d.ts +0 -372
  29. package/dist/pipeline/repository.js +0 -520
  30. package/dist/prompts/index.d.ts +0 -3
  31. package/dist/prompts/index.js +0 -2
  32. package/dist/prompts/templates.d.ts +0 -26
  33. package/dist/prompts/templates.js +0 -443
  34. package/dist/resources/code.d.ts +0 -15
  35. package/dist/resources/code.js +0 -122
  36. package/dist/resources/content/code-content.d.ts +0 -6
  37. package/dist/resources/content/code-content.js +0 -802
  38. package/dist/resources/content/docs-content.d.ts +0 -14
  39. package/dist/resources/content/docs-content.js +0 -1202
  40. package/dist/resources/content/index.d.ts +0 -6
  41. package/dist/resources/content/index.js +0 -6
  42. package/dist/resources/docs.d.ts +0 -15
  43. package/dist/resources/docs.js +0 -98
  44. package/dist/resources/index.d.ts +0 -6
  45. package/dist/resources/index.js +0 -13
  46. package/dist/resources/schemas.d.ts +0 -16
  47. package/dist/resources/schemas.js +0 -407
  48. package/dist/scripts/index-repos.d.ts +0 -12
  49. package/dist/scripts/index-repos.js +0 -53
  50. package/dist/server.d.ts +0 -43
  51. package/dist/server.js +0 -696
  52. package/dist/services/index.d.ts +0 -6
  53. package/dist/services/index.js +0 -6
  54. package/dist/services/sampling.d.ts +0 -62
  55. package/dist/services/sampling.js +0 -277
  56. package/dist/tools/analyze.d.ts +0 -106
  57. package/dist/tools/analyze.js +0 -431
  58. package/dist/tools/generation.d.ts +0 -9
  59. package/dist/tools/generation.js +0 -285
  60. package/dist/tools/health.d.ts +0 -120
  61. package/dist/tools/health.js +0 -365
  62. package/dist/tools/index.d.ts +0 -14
  63. package/dist/tools/index.js +0 -22
  64. package/dist/tools/meta.d.ts +0 -61
  65. package/dist/tools/meta.js +0 -282
  66. package/dist/tools/repository/constants.d.ts +0 -19
  67. package/dist/tools/repository/constants.js +0 -324
  68. package/dist/tools/repository/handlers.d.ts +0 -373
  69. package/dist/tools/repository/handlers.js +0 -724
  70. package/dist/tools/repository/index.d.ts +0 -9
  71. package/dist/tools/repository/index.js +0 -13
  72. package/dist/tools/repository/schemas.d.ts +0 -153
  73. package/dist/tools/repository/schemas.js +0 -106
  74. package/dist/tools/repository/tools.d.ts +0 -7
  75. package/dist/tools/repository/tools.js +0 -484
  76. package/dist/tools/repository/validation.d.ts +0 -106
  77. package/dist/tools/repository/validation.js +0 -820
  78. package/dist/tools/repository.d.ts +0 -6
  79. package/dist/tools/repository.js +0 -7
  80. package/dist/tools/search.d.ts +0 -76
  81. package/dist/tools/search.js +0 -423
  82. package/dist/types/index.d.ts +0 -2
  83. package/dist/types/index.js +0 -2
  84. package/dist/types/mcp.d.ts +0 -187
  85. package/dist/types/mcp.js +0 -6
  86. package/dist/utils/cache.d.ts +0 -77
  87. package/dist/utils/cache.js +0 -172
  88. package/dist/utils/config.d.ts +0 -70
  89. package/dist/utils/config.js +0 -294
  90. package/dist/utils/errors.d.ts +0 -111
  91. package/dist/utils/errors.js +0 -165
  92. package/dist/utils/health.d.ts +0 -29
  93. package/dist/utils/health.js +0 -132
  94. package/dist/utils/hosted-api.d.ts +0 -67
  95. package/dist/utils/hosted-api.js +0 -119
  96. package/dist/utils/index.d.ts +0 -16
  97. package/dist/utils/index.js +0 -15
  98. package/dist/utils/logger.d.ts +0 -48
  99. package/dist/utils/logger.js +0 -124
  100. package/dist/utils/rate-limit.d.ts +0 -61
  101. package/dist/utils/rate-limit.js +0 -148
  102. package/dist/utils/validation.d.ts +0 -52
  103. package/dist/utils/validation.js +0 -255
@@ -0,0 +1,7 @@
1
+ import {
2
+ vectorStore
3
+ } from "./chunk-HOWO4K5A.js";
4
+ export {
5
+ vectorStore
6
+ };
7
+ //# sourceMappingURL=db-YDGUWI5K.js.map
package/dist/index.d.ts CHANGED
@@ -1,3 +1,205 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=index.d.ts.map
1
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
2
+
3
+ /**
4
+ * Initialize the server and vector store
5
+ */
6
+ declare function initializeServer(): Promise<Server>;
7
+ /**
8
+ * Start the server with stdio transport
9
+ */
10
+ declare function startServer(): Promise<void>;
11
+ /**
12
+ * Start the server with HTTP transport (SSE + Streamable HTTP)
13
+ */
14
+ declare function startHttpServer(port?: number): Promise<void>;
15
+
16
+ /**
17
+ * Extended MCP types for advanced features
18
+ * Includes tool annotations, output schemas, and resource templates
19
+ */
20
+ /**
21
+ * Tool annotations provide hints about tool behavior
22
+ * These help clients make better decisions about tool usage
23
+ */
24
+ interface ToolAnnotations {
25
+ /**
26
+ * If true, the tool does not modify any state
27
+ * Clients can safely retry or parallelize read-only tools
28
+ */
29
+ readOnlyHint?: boolean;
30
+ /**
31
+ * If true, calling the tool multiple times with the same input
32
+ * produces the same result (safe to retry)
33
+ */
34
+ idempotentHint?: boolean;
35
+ /**
36
+ * If true, the tool may return results from external sources
37
+ * that could change over time
38
+ */
39
+ openWorldHint?: boolean;
40
+ /**
41
+ * If true, the tool may take a long time to complete
42
+ * Clients should show progress indicators
43
+ */
44
+ longRunningHint?: boolean;
45
+ /**
46
+ * Human-readable title for display in UIs
47
+ */
48
+ title?: string;
49
+ /**
50
+ * If true, this tool performs destructive or irreversible actions
51
+ * Clients should require human confirmation before execution
52
+ */
53
+ destructiveHint?: boolean;
54
+ /**
55
+ * If true, this tool requires explicit human confirmation
56
+ * before execution (e.g., financial transactions, deletions)
57
+ */
58
+ requiresConfirmation?: boolean;
59
+ /**
60
+ * Tool category for progressive disclosure
61
+ * Allows clients to group/filter tools by domain
62
+ */
63
+ category?: ToolCategory;
64
+ }
65
+ /**
66
+ * Tool categories for progressive disclosure
67
+ * Clients can initially show categories, then expand to individual tools
68
+ */
69
+ type ToolCategory = "search" | "analyze" | "repository" | "versioning" | "generation" | "health" | "compound";
70
+ /**
71
+ * JSON Schema for structured tool outputs
72
+ * Enables better LLM parsing and IDE integration
73
+ */
74
+ interface OutputSchema {
75
+ type: "object" | "array" | "string" | "number" | "boolean";
76
+ properties?: Record<string, PropertySchema>;
77
+ items?: PropertySchema;
78
+ required?: string[];
79
+ description?: string;
80
+ }
81
+ interface PropertySchema {
82
+ type: "string" | "number" | "boolean" | "array" | "object";
83
+ description?: string;
84
+ items?: PropertySchema;
85
+ properties?: Record<string, PropertySchema>;
86
+ enum?: string[];
87
+ }
88
+ interface ExtendedToolDefinition {
89
+ name: string;
90
+ description: string;
91
+ inputSchema: {
92
+ type: "object";
93
+ properties: Record<string, unknown>;
94
+ required?: string[];
95
+ };
96
+ outputSchema?: OutputSchema;
97
+ annotations?: ToolAnnotations;
98
+ handler: (input: any) => Promise<any>;
99
+ }
100
+
101
+ /**
102
+ * Tools module exports
103
+ * Barrel file for all MCP tools
104
+ */
105
+
106
+ declare const allTools: ExtendedToolDefinition[];
107
+
108
+ interface ResourceDefinition {
109
+ uri: string;
110
+ name: string;
111
+ description: string;
112
+ mimeType: string;
113
+ }
114
+ /**
115
+ * Get schema content by URI
116
+ */
117
+ declare function getSchema(uri: string): object | null;
118
+
119
+ /**
120
+ * Documentation resources
121
+ * Provides access to Midnight documentation via MCP resources
122
+ */
123
+
124
+ /**
125
+ * Get documentation content by URI
126
+ */
127
+ declare function getDocumentation(uri: string): Promise<string | null>;
128
+
129
+ /**
130
+ * Code resources
131
+ * Provides access to Midnight code examples via MCP resources
132
+ */
133
+
134
+ /**
135
+ * Get code content by URI
136
+ */
137
+ declare function getCode(uri: string): Promise<string | null>;
138
+
139
+ declare const allResources: ResourceDefinition[];
140
+
141
+ interface PromptDefinition {
142
+ name: string;
143
+ description: string;
144
+ arguments: Array<{
145
+ name: string;
146
+ description: string;
147
+ required: boolean;
148
+ }>;
149
+ }
150
+ interface PromptMessage {
151
+ role: "user" | "assistant";
152
+ content: {
153
+ type: "text";
154
+ text: string;
155
+ };
156
+ }
157
+ declare const promptDefinitions: PromptDefinition[];
158
+ /**
159
+ * Generate prompt messages based on template and arguments
160
+ */
161
+ declare function generatePrompt(name: string, args: Record<string, string>): PromptMessage[];
162
+
163
+ type LogLevel = "debug" | "info" | "warn" | "error";
164
+ type LogFormat = "text" | "json";
165
+ declare class Logger {
166
+ private level;
167
+ private format;
168
+ private service;
169
+ constructor(level?: LogLevel, format?: LogFormat, service?: string);
170
+ /**
171
+ * Set log format at runtime
172
+ */
173
+ setFormat(format: LogFormat): void;
174
+ /**
175
+ * Set log level at runtime
176
+ */
177
+ setLevel(level: LogLevel): void;
178
+ private shouldLog;
179
+ private formatTextMessage;
180
+ private formatJsonMessage;
181
+ private formatMessage;
182
+ debug(message: string, meta?: object): void;
183
+ info(message: string, meta?: object): void;
184
+ warn(message: string, meta?: object): void;
185
+ error(message: string, meta?: object): void;
186
+ /**
187
+ * Create a child logger with additional context
188
+ */
189
+ child(context: object): ChildLogger;
190
+ }
191
+ /**
192
+ * Child logger that includes additional context in all log messages
193
+ */
194
+ declare class ChildLogger {
195
+ private parent;
196
+ private context;
197
+ constructor(parent: Logger, context: object);
198
+ debug(message: string, meta?: object): void;
199
+ info(message: string, meta?: object): void;
200
+ warn(message: string, meta?: object): void;
201
+ error(message: string, meta?: object): void;
202
+ }
203
+ declare const logger: Logger;
204
+
205
+ export { type ExtendedToolDefinition, type OutputSchema, allResources, allTools, generatePrompt, getCode, getDocumentation, getSchema, initializeServer, logger, promptDefinitions, startHttpServer, startServer };
package/dist/index.js CHANGED
@@ -1,17 +1,29 @@
1
- #!/usr/bin/env node
2
- import { startServer } from "./server.js";
3
- // Handle uncaught errors
4
- process.on("uncaughtException", (error) => {
5
- console.error("Uncaught exception:", error);
6
- process.exit(1);
7
- });
8
- process.on("unhandledRejection", (reason) => {
9
- console.error("Unhandled rejection:", reason);
10
- process.exit(1);
11
- });
12
- // Start the server
13
- startServer().catch((error) => {
14
- console.error("Failed to start server:", error);
15
- process.exit(1);
16
- });
1
+ import {
2
+ allResources,
3
+ allTools,
4
+ generatePrompt,
5
+ getCode,
6
+ getDocumentation,
7
+ getSchema,
8
+ initializeServer,
9
+ promptDefinitions,
10
+ startHttpServer,
11
+ startServer
12
+ } from "./chunk-S7G4OHA4.js";
13
+ import {
14
+ logger
15
+ } from "./chunk-HOWO4K5A.js";
16
+ export {
17
+ allResources,
18
+ allTools,
19
+ generatePrompt,
20
+ getCode,
21
+ getDocumentation,
22
+ getSchema,
23
+ initializeServer,
24
+ logger,
25
+ promptDefinitions,
26
+ startHttpServer,
27
+ startServer
28
+ };
17
29
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,20 +1,23 @@
1
1
  {
2
2
  "name": "midnight-mcp",
3
- "version": "0.1.41",
3
+ "version": "0.2.2",
4
4
  "description": "Model Context Protocol Server for Midnight Blockchain Development",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
8
- "midnight-mcp": "./dist/index.js"
8
+ "midnight-mcp": "./dist/bin.js"
9
9
  },
10
10
  "scripts": {
11
- "build": "tsc",
12
- "start": "node dist/index.js",
13
- "dev": "tsx watch src/index.ts",
11
+ "build": "tsup",
12
+ "typecheck": "tsc --noEmit",
13
+ "start": "node dist/bin.js --stdio",
14
+ "start:http": "node dist/bin.js --http",
15
+ "dev": "NODE_ENV=development tsup --watch",
14
16
  "test": "vitest",
15
17
  "test:coverage": "vitest --coverage",
16
18
  "format": "prettier --write src/**/*.ts",
17
- "prepublishOnly": "npm run build"
19
+ "prepublishOnly": "npm run typecheck && npm run build",
20
+ "ci": "npm run typecheck && npm run build && npm test"
18
21
  },
19
22
  "keywords": [
20
23
  "midnight",
@@ -32,15 +35,22 @@
32
35
  "@modelcontextprotocol/sdk": "^1.0.0",
33
36
  "chromadb": "^1.8.1",
34
37
  "dotenv": "^16.3.1",
38
+ "express": "^5.2.1",
39
+ "js-yaml": "^4.1.1",
35
40
  "octokit": "^3.1.2",
36
41
  "openai": "^4.20.1",
42
+ "yargs": "^18.0.0",
37
43
  "zod": "^3.22.4"
38
44
  },
39
45
  "devDependencies": {
46
+ "@types/express": "^5.0.6",
47
+ "@types/js-yaml": "^4.0.9",
40
48
  "@types/node": "^20.10.0",
41
49
  "@types/tar": "^6.1.13",
50
+ "@types/yargs": "^17.0.35",
42
51
  "prettier": "^3.1.0",
43
52
  "tar": "^7.5.2",
53
+ "tsup": "^8.5.1",
44
54
  "tsx": "^4.6.2",
45
55
  "typescript": "^5.3.2",
46
56
  "vitest": "^1.0.0"
@@ -1,183 +0,0 @@
1
- /**
2
- * Compact Language Version Configuration
3
- *
4
- * MAINTAINER: Update these values when Compact language syntax changes!
5
- * See docs/SYNTAX_MAINTENANCE.md for the full update checklist.
6
- */
7
- /**
8
- * Supported Compact language version range
9
- * Update when new compiler versions are released
10
- */
11
- export declare const COMPACT_VERSION: {
12
- /** Minimum supported version */
13
- min: string;
14
- /** Maximum supported version */
15
- max: string;
16
- /** When this config was last updated */
17
- lastUpdated: string;
18
- /** Source of truth for syntax patterns */
19
- referenceSource: string;
20
- };
21
- /**
22
- * Current pragma format that should be used in contracts
23
- */
24
- export declare const RECOMMENDED_PRAGMA: string;
25
- /**
26
- * Known deprecated patterns (add new ones here when Compact evolves)
27
- */
28
- export declare const DEPRECATED_PATTERNS: {
29
- /** Deprecated in: 0.16 */
30
- ledgerBlock: {
31
- pattern: RegExp;
32
- since: string;
33
- replacement: string;
34
- description: string;
35
- };
36
- /** Deprecated in: 0.15 */
37
- cellWrapper: {
38
- pattern: RegExp;
39
- since: string;
40
- replacement: string;
41
- description: string;
42
- };
43
- /** Never existed */
44
- voidType: {
45
- pattern: RegExp;
46
- since: string;
47
- replacement: string;
48
- description: string;
49
- };
50
- };
51
- /**
52
- * Reference contracts known to compile successfully
53
- * Use these to verify syntax is still correct
54
- */
55
- export declare const REFERENCE_CONTRACTS: {
56
- name: string;
57
- repo: string;
58
- description: string;
59
- }[];
60
- /**
61
- * Get the version info as a string for display
62
- */
63
- export declare function getVersionInfo(): string;
64
- /**
65
- * Check if a version is within supported range
66
- */
67
- export declare function isVersionSupported(version: string): boolean;
68
- /**
69
- * Built-in functions vs patterns you must implement yourself
70
- * CRITICAL: These are the actual stdlib functions available in Compact
71
- */
72
- export declare const BUILTIN_FUNCTIONS: {
73
- /** Actually built into the language/stdlib */
74
- stdlib: {
75
- name: string;
76
- signature: string;
77
- description: string;
78
- }[];
79
- /** NOT built-in - you must implement these patterns yourself */
80
- notBuiltIn: {
81
- name: string;
82
- wrongUsage: string;
83
- correctPattern: string;
84
- description: string;
85
- }[];
86
- };
87
- /**
88
- * Type compatibility rules - what types can be compared/operated together
89
- */
90
- export declare const TYPE_COMPATIBILITY: {
91
- comparisons: ({
92
- types: string;
93
- works: boolean;
94
- note: string;
95
- fix?: undefined;
96
- } | {
97
- types: string;
98
- works: boolean;
99
- fix: string;
100
- note?: undefined;
101
- })[];
102
- arithmetic: ({
103
- types: string;
104
- works: boolean;
105
- note: string;
106
- fix?: undefined;
107
- } | {
108
- types: string;
109
- works: boolean;
110
- fix: string;
111
- note?: undefined;
112
- })[];
113
- typeCasting: ({
114
- from: string;
115
- to: string;
116
- direct: boolean;
117
- fix: string;
118
- note?: undefined;
119
- } | {
120
- from: string;
121
- to: string;
122
- direct: boolean;
123
- note: string;
124
- fix?: undefined;
125
- })[];
126
- assignments: {
127
- types: string;
128
- works: boolean;
129
- fix: string;
130
- }[];
131
- tips: string[];
132
- };
133
- /**
134
- * Ledger type limitations - what works in circuits vs TypeScript
135
- */
136
- export declare const LEDGER_TYPE_LIMITS: {
137
- Counter: {
138
- circuitOperations: {
139
- method: string;
140
- works: boolean;
141
- note: string;
142
- }[];
143
- typescriptAccess: string;
144
- reason: string;
145
- };
146
- Map: {
147
- circuitOperations: {
148
- method: string;
149
- works: boolean;
150
- note: string;
151
- }[];
152
- typescriptAccess: string;
153
- note: string;
154
- };
155
- Set: {
156
- circuitOperations: {
157
- method: string;
158
- works: boolean;
159
- note: string;
160
- }[];
161
- typescriptAccess: string;
162
- note: string;
163
- };
164
- MerkleTree: {
165
- circuitOperations: {
166
- method: string;
167
- works: boolean;
168
- note: string;
169
- }[];
170
- typescriptAccess: string;
171
- pattern: string;
172
- };
173
- };
174
- /**
175
- * Common compilation errors with their fixes
176
- * Maps actual compiler error messages to solutions
177
- */
178
- export declare const COMMON_ERRORS: {
179
- error: string;
180
- cause: string;
181
- fix: string;
182
- }[];
183
- //# sourceMappingURL=compact-version.d.ts.map