midnight-mcp 0.1.40 → 0.2.1

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 (100) hide show
  1. package/README.md +34 -0
  2. package/dist/bin.d.ts +1 -0
  3. package/dist/bin.js +10764 -0
  4. package/dist/index.d.ts +205 -3
  5. package/dist/index.js +10722 -15
  6. package/package.json +16 -6
  7. package/dist/config/compact-version.d.ts +0 -183
  8. package/dist/config/compact-version.js +0 -423
  9. package/dist/db/index.d.ts +0 -3
  10. package/dist/db/index.js +0 -2
  11. package/dist/db/vectorStore.d.ts +0 -69
  12. package/dist/db/vectorStore.js +0 -196
  13. package/dist/pipeline/embeddings.d.ts +0 -25
  14. package/dist/pipeline/embeddings.js +0 -103
  15. package/dist/pipeline/github.d.ts +0 -84
  16. package/dist/pipeline/github.js +0 -399
  17. package/dist/pipeline/index.d.ts +0 -11
  18. package/dist/pipeline/index.js +0 -6
  19. package/dist/pipeline/indexer.d.ts +0 -41
  20. package/dist/pipeline/indexer.js +0 -254
  21. package/dist/pipeline/parser.d.ts +0 -46
  22. package/dist/pipeline/parser.js +0 -436
  23. package/dist/pipeline/releases.d.ts +0 -112
  24. package/dist/pipeline/releases.js +0 -298
  25. package/dist/pipeline/repository.d.ts +0 -372
  26. package/dist/pipeline/repository.js +0 -520
  27. package/dist/prompts/index.d.ts +0 -3
  28. package/dist/prompts/index.js +0 -2
  29. package/dist/prompts/templates.d.ts +0 -26
  30. package/dist/prompts/templates.js +0 -443
  31. package/dist/resources/code.d.ts +0 -15
  32. package/dist/resources/code.js +0 -122
  33. package/dist/resources/content/code-content.d.ts +0 -6
  34. package/dist/resources/content/code-content.js +0 -802
  35. package/dist/resources/content/docs-content.d.ts +0 -14
  36. package/dist/resources/content/docs-content.js +0 -1202
  37. package/dist/resources/content/index.d.ts +0 -6
  38. package/dist/resources/content/index.js +0 -6
  39. package/dist/resources/docs.d.ts +0 -15
  40. package/dist/resources/docs.js +0 -98
  41. package/dist/resources/index.d.ts +0 -6
  42. package/dist/resources/index.js +0 -13
  43. package/dist/resources/schemas.d.ts +0 -16
  44. package/dist/resources/schemas.js +0 -407
  45. package/dist/scripts/index-repos.d.ts +0 -12
  46. package/dist/scripts/index-repos.js +0 -53
  47. package/dist/server.d.ts +0 -43
  48. package/dist/server.js +0 -693
  49. package/dist/services/index.d.ts +0 -6
  50. package/dist/services/index.js +0 -6
  51. package/dist/services/sampling.d.ts +0 -62
  52. package/dist/services/sampling.js +0 -277
  53. package/dist/tools/analyze.d.ts +0 -106
  54. package/dist/tools/analyze.js +0 -431
  55. package/dist/tools/generation.d.ts +0 -9
  56. package/dist/tools/generation.js +0 -285
  57. package/dist/tools/health.d.ts +0 -120
  58. package/dist/tools/health.js +0 -362
  59. package/dist/tools/index.d.ts +0 -14
  60. package/dist/tools/index.js +0 -22
  61. package/dist/tools/meta.d.ts +0 -61
  62. package/dist/tools/meta.js +0 -282
  63. package/dist/tools/repository/constants.d.ts +0 -19
  64. package/dist/tools/repository/constants.js +0 -324
  65. package/dist/tools/repository/handlers.d.ts +0 -373
  66. package/dist/tools/repository/handlers.js +0 -724
  67. package/dist/tools/repository/index.d.ts +0 -9
  68. package/dist/tools/repository/index.js +0 -13
  69. package/dist/tools/repository/schemas.d.ts +0 -153
  70. package/dist/tools/repository/schemas.js +0 -106
  71. package/dist/tools/repository/tools.d.ts +0 -7
  72. package/dist/tools/repository/tools.js +0 -484
  73. package/dist/tools/repository/validation.d.ts +0 -106
  74. package/dist/tools/repository/validation.js +0 -820
  75. package/dist/tools/repository.d.ts +0 -6
  76. package/dist/tools/repository.js +0 -7
  77. package/dist/tools/search.d.ts +0 -76
  78. package/dist/tools/search.js +0 -423
  79. package/dist/types/index.d.ts +0 -2
  80. package/dist/types/index.js +0 -2
  81. package/dist/types/mcp.d.ts +0 -187
  82. package/dist/types/mcp.js +0 -6
  83. package/dist/utils/cache.d.ts +0 -77
  84. package/dist/utils/cache.js +0 -172
  85. package/dist/utils/config.d.ts +0 -70
  86. package/dist/utils/config.js +0 -294
  87. package/dist/utils/errors.d.ts +0 -111
  88. package/dist/utils/errors.js +0 -165
  89. package/dist/utils/health.d.ts +0 -29
  90. package/dist/utils/health.js +0 -132
  91. package/dist/utils/hosted-api.d.ts +0 -67
  92. package/dist/utils/hosted-api.js +0 -119
  93. package/dist/utils/index.d.ts +0 -16
  94. package/dist/utils/index.js +0 -15
  95. package/dist/utils/logger.d.ts +0 -48
  96. package/dist/utils/logger.js +0 -124
  97. package/dist/utils/rate-limit.d.ts +0 -61
  98. package/dist/utils/rate-limit.js +0 -148
  99. package/dist/utils/validation.d.ts +0 -52
  100. package/dist/utils/validation.js +0 -255
