midnight-mcp 0.2.7 → 0.2.8

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
@@ -1,7 +1,7 @@
1
1
  # Midnight MCP Server
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/midnight-mcp.svg)](https://www.npmjs.com/package/midnight-mcp)
4
- [![npm downloads](https://img.shields.io/npm/dm/midnight-mcp)](https://www.npmjs.com/package/midnight-mcp)
4
+ [![npm downloads](https://img.shields.io/npm/dm/midnight-mcp)](https://npm-stat.com/charts.html?package=midnight-mcp)
5
5
  [![License](https://img.shields.io/npm/l/midnight-mcp)](./LICENSE)
6
6
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.3-blue?logo=typescript)](https://www.typescriptlang.org/)
7
7
  [![CI](https://github.com/Olanetsoft/midnight-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/Olanetsoft/midnight-mcp/actions/workflows/ci.yml)
@@ -264,4 +264,6 @@ The hosted API runs on Cloudflare Workers + Vectorize. See [api/README.md](./api
264
264
 
265
265
  MIT
266
266
 
267
- Thanks to all Stargazers ⭐️
267
+ ## Stargazers ⭐️
268
+
269
+ [![Star History Chart](https://api.star-history.com/svg?repos=Olanetsoft/midnight-mcp&type=Date)](https://star-history.com/#Olanetsoft/midnight-mcp&Date)
package/dist/bin.js CHANGED
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  startHttpServer,
4
4
  startServer
5
- } from "./chunk-2YCZSMDD.js";
5
+ } from "./chunk-QPQOD3S6.js";
6
6
  import {
7
7
  setOutputFormat
8
- } from "./chunk-M3QHVBQV.js";
8
+ } from "./chunk-VQTI7YUU.js";
9
9
 
10
10
  // src/bin.ts
11
11
  import { config } from "dotenv";
@@ -13,7 +13,7 @@ import { resolve } from "path";
13
13
  import yargs from "yargs";
14
14
  import { hideBin } from "yargs/helpers";
15
15
  config({ path: resolve(process.cwd(), ".env") });
16
- var CURRENT_VERSION = "0.2.7";
16
+ var CURRENT_VERSION = "0.2.8";
17
17
  process.on("uncaughtException", (error) => {
18
18
  console.error("Uncaught exception:", error);
19
19
  process.exit(1);
@@ -25,7 +25,7 @@ import {
25
25
  validateNumber,
26
26
  validateQuery,
27
27
  vectorStore
28
- } from "./chunk-M3QHVBQV.js";
28
+ } from "./chunk-VQTI7YUU.js";
29
29
 
30
30
  // src/tools/search/schemas.ts
31
31
  import { z } from "zod";
@@ -794,8 +794,18 @@ async function explainCircuit(input) {
794
794
  const circuit = parsed.codeUnits.find((u) => u.type === "circuit");
795
795
  if (!circuit) {
796
796
  return {
797
- error: "No circuit definition found in the provided code",
798
- suggestion: "Make sure to provide a complete circuit definition including 'circuit' keyword"
797
+ circuitName: "unknown",
798
+ isPublic: false,
799
+ parameters: [],
800
+ returnType: "unknown",
801
+ explanation: "No circuit definition found in the provided code. Make sure to provide a complete circuit definition including the 'circuit' keyword.",
802
+ operations: [],
803
+ zkImplications: [
804
+ "Unable to analyze - no valid circuit found in the provided code"
805
+ ],
806
+ privacyConsiderations: [
807
+ "Provide a complete circuit definition for privacy analysis"
808
+ ]
799
809
  };
800
810
  }
801
811
  const operations = [];
@@ -4536,15 +4546,22 @@ Please help me debug by:
4536
4546
 
4537
4547
  // src/services/sampling.ts
4538
4548
  var samplingCallback = null;
4549
+ var samplingFailedPermanently = false;
4539
4550
  function isSamplingAvailable() {
4551
+ if (samplingFailedPermanently) return false;
4540
4552
  return samplingCallback !== null;
4541
4553
  }
4554
+ function markSamplingFailed() {
4555
+ samplingFailedPermanently = true;
4556
+ logger.warn("Sampling marked as permanently unavailable for this session");
4557
+ }
4542
4558
  function registerSamplingCallback(callback) {
4543
4559
  samplingCallback = callback;
4560
+ samplingFailedPermanently = false;
4544
4561
  logger.info("Sampling capability registered");
4545
4562
  }
4546
4563
  async function requestCompletion(messages, options = {}) {
4547
- if (!samplingCallback) {
4564
+ if (!samplingCallback || samplingFailedPermanently) {
4548
4565
  throw new Error(
4549
4566
  "Sampling not available - client does not support this capability"
4550
4567
  );
@@ -4567,11 +4584,25 @@ async function requestCompletion(messages, options = {}) {
4567
4584
  messageCount: messages.length,
4568
4585
  maxTokens: request.maxTokens
4569
4586
  });
4570
- const response = await samplingCallback(request);
4571
- if (response.content.type !== "text") {
4572
- throw new Error("Unexpected response content type");
4587
+ try {
4588
+ const response = await samplingCallback(request);
4589
+ if (response.content.type !== "text") {
4590
+ throw new Error("Unexpected response content type");
4591
+ }
4592
+ return response.content.text;
4593
+ } catch (error) {
4594
+ const errorStr = String(error);
4595
+ if (errorStr.includes("-32601") || errorStr.includes("Method not found") || errorStr.includes("not supported")) {
4596
+ logger.warn(
4597
+ "Client does not support sampling/createMessage, disabling sampling for this session"
4598
+ );
4599
+ markSamplingFailed();
4600
+ throw new Error(
4601
+ "Sampling not supported by this client - use Claude Desktop for this feature"
4602
+ );
4603
+ }
4604
+ throw error;
4573
4605
  }
4574
- return response.content.text;
4575
4606
  }
4576
4607
  async function generateContract(requirements, options = {}) {
4577
4608
  if (!isSamplingAvailable()) {
@@ -5170,6 +5201,17 @@ function registerResourceHandlers(server) {
5170
5201
  "midnight://schema/"
5171
5202
  ];
5172
5203
  const validPrefix = resourceTypes.find((p) => uri.startsWith(p));
5204
+ let suggestion = validPrefix ? `Check the resource path after '${validPrefix}'` : `Valid resource prefixes: ${resourceTypes.join(", ")}`;
5205
+ if (uri.includes("://resources/")) {
5206
+ const resourceName = uri.split("://resources/").pop() || "";
5207
+ if (resourceName.includes("template") || resourceName.includes("pattern") || resourceName.includes("example")) {
5208
+ suggestion = `Try: midnight://code/templates/${resourceName} or midnight://code/examples/${resourceName} or midnight://code/patterns/${resourceName}`;
5209
+ } else if (resourceName.includes("doc") || resourceName.includes("reference") || resourceName.includes("guide")) {
5210
+ suggestion = `Try: midnight://docs/${resourceName}`;
5211
+ } else {
5212
+ suggestion = `'midnight://resources/' is not valid. Use: midnight://docs/, midnight://code/, or midnight://schema/`;
5213
+ }
5214
+ }
5173
5215
  return {
5174
5216
  contents: [
5175
5217
  {
@@ -5177,8 +5219,9 @@ function registerResourceHandlers(server) {
5177
5219
  mimeType: "application/json",
5178
5220
  text: serialize({
5179
5221
  error: `Resource not found: ${uri}`,
5180
- suggestion: validPrefix ? `Check the resource path after '${validPrefix}'` : `Valid resource prefixes: ${resourceTypes.join(", ")}`,
5181
- hint: "Use ListResources to see all available resources"
5222
+ suggestion,
5223
+ hint: "Use ListResources to see all available resources",
5224
+ validPrefixes: resourceTypes
5182
5225
  })
5183
5226
  }
5184
5227
  ]
@@ -9533,4 +9576,4 @@ export {
9533
9576
  startServer,
9534
9577
  startHttpServer
9535
9578
  };
9536
- //# sourceMappingURL=chunk-2YCZSMDD.js.map
9579
+ //# sourceMappingURL=chunk-QPQOD3S6.js.map
@@ -1594,7 +1594,7 @@ async function checkGitHubAPI() {
1594
1594
  }
1595
1595
  async function checkVectorStore() {
1596
1596
  try {
1597
- const { vectorStore: vectorStore2 } = await import("./db-OENJQB5W.js");
1597
+ const { vectorStore: vectorStore2 } = await import("./db-7F5YOZB7.js");
1598
1598
  if (vectorStore2) {
1599
1599
  return {
1600
1600
  status: "pass",
@@ -2069,7 +2069,7 @@ function serialize(data) {
2069
2069
  }
2070
2070
 
2071
2071
  // src/utils/version.ts
2072
- var CURRENT_VERSION = "0.2.7";
2072
+ var CURRENT_VERSION = "0.2.8";
2073
2073
 
2074
2074
  // src/db/vectorStore.ts
2075
2075
  var VectorStore = class {
@@ -2278,4 +2278,4 @@ export {
2278
2278
  serialize,
2279
2279
  CURRENT_VERSION
2280
2280
  };
2281
- //# sourceMappingURL=chunk-M3QHVBQV.js.map
2281
+ //# sourceMappingURL=chunk-VQTI7YUU.js.map
@@ -0,0 +1,7 @@
1
+ import {
2
+ vectorStore
3
+ } from "./chunk-VQTI7YUU.js";
4
+ export {
5
+ vectorStore
6
+ };
7
+ //# sourceMappingURL=db-7F5YOZB7.js.map
package/dist/index.js CHANGED
@@ -9,10 +9,10 @@ import {
9
9
  promptDefinitions,
10
10
  startHttpServer,
11
11
  startServer
12
- } from "./chunk-2YCZSMDD.js";
12
+ } from "./chunk-QPQOD3S6.js";
13
13
  import {
14
14
  logger
15
- } from "./chunk-M3QHVBQV.js";
15
+ } from "./chunk-VQTI7YUU.js";
16
16
  export {
17
17
  allResources,
18
18
  allTools,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "midnight-mcp",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "Model Context Protocol Server for Midnight Blockchain Development",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,7 +0,0 @@
1
- import {
2
- vectorStore
3
- } from "./chunk-M3QHVBQV.js";
4
- export {
5
- vectorStore
6
- };
7
- //# sourceMappingURL=db-OENJQB5W.js.map