midnight-mcp 0.2.5 → 0.2.6

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/dist/bin.js CHANGED
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  startHttpServer,
4
4
  startServer
5
- } from "./chunk-E5HAMXS3.js";
5
+ } from "./chunk-L5CXYFG2.js";
6
6
  import {
7
7
  setOutputFormat
8
- } from "./chunk-6BPO5SRQ.js";
8
+ } from "./chunk-WC2FPYQO.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.5";
16
+ var CURRENT_VERSION = "0.2.6";
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-6BPO5SRQ.js";
28
+ } from "./chunk-WC2FPYQO.js";
29
29
 
30
30
  // src/tools/search/schemas.ts
31
31
  import { z } from "zod";
@@ -353,10 +353,10 @@ async function fetchDocs(input) {
353
353
  const { path: path2, extractSection } = input;
354
354
  let normalizedPath = path2.startsWith("/") ? path2 : `/${path2}`;
355
355
  normalizedPath = normalizedPath.replace(/\/$/, "");
356
- if (/[<>"\s]/.test(normalizedPath)) {
356
+ if (/[<>"\s]|\.\.\/|^https?:|^\/\//.test(normalizedPath)) {
357
357
  return {
358
358
  error: "Invalid path",
359
- details: ["Path contains invalid characters"],
359
+ details: ["Path contains invalid characters or patterns"],
360
360
  suggestion: `Use a clean path like '/develop/faq' or '/getting-started/installation'`
361
361
  };
362
362
  }
@@ -667,6 +667,8 @@ USAGE GUIDANCE:
667
667
  },
668
668
  annotations: {
669
669
  readOnlyHint: true,
670
+ idempotentHint: true,
671
+ // Same path returns same content
670
672
  openWorldHint: true,
671
673
  // Fetches from external URL
672
674
  title: "\u{1F310} Fetch Live Docs",
@@ -8730,13 +8732,25 @@ var INTENT_TO_TOOL = [
8730
8732
  {
8731
8733
  patterns: [
8732
8734
  "fetch docs",
8733
- "get docs",
8734
- "latest docs",
8735
+ "fetch documentation",
8736
+ "fetch the docs",
8737
+ "fetch the latest",
8738
+ "get the docs page",
8739
+ "get latest docs",
8735
8740
  "live docs",
8736
- "docs page",
8737
- "faq",
8738
- "installation guide",
8739
- "getting started page"
8741
+ "real-time docs",
8742
+ "realtime docs",
8743
+ "current docs",
8744
+ "fresh docs",
8745
+ "updated docs",
8746
+ "faq page",
8747
+ "installation page",
8748
+ "getting started page",
8749
+ "/develop/",
8750
+ "/getting-started/",
8751
+ "/compact",
8752
+ "/blog",
8753
+ "/learn/"
8740
8754
  ],
8741
8755
  tool: "midnight-fetch-docs",
8742
8756
  reason: "Fetch live documentation directly from docs.midnight.network"
@@ -9015,14 +9029,21 @@ async function suggestTool(input) {
9015
9029
  const intentLower = input.intent.toLowerCase();
9016
9030
  const matchedTools = [];
9017
9031
  for (const mapping of INTENT_TO_TOOL) {
9018
- const matchCount = mapping.patterns.filter(
9032
+ const matchedPatterns = mapping.patterns.filter(
9019
9033
  (p) => intentLower.includes(p.toLowerCase())
9020
- ).length;
9034
+ );
9035
+ const matchCount = matchedPatterns.length;
9021
9036
  if (matchCount > 0) {
9037
+ const patternLengthScore = matchedPatterns.reduce(
9038
+ (sum, p) => sum + p.length,
9039
+ 0
9040
+ );
9041
+ const matchScore = matchCount * 10 + patternLengthScore;
9022
9042
  matchedTools.push({
9023
9043
  tool: mapping.tool,
9024
9044
  reason: mapping.reason,
9025
- confidence: matchCount >= 2 ? "high" : "medium"
9045
+ confidence: matchCount >= 2 ? "high" : "medium",
9046
+ matchScore
9026
9047
  });
9027
9048
  }
9028
9049
  }
@@ -9041,9 +9062,11 @@ async function suggestTool(input) {
9041
9062
  }
9042
9063
  }
9043
9064
  const confidenceOrder = { high: 0, medium: 1, low: 2 };
9044
- matchedTools.sort(
9045
- (a, b) => confidenceOrder[a.confidence] - confidenceOrder[b.confidence]
9046
- );
9065
+ matchedTools.sort((a, b) => {
9066
+ const confDiff = confidenceOrder[a.confidence] - confidenceOrder[b.confidence];
9067
+ if (confDiff !== 0) return confDiff;
9068
+ return b.matchScore - a.matchScore;
9069
+ });
9047
9070
  if (matchedTools.length === 0 && matchedCategories.length === 0) {
9048
9071
  return {
9049
9072
  intent: input.intent,
@@ -9292,4 +9315,4 @@ export {
9292
9315
  startServer,
9293
9316
  startHttpServer
9294
9317
  };
9295
- //# sourceMappingURL=chunk-E5HAMXS3.js.map
9318
+ //# sourceMappingURL=chunk-L5CXYFG2.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-F27LE73N.js");
1597
+ const { vectorStore: vectorStore2 } = await import("./db-2KZMPC3W.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.5";
2072
+ var CURRENT_VERSION = "0.2.6";
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-6BPO5SRQ.js.map
2281
+ //# sourceMappingURL=chunk-WC2FPYQO.js.map
@@ -0,0 +1,7 @@
1
+ import {
2
+ vectorStore
3
+ } from "./chunk-WC2FPYQO.js";
4
+ export {
5
+ vectorStore
6
+ };
7
+ //# sourceMappingURL=db-2KZMPC3W.js.map
package/dist/index.js CHANGED
@@ -9,10 +9,10 @@ import {
9
9
  promptDefinitions,
10
10
  startHttpServer,
11
11
  startServer
12
- } from "./chunk-E5HAMXS3.js";
12
+ } from "./chunk-L5CXYFG2.js";
13
13
  import {
14
14
  logger
15
- } from "./chunk-6BPO5SRQ.js";
15
+ } from "./chunk-WC2FPYQO.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.5",
3
+ "version": "0.2.6",
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-6BPO5SRQ.js";
4
- export {
5
- vectorStore
6
- };
7
- //# sourceMappingURL=db-F27LE73N.js.map