@@ -1,6 +0,0 @@
1
- /**
2
- * Content barrel export
3
- */
4
- export { EMBEDDED_DOCS } from "./docs-content.js";
5
- export { EMBEDDED_CODE } from "./code-content.js";
6
- //# sourceMappingURL=index.d.ts.map
@@ -1,6 +0,0 @@
1
- /**
2
- * Content barrel export
3
- */
4
- export { EMBEDDED_DOCS } from "./docs-content.js";
5
- export { EMBEDDED_CODE } from "./code-content.js";
6
- //# sourceMappingURL=index.js.map
@@ -1,15 +0,0 @@
1
- /**
2
- * Documentation resources
3
- * Provides access to Midnight documentation via MCP resources
4
- */
5
- import type { ResourceDefinition } from "./schemas.js";
6
- export declare const documentationResources: ResourceDefinition[];
7
- /**
8
- * Get documentation content by URI
9
- */
10
- export declare function getDocumentation(uri: string): Promise<string | null>;
11
- /**
12
- * List all available documentation resources
13
- */
14
- export declare function listDocumentationResources(): ResourceDefinition[];
15
- //# sourceMappingURL=docs.d.ts.map
@@ -1,98 +0,0 @@
1
- /**
2
- * Documentation resources
3
- * Provides access to Midnight documentation via MCP resources
4
- */
5
- import { githubClient } from "../pipeline/index.js";
6
- import { logger } from "../utils/index.js";
7
- import { EMBEDDED_DOCS } from "./content/index.js";
8
- // Documentation resource URIs
9
- // NOTE: Only resources with embedded content are listed here.
10
- // For other docs (glossary, Zswap, Kachina, etc.), use search_docs tool
11
- // which queries the indexed Vector DB for the full midnight-docs repo.
12
- export const documentationResources = [
13
- {
14
- uri: "midnight://docs/compact-reference",
15
- name: "Compact Language Reference",
16
- description: "Quick reference for Compact syntax, types, circuits, and witnesses",
17
- mimeType: "text/markdown",
18
- },
19
- {
20
- uri: "midnight://docs/sdk-api",
21
- name: "TypeScript SDK API",
22
- description: "TypeScript SDK API reference with type signatures and usage examples",
23
- mimeType: "text/markdown",
24
- },
25
- {
26
- uri: "midnight://docs/openzeppelin",
27
- name: "OpenZeppelin Contracts for Compact",
28
- description: "Official OpenZeppelin library - tokens, access control, security patterns",
29
- mimeType: "text/markdown",
30
- },
31
- {
32
- uri: "midnight://docs/openzeppelin/token",
33
- name: "OpenZeppelin FungibleToken",
34
- description: "Privacy-preserving token standard for Midnight",
35
- mimeType: "text/markdown",
36
- },
37
- {
38
- uri: "midnight://docs/openzeppelin/access",
39
- name: "OpenZeppelin Access Control",
40
- description: "Ownable, roles, and access control patterns",
41
- mimeType: "text/markdown",
42
- },
43
- {
44
- uri: "midnight://docs/openzeppelin/security",
45
- name: "OpenZeppelin Security",
46
- description: "Pausable and security patterns",
47
- mimeType: "text/markdown",
48
- },
49
- {
50
- uri: "midnight://docs/tokenomics",
51
- name: "Tokenomics Summary",
52
- description: "Curated summary: NIGHT token, DUST resource, block rewards, Glacier Drop distribution",
53
- mimeType: "text/markdown",
54
- },
55
- {
56
- uri: "midnight://docs/wallet-integration",
57
- name: "Wallet Integration Guide",
58
- description: "DApp Connector API for Midnight Lace wallet - React hooks, TypeScript types",
59
- mimeType: "text/markdown",
60
- },
61
- {
62
- uri: "midnight://docs/common-errors",
63
- name: "Common Errors & Solutions",
64
- description: "Troubleshooting guide: compiler errors, SDK errors, deployment issues with fixes",
65
- mimeType: "text/markdown",
66
- },
67
- ];
68
- /**
69
- * Get documentation content by URI
70
- */
71
- export async function getDocumentation(uri) {
72
- // Check embedded docs first
73
- if (EMBEDDED_DOCS[uri]) {
74
- return EMBEDDED_DOCS[uri];
75
- }
76
- // Try to fetch from GitHub if it's a doc path
77
- if (uri.startsWith("midnight://docs/")) {
78
- const docPath = uri.replace("midnight://docs/", "");
79
- try {
80
- // Try to fetch from midnight-docs repo
81
- const file = await githubClient.getFileContent("midnightntwrk", "midnight-docs", `docs/${docPath}.md`);
82
- if (file) {
83
- return file.content;
84
- }
85
- }
86
- catch (error) {
87
- logger.warn(`Could not fetch doc from GitHub: ${uri}`);
88
- }
89
- }
90
- return null;
91
- }
92
- /**
93
- * List all available documentation resources
94
- */
95
- export function listDocumentationResources() {
96
- return documentationResources;
97
- }
98
- //# sourceMappingURL=docs.js.map
@@ -1,6 +0,0 @@
1
- export { documentationResources, getDocumentation, listDocumentationResources, } from "./docs.js";
2
- export { codeResources, getCode, listCodeResources } from "./code.js";
3
- export { schemaResources, getSchema, listSchemaResources } from "./schemas.js";
4
- export type { ResourceDefinition } from "./schemas.js";
5
- export declare const allResources: import("./schemas.js").ResourceDefinition[];
6
- //# sourceMappingURL=index.d.ts.map
@@ -1,13 +0,0 @@
1
- export { documentationResources, getDocumentation, listDocumentationResources, } from "./docs.js";
2
- export { codeResources, getCode, listCodeResources } from "./code.js";
3
- export { schemaResources, getSchema, listSchemaResources } from "./schemas.js";
4
- // Combine all resources
5
- import { documentationResources } from "./docs.js";
6
- import { codeResources } from "./code.js";
7
- import { schemaResources } from "./schemas.js";
8
- export const allResources = [
9
- ...documentationResources,
10
- ...codeResources,
11
- ...schemaResources,
12
- ];
13
- //# sourceMappingURL=index.js.map
@@ -1,16 +0,0 @@
1
- export interface ResourceDefinition {
2
- uri: string;
3
- name: string;
4
- description: string;
5
- mimeType: string;
6
- }
7
- export declare const schemaResources: ResourceDefinition[];
8
- /**
9
- * Get schema content by URI
10
- */
11
- export declare function getSchema(uri: string): object | null;
12
- /**
13
- * List all available schema resources
14
- */
15
- export declare function listSchemaResources(): ResourceDefinition[];
16
- //# sourceMappingURL=schemas.d.ts.map
@@ -1,407 +0,0 @@
1
- // Schema resources
2
- export const schemaResources = [
3
- {
4
- uri: "midnight://schema/compact-ast",
5
- name: "Compact AST Schema",
6
- description: "JSON schema for Compact Abstract Syntax Tree structures",
7
- mimeType: "application/json",
8
- },
9
- {
10
- uri: "midnight://schema/transaction",
11
- name: "Transaction Schema",
12
- description: "Transaction format schema for Midnight network",
13
- mimeType: "application/json",
14
- },
15
- {
16
- uri: "midnight://schema/proof",
17
- name: "Proof Schema",
18
- description: "ZK proof format schema",
19
- mimeType: "application/json",
20
- },
21
- ];
22
- // Embedded schemas
23
- const EMBEDDED_SCHEMAS = {
24
- "midnight://schema/compact-ast": {
25
- $schema: "http://json-schema.org/draft-07/schema#",
26
- title: "Compact AST",
27
- description: "Abstract Syntax Tree for Compact smart contracts",
28
- type: "object",
29
- definitions: {
30
- LedgerDeclaration: {
31
- type: "object",
32
- properties: {
33
- type: { const: "LedgerDeclaration" },
34
- fields: {
35
- type: "array",
36
- items: { $ref: "#/definitions/LedgerField" },
37
- },
38
- },
39
- required: ["type", "fields"],
40
- },
41
- LedgerField: {
42
- type: "object",
43
- properties: {
44
- name: { type: "string" },
45
- fieldType: { type: "string" },
46
- isPrivate: { type: "boolean" },
47
- annotations: { type: "array", items: { type: "string" } },
48
- },
49
- required: ["name", "fieldType"],
50
- },
51
- CircuitDeclaration: {
52
- type: "object",
53
- properties: {
54
- type: { const: "CircuitDeclaration" },
55
- name: { type: "string" },
56
- isExported: { type: "boolean" },
57
- parameters: {
58
- type: "array",
59
- items: { $ref: "#/definitions/Parameter" },
60
- },
61
- returnType: { type: "string" },
62
- body: { $ref: "#/definitions/BlockStatement" },
63
- },
64
- required: ["type", "name", "parameters", "body"],
65
- },
66
- WitnessDeclaration: {
67
- type: "object",
68
- properties: {
69
- type: { const: "WitnessDeclaration" },
70
- name: { type: "string" },
71
- parameters: {
72
- type: "array",
73
- items: { $ref: "#/definitions/Parameter" },
74
- },
75
- returnType: { type: "string" },
76
- body: { $ref: "#/definitions/BlockStatement" },
77
- },
78
- required: ["type", "name", "parameters", "body"],
79
- },
80
- Parameter: {
81
- type: "object",
82
- properties: {
83
- name: { type: "string" },
84
- paramType: { type: "string" },
85
- isPrivate: { type: "boolean" },
86
- },
87
- required: ["name", "paramType"],
88
- },
89
- BlockStatement: {
90
- type: "object",
91
- properties: {
92
- type: { const: "BlockStatement" },
93
- statements: {
94
- type: "array",
95
- items: { $ref: "#/definitions/Statement" },
96
- },
97
- },
98
- required: ["type", "statements"],
99
- },
100
- Statement: {
101
- oneOf: [
102
- { $ref: "#/definitions/VariableDeclaration" },
103
- { $ref: "#/definitions/AssertStatement" },
104
- { $ref: "#/definitions/ReturnStatement" },
105
- { $ref: "#/definitions/ExpressionStatement" },
106
- ],
107
- },
108
- VariableDeclaration: {
109
- type: "object",
110
- properties: {
111
- type: { const: "VariableDeclaration" },
112
- name: { type: "string" },
113
- varType: { type: "string" },
114
- initializer: { $ref: "#/definitions/Expression" },
115
- },
116
- required: ["type", "name"],
117
- },
118
- AssertStatement: {
119
- type: "object",
120
- properties: {
121
- type: { const: "AssertStatement" },
122
- condition: { $ref: "#/definitions/Expression" },
123
- message: { type: "string" },
124
- },
125
- required: ["type", "condition"],
126
- },
127
- ReturnStatement: {
128
- type: "object",
129
- properties: {
130
- type: { const: "ReturnStatement" },
131
- value: { $ref: "#/definitions/Expression" },
132
- },
133
- required: ["type"],
134
- },
135
- ExpressionStatement: {
136
- type: "object",
137
- properties: {
138
- type: { const: "ExpressionStatement" },
139
- expression: { $ref: "#/definitions/Expression" },
140
- },
141
- required: ["type", "expression"],
142
- },
143
- Expression: {
144
- oneOf: [
145
- { $ref: "#/definitions/BinaryExpression" },
146
- { $ref: "#/definitions/CallExpression" },
147
- { $ref: "#/definitions/MemberExpression" },
148
- { $ref: "#/definitions/Identifier" },
149
- { $ref: "#/definitions/Literal" },
150
- ],
151
- },
152
- BinaryExpression: {
153
- type: "object",
154
- properties: {
155
- type: { const: "BinaryExpression" },
156
- operator: { type: "string" },
157
- left: { $ref: "#/definitions/Expression" },
158
- right: { $ref: "#/definitions/Expression" },
159
- },
160
- required: ["type", "operator", "left", "right"],
161
- },
162
- CallExpression: {
163
- type: "object",
164
- properties: {
165
- type: { const: "CallExpression" },
166
- callee: { $ref: "#/definitions/Expression" },
167
- arguments: {
168
- type: "array",
169
- items: { $ref: "#/definitions/Expression" },
170
- },
171
- },
172
- required: ["type", "callee", "arguments"],
173
- },
174
- MemberExpression: {
175
- type: "object",
176
- properties: {
177
- type: { const: "MemberExpression" },
178
- object: { $ref: "#/definitions/Expression" },
179
- property: { type: "string" },
180
- },
181
- required: ["type", "object", "property"],
182
- },
183
- Identifier: {
184
- type: "object",
185
- properties: {
186
- type: { const: "Identifier" },
187
- name: { type: "string" },
188
- },
189
- required: ["type", "name"],
190
- },
191
- Literal: {
192
- type: "object",
193
- properties: {
194
- type: { const: "Literal" },
195
- value: {},
196
- raw: { type: "string" },
197
- },
198
- required: ["type", "value"],
199
- },
200
- },
201
- properties: {
202
- type: { const: "Program" },
203
- imports: {
204
- type: "array",
205
- items: { type: "string" },
206
- },
207
- ledger: { $ref: "#/definitions/LedgerDeclaration" },
208
- circuits: {
209
- type: "array",
210
- items: { $ref: "#/definitions/CircuitDeclaration" },
211
- },
212
- witnesses: {
213
- type: "array",
214
- items: { $ref: "#/definitions/WitnessDeclaration" },
215
- },
216
- types: {
217
- type: "array",
218
- items: {
219
- type: "object",
220
- properties: {
221
- name: { type: "string" },
222
- definition: { type: "string" },
223
- },
224
- },
225
- },
226
- },
227
- required: ["type"],
228
- },
229
- "midnight://schema/transaction": {
230
- $schema: "http://json-schema.org/draft-07/schema#",
231
- title: "Midnight Transaction",
232
- description: "Transaction format for Midnight network",
233
- type: "object",
234
- properties: {
235
- version: {
236
- type: "integer",
237
- description: "Transaction format version",
238
- },
239
- hash: {
240
- type: "string",
241
- description: "Transaction hash (hex)",
242
- pattern: "^0x[a-fA-F0-9]{64}$",
243
- },
244
- contractAddress: {
245
- type: "string",
246
- description: "Target contract address",
247
- },
248
- circuitName: {
249
- type: "string",
250
- description: "Name of the circuit being called",
251
- },
252
- inputs: {
253
- type: "object",
254
- description: "Public inputs to the circuit",
255
- additionalProperties: true,
256
- },
257
- proof: {
258
- $ref: "#/definitions/Proof",
259
- },
260
- publicOutputs: {
261
- type: "array",
262
- description: "Public outputs from circuit execution",
263
- items: {},
264
- },
265
- stateChanges: {
266
- type: "array",
267
- items: { $ref: "#/definitions/StateChange" },
268
- },
269
- timestamp: {
270
- type: "integer",
271
- description: "Transaction timestamp (Unix)",
272
- },
273
- sender: {
274
- type: "string",
275
- description: "Transaction sender address",
276
- },
277
- nonce: {
278
- type: "integer",
279
- description: "Transaction nonce",
280
- },
281
- fee: {
282
- type: "string",
283
- description: "Transaction fee",
284
- },
285
- },
286
- definitions: {
287
- Proof: {
288
- type: "object",
289
- properties: {
290
- type: {
291
- type: "string",
292
- enum: ["groth16", "plonk"],
293
- },
294
- data: {
295
- type: "string",
296
- description: "Base64 encoded proof data",
297
- },
298
- publicInputs: {
299
- type: "array",
300
- items: { type: "string" },
301
- },
302
- },
303
- required: ["type", "data", "publicInputs"],
304
- },
305
- StateChange: {
306
- type: "object",
307
- properties: {
308
- type: {
309
- type: "string",
310
- enum: ["insert", "update", "delete"],
311
- },
312
- path: {
313
- type: "string",
314
- description: "State path being modified",
315
- },
316
- oldValue: {
317
- description: "Previous value (for updates/deletes)",
318
- },
319
- newValue: {
320
- description: "New value (for inserts/updates)",
321
- },
322
- },
323
- required: ["type", "path"],
324
- },
325
- },
326
- required: ["version", "contractAddress", "circuitName", "proof"],
327
- },
328
- "midnight://schema/proof": {
329
- $schema: "http://json-schema.org/draft-07/schema#",
330
- title: "Midnight ZK Proof",
331
- description: "Zero-knowledge proof format",
332
- type: "object",
333
- properties: {
334
- proofSystem: {
335
- type: "string",
336
- enum: ["groth16", "plonk", "halo2"],
337
- description: "Proof system used",
338
- },
339
- curve: {
340
- type: "string",
341
- enum: ["bn254", "bls12-381"],
342
- description: "Elliptic curve used",
343
- },
344
- proof: {
345
- type: "object",
346
- properties: {
347
- a: {
348
- type: "array",
349
- items: { type: "string" },
350
- description: "Proof element A (G1 point)",
351
- },
352
- b: {
353
- type: "array",
354
- items: {
355
- type: "array",
356
- items: { type: "string" },
357
- },
358
- description: "Proof element B (G2 point)",
359
- },
360
- c: {
361
- type: "array",
362
- items: { type: "string" },
363
- description: "Proof element C (G1 point)",
364
- },
365
- },
366
- required: ["a", "b", "c"],
367
- },
368
- publicInputs: {
369
- type: "array",
370
- items: { type: "string" },
371
- description: "Public inputs to the circuit",
372
- },
373
- publicOutputs: {
374
- type: "array",
375
- items: { type: "string" },
376
- description: "Public outputs from the circuit",
377
- },
378
- verificationKey: {
379
- type: "string",
380
- description: "Reference to verification key",
381
- },
382
- metadata: {
383
- type: "object",
384
- properties: {
385
- circuitName: { type: "string" },
386
- contractAddress: { type: "string" },
387
- generatedAt: { type: "integer" },
388
- proverVersion: { type: "string" },
389
- },
390
- },
391
- },
392
- required: ["proofSystem", "proof", "publicInputs"],
393
- },
394
- };
395
- /**
396
- * Get schema content by URI
397
- */
398
- export function getSchema(uri) {
399
- return EMBEDDED_SCHEMAS[uri] || null;
400
- }
401
- /**
402
- * List all available schema resources
403
- */
404
- export function listSchemaResources() {
405
- return schemaResources;
406
- }
407
- //# sourceMappingURL=schemas.js.map
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Repository Indexing Script
4
- *
5
- * Run this script to index all Midnight repositories into the vector database.
6
- *
7
- * Usage:
8
- * npm run index # Index all repos
9
- * npm run index -- --repo compact # Index specific repo
10
- */
11
- export {};
12
- //# sourceMappingURL=index-repos.d.ts.map
@@ -1,53 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Repository Indexing Script
4
- *
5
- * Run this script to index all Midnight repositories into the vector database.
6
- *
7
- * Usage:
8
- * npm run index # Index all repos
9
- * npm run index -- --repo compact # Index specific repo
10
- */
11
- import { indexAllRepositories, indexRepository } from "../pipeline/index.js";
12
- import { DEFAULT_REPOSITORIES, logger } from "../utils/index.js";
13
- import { vectorStore } from "../db/index.js";
14
- async function main() {
15
- const args = process.argv.slice(2);
16
- const repoArg = args.find((a) => a.startsWith("--repo="));
17
- const specificRepo = repoArg?.split("=")[1];
18
- logger.info("Starting repository indexing...");
19
- // Initialize vector store
20
- try {
21
- await vectorStore.initialize();
22
- }
23
- catch (error) {
24
- logger.error("Failed to initialize vector store", { error: String(error) });
25
- logger.info("Make sure ChromaDB is running: docker run -p 8000:8000 chromadb/chroma");
26
- process.exit(1);
27
- }
28
- if (specificRepo) {
29
- // Index specific repository
30
- const repoConfig = DEFAULT_REPOSITORIES.find((r) => r.repo.toLowerCase() === specificRepo.toLowerCase());
31
- if (!repoConfig) {
32
- logger.error(`Unknown repository: ${specificRepo}`);
33
- logger.info(`Available repositories: ${DEFAULT_REPOSITORIES.map((r) => r.repo).join(", ")}`);
34
- process.exit(1);
35
- }
36
- logger.info(`Indexing repository: ${repoConfig.owner}/${repoConfig.repo}`);
37
- const result = await indexRepository(repoConfig);
38
- logger.info("Indexing complete", result);
39
- }
40
- else {
41
- // Index all repositories
42
- const stats = await indexAllRepositories();
43
- logger.info("Full indexing complete", stats);
44
- }
45
- // Print statistics
46
- const dbStats = await vectorStore.getStats();
47
- logger.info(`Vector store now contains ${dbStats.count} documents`);
48
- }
49
- main().catch((error) => {
50
- logger.error("Indexing failed", { error: String(error) });
51
- process.exit(1);
52
- });
53
- //# sourceMappingURL=index-repos.js.map
package/dist/server.d.ts DELETED
@@ -1,43 +0,0 @@
1
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
2
- import { LoggingLevel } from "@modelcontextprotocol/sdk/types.js";
3
- /**
4
- * Get update warning if outdated (to include in responses)
5
- */
6
- export declare function getUpdateWarning(): string | null;
7
- /**
8
- * Clear all subscriptions (useful for server restart/testing)
9
- */
10
- export declare function clearSubscriptions(): void;
11
- /**
12
- * Mark server as connected (safe to send notifications)
13
- */
14
- export declare function setServerConnected(connected: boolean): void;
15
- /**
16
- * Send a log message to the MCP client
17
- * This allows clients to see server logs for debugging
18
- */
19
- export declare function sendLogToClient(level: LoggingLevel, loggerName: string, data: unknown): void;
20
- /**
21
- * Send a progress notification to the MCP client
22
- * Used for long-running operations like compound tools
23
- */
24
- export declare function sendProgressNotification(progressToken: string | number, progress: number, total?: number, message?: string): void;
25
- export declare function createServer(): Server;
26
- /**
27
- * Notify subscribers when a resource changes
28
- * Call this when re-indexing or when docs are updated
29
- */
30
- export declare function notifyResourceUpdate(server: Server, uri: string): void;
31
- /**
32
- * Get the list of active subscriptions
33
- */
34
- export declare function getActiveSubscriptions(): string[];
35
- /**
36
- * Initialize the server and vector store
37
- */
38
- export declare function initializeServer(): Promise<Server>;
39
- /**
40
- * Start the server with stdio transport
41
- */
42
- export declare function startServer(): Promise<void>;
43
- //# sourceMappingURL=server.d.ts.map