midnight-mcp 0.2.20 → 0.3.0

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,5 +1,14 @@
1
1
  # Midnight MCP Server
2
2
 
3
+ > ## ⚠️ Deprecated — use Kapa + Midnight Expert
4
+ >
5
+ > **midnight-mcp is being wound down.** Midnight has standardised on two official tools:
6
+ >
7
+ > - **Kapa MCP** (docs Q&A / search): `claude mcp add --transport http midnight https://midnight.mcp.kapa.ai`
8
+ > - **Midnight Expert** (hands-on dev, Claude Code plugins): `curl -fsSL https://midnightntwrk.expert/install.sh | bash`
9
+ >
10
+ > **Migration guide → https://docs.midnight.network/blog/migrating-to-kapa-and-midnight-expert**
11
+
3
12
  [![npm version](https://badge.fury.io/js/midnight-mcp.svg)](https://www.npmjs.com/package/midnight-mcp)
4
13
  [![npm downloads](https://img.shields.io/npm/dm/midnight-mcp)](https://npm-stat.com/charts.html?package=midnight-mcp)
5
14
  [![License](https://img.shields.io/npm/l/midnight-mcp)](./LICENSE)
@@ -183,7 +192,7 @@ Quick references available offline:
183
192
 
184
193
  ## Indexed Repositories
185
194
 
186
- The API indexes **102+ Midnight repositories** from the entire Midnight ecosystem:
195
+ The API indexes **115+ Midnight repositories** from the entire Midnight ecosystem:
187
196
 
188
197
  | Category | Count | Key Repositories |
189
198
  | ------------------------ | ----- | -------------------------------------------------------------------------------- |
@@ -192,15 +201,15 @@ The API indexes **102+ Midnight repositories** from the entire Midnight ecosyste
192
201
  | **Core Infrastructure** | 9 | `midnight-node`, `midnight-indexer`, `midnight-ledger`, `midnight-zk` |
193
202
  | **ZK & Cryptography** | 6 | `midnight-trusted-setup`, `fri`, `galois_recursion`, `pluto_eris` |
194
203
  | **Documentation** | 5 | `midnight-docs`, `midnight-improvement-proposals`, `midnight-architecture` |
195
- | **Examples & Templates** | 8 | `example-counter`, `example-bboard`, `example-dex`, `example-DAO` |
204
+ | **Examples & Templates** | 18 | `example-counter`, `example-bboard`, `example-kitties`, `example-zkloan` |
196
205
  | **Identity** | 5 | `midnight-did`, `midnight-did-resolver`, `midnight-verifiable-credentials` |
197
- | **Developer Tools** | 4 | `setup-compact-action`, `upload-sarif-github-action`, `midnight-dev-utils` |
206
+ | **Developer Tools** | 5 | `setup-compact-action`, `midnight-dev-utils`, `midnight-local-dev` |
198
207
  | **Solutions & Apps** | 7 | `midnight-solutions`, `midnight-website-next`, `nightcap`, `ocp` |
199
208
  | **Glacier Drop** | 15 | `midnight-glacier-drop-tools`, `gd-claim-api`, `gd-claim-portal` |
200
- | **Partners** | 14 | OpenZeppelin, BrickTowers, MeshJS, PaimaStudios, hackathon winners |
209
+ | **Partners & Community** | 20 | OpenZeppelin, BrickTowers, MeshJS, PaimaStudios, hackathon winners, Olanetsoft |
201
210
  | **Other** | 18+ | Contracts, bridges, token distribution, monitoring, QA tools, community projects |
202
211
 
203
- All **non-archived** repositories from the `midnightntwrk` organization plus community partners. See [api/README.md](api/README.md#indexed-repositories-102) for the complete list.
212
+ All **non-archived** repositories from the `midnightntwrk` organization plus community partners. See [api/README.md](api/README.md#indexed-repositories-115) for the complete list.
204
213
 
205
214
  ---
206
215
 
package/dist/bin.js CHANGED
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  startHttpServer,
4
4
  startServer
5
- } from "./chunk-F4KM42XU.js";
5
+ } from "./chunk-VBZPDFKP.js";
6
6
  import {
7
7
  setOutputFormat
8
- } from "./chunk-RCQYFKD3.js";
8
+ } from "./chunk-KRDOSQPS.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.20";
16
+ var CURRENT_VERSION = "0.3.0";
17
17
  process.on("uncaughtException", (error) => {
18
18
  console.error("Uncaught exception:", error);
19
19
  process.exit(1);
@@ -10,8 +10,16 @@ var ConfigSchema = z.object({
10
10
  mode: z.enum(["hosted", "local"]).default("hosted"),
11
11
  // Hosted API URL (used when mode is 'hosted')
12
12
  hostedApiUrl: z.string().default("https://midnight-mcp-api.midnightmcp.workers.dev"),
13
+ // Optional bearer token sent to the hosted API. Needed when pointing
14
+ // MIDNIGHT_API_URL at a private/self-hosted backend that requires auth.
15
+ hostedApiToken: z.string().optional(),
13
16
  // GitHub
14
17
  githubToken: z.string().optional(),
18
+ // Extra GitHub repo owners allowed for the resolveRepo() org/repo
19
+ // fall-through, on top of the built-in vetted list. Comma-separated via
20
+ // MIDNIGHT_MCP_ALLOWED_REPO_OWNERS. Lets local users add their own repos
21
+ // without reopening arbitrary-repo access.
22
+ allowedRepoOwners: z.array(z.string()).default([]),
15
23
  // Vector Database (only needed for local mode)
16
24
  chromaUrl: z.string().default("http://localhost:8000"),
17
25
  // Embeddings (only needed for local mode)
@@ -31,7 +39,9 @@ function loadConfig() {
31
39
  const rawConfig = {
32
40
  mode: isLocalMode2 ? "local" : "hosted",
33
41
  hostedApiUrl: process.env.MIDNIGHT_API_URL,
42
+ hostedApiToken: process.env.MIDNIGHT_API_TOKEN,
34
43
  githubToken: process.env.GITHUB_TOKEN,
44
+ allowedRepoOwners: process.env.MIDNIGHT_MCP_ALLOWED_REPO_OWNERS ? process.env.MIDNIGHT_MCP_ALLOWED_REPO_OWNERS.split(",").map((s) => s.trim()).filter(Boolean) : void 0,
35
45
  chromaUrl: process.env.CHROMA_URL,
36
46
  openaiApiKey: process.env.OPENAI_API_KEY,
37
47
  embeddingModel: process.env.EMBEDDING_MODEL,
@@ -1624,7 +1634,7 @@ var releaseTracker = new ReleaseTracker();
1624
1634
 
1625
1635
  // src/utils/health.ts
1626
1636
  var startTime = Date.now();
1627
- var VERSION = "0.2.20";
1637
+ var VERSION = "0.3.0";
1628
1638
  async function checkGitHubAPI() {
1629
1639
  const start = Date.now();
1630
1640
  try {
@@ -1652,7 +1662,7 @@ async function checkGitHubAPI() {
1652
1662
  }
1653
1663
  async function checkVectorStore() {
1654
1664
  try {
1655
- const { vectorStore: vectorStore2 } = await import("./db-VCUUBGDV.js");
1665
+ const { vectorStore: vectorStore2 } = await import("./db-3WSIJCLE.js");
1656
1666
  if (vectorStore2) {
1657
1667
  return {
1658
1668
  status: "pass",
@@ -1790,16 +1800,6 @@ function shouldProceedWithRequest() {
1790
1800
  }
1791
1801
  return { proceed: true };
1792
1802
  }
1793
- function formatRateLimitStatus() {
1794
- const status = getRateLimitStatus();
1795
- if (status.isLimited) {
1796
- return `\u26D4 ${status.message}`;
1797
- } else if (status.isWarning) {
1798
- return `\u26A0\uFE0F ${status.message}`;
1799
- } else {
1800
- return `\u2705 ${status.message}`;
1801
- }
1802
- }
1803
1803
 
1804
1804
  // src/utils/cache.ts
1805
1805
  var Cache = class {
@@ -2009,6 +2009,9 @@ async function makeRequest(url, endpoint, options) {
2009
2009
  headers: {
2010
2010
  "Content-Type": "application/json",
2011
2011
  "User-Agent": "midnight-mcp",
2012
+ // Send bearer auth when the backend requires it (private/self-hosted
2013
+ // deployments that set MIDNIGHT_API_TOKEN).
2014
+ ...config.hostedApiToken ? { Authorization: `Bearer ${config.hostedApiToken}` } : {},
2012
2015
  ...options.headers
2013
2016
  }
2014
2017
  });
@@ -2128,7 +2131,7 @@ function serialize(data) {
2128
2131
  }
2129
2132
 
2130
2133
  // src/utils/version.ts
2131
- var CURRENT_VERSION = "0.2.20";
2134
+ var CURRENT_VERSION = "0.3.0";
2132
2135
 
2133
2136
  // src/db/vectorStore.ts
2134
2137
  var VectorStore = class {
@@ -2323,6 +2326,7 @@ var VectorStore = class {
2323
2326
  var vectorStore = new VectorStore();
2324
2327
 
2325
2328
  export {
2329
+ config,
2326
2330
  isHostedMode,
2327
2331
  DEFAULT_REPOSITORIES,
2328
2332
  setMCPLogCallback,
@@ -2338,7 +2342,6 @@ export {
2338
2342
  getHealthStatus,
2339
2343
  getQuickHealthStatus,
2340
2344
  getRateLimitStatus,
2341
- formatRateLimitStatus,
2342
2345
  createCacheKey,
2343
2346
  searchCache,
2344
2347
  fileCache,
@@ -2351,4 +2354,4 @@ export {
2351
2354
  serialize,
2352
2355
  CURRENT_VERSION
2353
2356
  };
2354
- //# sourceMappingURL=chunk-RCQYFKD3.js.map
2357
+ //# sourceMappingURL=chunk-KRDOSQPS.js.map
@@ -2,10 +2,10 @@ import {
2
2
  CURRENT_VERSION,
3
3
  DEFAULT_REPOSITORIES,
4
4
  SelfCorrectionHints,
5
+ config,
5
6
  createCacheKey,
6
7
  fileCache,
7
8
  formatErrorResponse,
8
- formatRateLimitStatus,
9
9
  getHealthStatus,
10
10
  getQuickHealthStatus,
11
11
  getRateLimitStatus,
@@ -25,7 +25,7 @@ import {
25
25
  validateNumber,
26
26
  validateQuery,
27
27
  vectorStore
28
- } from "./chunk-RCQYFKD3.js";
28
+ } from "./chunk-KRDOSQPS.js";
29
29
 
30
30
  // src/tools/search/schemas.ts
31
31
  import { z } from "zod";
@@ -171,43 +171,43 @@ function finalizeResponse(response, cacheKey, warnings) {
171
171
  });
172
172
  return finalResponse;
173
173
  }
174
- async function performSearch(query, limit, config) {
174
+ async function performSearch(query, limit, config2) {
175
175
  const validation = validateSearchInput(query, limit);
176
176
  if (!validation.success) {
177
177
  return validation.error;
178
178
  }
179
179
  const { sanitizedQuery, limit: validatedLimit, warnings } = validation.context;
180
- logger.debug(`Searching ${config.searchType}`, {
180
+ logger.debug(`Searching ${config2.searchType}`, {
181
181
  query: sanitizedQuery,
182
182
  mode: isHostedMode() ? "hosted" : "local"
183
183
  });
184
184
  const cacheKey = createCacheKey(
185
- config.searchType,
185
+ config2.searchType,
186
186
  sanitizedQuery,
187
187
  validatedLimit,
188
- ...config.cacheKeyExtra
188
+ ...config2.cacheKeyExtra
189
189
  );
190
190
  const cached = checkSearchCache(cacheKey);
191
191
  if (cached) return cached;
192
192
  const hostedResult = await tryHostedSearch(
193
- config.searchType,
194
- () => config.hostedSearchFn(sanitizedQuery, validatedLimit),
193
+ config2.searchType,
194
+ () => config2.hostedSearchFn(sanitizedQuery, validatedLimit),
195
195
  cacheKey,
196
196
  warnings
197
197
  );
198
198
  if (hostedResult) {
199
- return { ...hostedResult.result, ...config.hostedResultExtra };
199
+ return { ...hostedResult.result, ...config2.hostedResultExtra };
200
200
  }
201
- const filter = config.buildFilter();
201
+ const filter = config2.buildFilter();
202
202
  let results = await vectorStore.search(sanitizedQuery, validatedLimit, filter);
203
- if (config.postFilter) {
204
- results = config.postFilter(results);
203
+ if (config2.postFilter) {
204
+ results = config2.postFilter(results);
205
205
  }
206
206
  const response = {
207
- results: results.map(config.transformResult),
207
+ results: results.map(config2.transformResult),
208
208
  totalResults: results.length,
209
209
  query: sanitizedQuery,
210
- ...config.extraFields
210
+ ...config2.extraFields
211
211
  };
212
212
  return finalizeResponse(response, cacheKey, warnings);
213
213
  }
@@ -720,7 +720,10 @@ var CompileContractInputSchema = z2.object({
720
720
  });
721
721
 
722
722
  // src/services/compiler.ts
723
- var COMPILER_API_URL = process.env.COMPACT_COMPILER_URL || "https://compact-playground.up.railway.app";
723
+ function getConfiguredCompilerUrl() {
724
+ const url = process.env.COMPACT_COMPILER_URL?.trim();
725
+ return url ? url : void 0;
726
+ }
724
727
  var COMPILER_TIMEOUT = 3e4;
725
728
  var MAX_CODE_SIZE = 100 * 1024;
726
729
  async function compileContract(code, options = {}) {
@@ -740,6 +743,15 @@ async function compileContract(code, options = {}) {
740
743
  serviceAvailable: true
741
744
  };
742
745
  }
746
+ const url = getConfiguredCompilerUrl();
747
+ if (!url) {
748
+ return {
749
+ success: false,
750
+ message: "No compiler service configured. Set COMPACT_COMPILER_URL to a compiler you run yourself to enable compilation; contract source is not sent to any third-party by default.",
751
+ error: "COMPILER_NOT_CONFIGURED",
752
+ serviceAvailable: false
753
+ };
754
+ }
743
755
  const controller = new AbortController();
744
756
  const timeoutId = setTimeout(() => controller.abort(), COMPILER_TIMEOUT);
745
757
  try {
@@ -755,7 +767,7 @@ async function compileContract(code, options = {}) {
755
767
  codeLength: code.length,
756
768
  options: requestBody.options
757
769
  });
758
- const response = await fetch(`${COMPILER_API_URL}/compile`, {
770
+ const response = await fetch(`${url}/compile`, {
759
771
  method: "POST",
760
772
  headers: {
761
773
  "Content-Type": "application/json"
@@ -858,7 +870,7 @@ async function compileContract(code, options = {}) {
858
870
  }
859
871
  }
860
872
  function getCompilerUrl() {
861
- return COMPILER_API_URL;
873
+ return getConfiguredCompilerUrl();
862
874
  }
863
875
 
864
876
  // src/tools/analyze/handlers.ts
@@ -1605,8 +1617,55 @@ var REPO_ALIASES = {
1605
1617
  bboard: { owner: "midnightntwrk", repo: "example-bboard" },
1606
1618
  "example-dex": { owner: "midnightntwrk", repo: "example-dex" },
1607
1619
  dex: { owner: "midnightntwrk", repo: "example-dex" },
1620
+ "example-hello-world": {
1621
+ owner: "midnightntwrk",
1622
+ repo: "example-hello-world"
1623
+ },
1624
+ "hello-world": { owner: "midnightntwrk", repo: "example-hello-world" },
1625
+ "example-kitties": { owner: "midnightntwrk", repo: "example-kitties" },
1626
+ kitties: { owner: "midnightntwrk", repo: "example-kitties" },
1627
+ cryptokitties: { owner: "midnightntwrk", repo: "example-kitties" },
1628
+ "example-nft-contracts": {
1629
+ owner: "midnightntwrk",
1630
+ repo: "example-nft-contracts"
1631
+ },
1632
+ "nft-contracts": { owner: "midnightntwrk", repo: "example-nft-contracts" },
1633
+ nft: { owner: "midnightntwrk", repo: "example-nft-contracts" },
1634
+ "example-locker": { owner: "midnightntwrk", repo: "example-locker" },
1635
+ locker: { owner: "midnightntwrk", repo: "example-locker" },
1636
+ "example-zkloan": { owner: "midnightntwrk", repo: "example-zkloan" },
1637
+ zkloan: { owner: "midnightntwrk", repo: "example-zkloan" },
1638
+ "example-battleship": {
1639
+ owner: "midnightntwrk",
1640
+ repo: "example-battleship"
1641
+ },
1642
+ "example-private-party": {
1643
+ owner: "midnightntwrk",
1644
+ repo: "example-private-party"
1645
+ },
1646
+ "private-party": { owner: "midnightntwrk", repo: "example-private-party" },
1647
+ "midnight-dust-generator": {
1648
+ owner: "midnightntwrk",
1649
+ repo: "midnight-dust-generator"
1650
+ },
1651
+ "dust-generator": {
1652
+ owner: "midnightntwrk",
1653
+ repo: "midnight-dust-generator"
1654
+ },
1655
+ "midnight-tip-jar": { owner: "midnightntwrk", repo: "midnight-tip-jar" },
1656
+ "tip-jar": { owner: "midnightntwrk", repo: "midnight-tip-jar" },
1657
+ "midnight-leaderboard": {
1658
+ owner: "midnightntwrk",
1659
+ repo: "midnight-leaderboard"
1660
+ },
1661
+ leaderboard: { owner: "midnightntwrk", repo: "midnight-leaderboard" },
1608
1662
  // Developer Tools
1609
1663
  "create-mn-app": { owner: "midnightntwrk", repo: "create-mn-app" },
1664
+ "midnight-local-dev": {
1665
+ owner: "midnightntwrk",
1666
+ repo: "midnight-local-dev"
1667
+ },
1668
+ "local-dev": { owner: "midnightntwrk", repo: "midnight-local-dev" },
1610
1669
  "midnight-wallet": { owner: "midnightntwrk", repo: "midnight-wallet" },
1611
1670
  wallet: { owner: "midnightntwrk", repo: "midnight-wallet" },
1612
1671
  // Infrastructure
@@ -1705,7 +1764,22 @@ var REPO_ALIASES = {
1705
1764
  // @effectstream/midnight-contracts and the evm-midnight-v2 / zswap-da templates.
1706
1765
  // NOTE: repo currently has NO LICENSE — treat indexed content as reference only.
1707
1766
  effectstream: { owner: "effectstream", repo: "effectstream" },
1708
- "effect-stream": { owner: "effectstream", repo: "effectstream" }
1767
+ "effect-stream": { owner: "effectstream", repo: "effectstream" },
1768
+ // Community Examples & Learning Resources (Olanetsoft)
1769
+ "midnight-mcp": { owner: "Olanetsoft", repo: "midnight-mcp" },
1770
+ mcp: { owner: "Olanetsoft", repo: "midnight-mcp" },
1771
+ "compact-playground": { owner: "Olanetsoft", repo: "compact-playground" },
1772
+ playground: { owner: "Olanetsoft", repo: "compact-playground" },
1773
+ "compact-by-example": { owner: "Olanetsoft", repo: "compact-by-example" },
1774
+ "learn-compact": { owner: "Olanetsoft", repo: "learn-compact" },
1775
+ "example-dust-sponsorship": {
1776
+ owner: "Olanetsoft",
1777
+ repo: "example-dust-sponsorship"
1778
+ },
1779
+ "dust-sponsorship": {
1780
+ owner: "Olanetsoft",
1781
+ repo: "example-dust-sponsorship"
1782
+ }
1709
1783
  };
1710
1784
  var EXAMPLES = [
1711
1785
  {
@@ -6346,38 +6420,7 @@ var versionCheckResult = {
6346
6420
  var toolCallCount = 0;
6347
6421
  var VERSION_CHECK_INTERVAL = 10;
6348
6422
  async function checkForUpdates() {
6349
- try {
6350
- const controller = new AbortController();
6351
- const timeoutId = setTimeout(() => controller.abort(), 5e3);
6352
- const response = await fetch(
6353
- "https://registry.npmjs.org/midnight-mcp/latest",
6354
- { signal: controller.signal }
6355
- );
6356
- clearTimeout(timeoutId);
6357
- if (!response.ok) return;
6358
- const data = await response.json();
6359
- const latestVersion = data.version;
6360
- if (latestVersion !== CURRENT_VERSION) {
6361
- versionCheckResult = {
6362
- isOutdated: true,
6363
- latestVersion,
6364
- lastChecked: Date.now(),
6365
- updateMessage: `\u{1F6A8} UPDATE AVAILABLE: v${latestVersion} (you have v${CURRENT_VERSION})`
6366
- };
6367
- logger.warn(
6368
- `Outdated version detected: v${CURRENT_VERSION} -> v${latestVersion}`
6369
- );
6370
- } else {
6371
- versionCheckResult = {
6372
- ...versionCheckResult,
6373
- lastChecked: Date.now()
6374
- };
6375
- }
6376
- } catch (error) {
6377
- logger.debug("Version check failed (non-blocking)", {
6378
- error: error instanceof Error ? error.message : String(error)
6379
- });
6380
- }
6423
+ return;
6381
6424
  }
6382
6425
  function maybeCheckForUpdates() {
6383
6426
  toolCallCount++;
@@ -6602,13 +6645,14 @@ function registerCompletionsHandler(server) {
6602
6645
  };
6603
6646
  });
6604
6647
  }
6648
+ var DEPRECATION_PREFIX = "[DEPRECATED] midnight-mcp is being retired \u2014 use Kapa (docs Q&A) + Midnight Expert (dev): https://docs.midnight.network/blog/migrating-to-kapa-and-midnight-expert \u2014 ";
6605
6649
  function registerToolHandlers(server) {
6606
6650
  server.setRequestHandler(ListToolsRequestSchema, async () => {
6607
6651
  logger.debug("Listing tools");
6608
6652
  return {
6609
6653
  tools: allTools.map((tool) => ({
6610
6654
  name: tool.name,
6611
- description: tool.description,
6655
+ description: DEPRECATION_PREFIX + tool.description,
6612
6656
  inputSchema: tool.inputSchema,
6613
6657
  // Include output schema if defined
6614
6658
  ...tool.outputSchema && { outputSchema: tool.outputSchema },
@@ -7805,19 +7849,29 @@ async function extractContractStructure(input) {
7805
7849
  }
7806
7850
 
7807
7851
  // src/tools/repository/handlers.ts
7852
+ var ALLOWED_REPO_OWNERS = new Set(
7853
+ [
7854
+ ...Object.values(REPO_ALIASES).map((a) => a.owner),
7855
+ ...DEFAULT_REPOSITORIES.map((r) => r.owner),
7856
+ ...config.allowedRepoOwners
7857
+ ].map((owner) => owner.toLowerCase())
7858
+ );
7808
7859
  function resolveRepo(repoName) {
7809
7860
  const name = repoName || "compact";
7810
7861
  const normalized = name.toLowerCase().replace(/^midnightntwrk\//, "");
7811
7862
  const alias = REPO_ALIASES[normalized];
7812
7863
  if (alias) return alias;
7813
- for (const config of DEFAULT_REPOSITORIES) {
7814
- if (config.repo.toLowerCase() === normalized) {
7815
- return { owner: config.owner, repo: config.repo };
7864
+ for (const config2 of DEFAULT_REPOSITORIES) {
7865
+ if (config2.repo.toLowerCase() === normalized) {
7866
+ return { owner: config2.owner, repo: config2.repo };
7816
7867
  }
7817
7868
  }
7818
7869
  if (name.includes("/")) {
7819
7870
  const [owner, repo] = name.split("/");
7820
- return { owner, repo };
7871
+ if (owner && repo && ALLOWED_REPO_OWNERS.has(owner.toLowerCase())) {
7872
+ return { owner, repo };
7873
+ }
7874
+ return null;
7821
7875
  }
7822
7876
  return null;
7823
7877
  }
@@ -9357,7 +9411,9 @@ async function healthCheck(input) {
9357
9411
  const status = await getHealthStatus();
9358
9412
  return {
9359
9413
  ...status,
9360
- rateLimit: formatRateLimitStatus(),
9414
+ // Return the structured object (not a formatted string) so the value
9415
+ // conforms to the tool's outputSchema, which declares rateLimit as an object.
9416
+ rateLimit: getRateLimitStatus(),
9361
9417
  cacheStats: {
9362
9418
  search: searchCache.getStats(),
9363
9419
  file: fileCache.getStats(),
@@ -9367,7 +9423,7 @@ async function healthCheck(input) {
9367
9423
  }
9368
9424
  return {
9369
9425
  ...getQuickHealthStatus(),
9370
- rateLimit: formatRateLimitStatus()
9426
+ rateLimit: getRateLimitStatus()
9371
9427
  };
9372
9428
  }
9373
9429
  async function getStatus(_input) {
@@ -9390,6 +9446,17 @@ async function getStatus(_input) {
9390
9446
  }
9391
9447
  };
9392
9448
  }
9449
+ function isNewerVersion(candidate, base) {
9450
+ const a = candidate.split(".").map((n) => parseInt(n, 10) || 0);
9451
+ const b = base.split(".").map((n) => parseInt(n, 10) || 0);
9452
+ for (let i = 0; i < 3; i++) {
9453
+ const x = a[i] ?? 0;
9454
+ const y = b[i] ?? 0;
9455
+ if (x > y) return true;
9456
+ if (x < y) return false;
9457
+ }
9458
+ return false;
9459
+ }
9393
9460
  async function checkVersion(_input) {
9394
9461
  try {
9395
9462
  const response = await fetch(
@@ -9406,24 +9473,25 @@ async function checkVersion(_input) {
9406
9473
  }
9407
9474
  const data = await response.json();
9408
9475
  const latestVersion = data.version;
9409
- const isUpToDate = CURRENT_VERSION === latestVersion;
9410
- return {
9476
+ const isUpToDate = !isNewerVersion(latestVersion, CURRENT_VERSION);
9477
+ const result = {
9411
9478
  currentVersion: CURRENT_VERSION,
9412
9479
  latestVersion,
9413
9480
  isUpToDate,
9414
- message: isUpToDate ? "\u2705 You are running the latest version!" : `\u26A0\uFE0F UPDATE AVAILABLE: v${latestVersion} (you have v${CURRENT_VERSION})`,
9415
- updateInstructions: isUpToDate ? null : {
9416
- step1: "Clear npx cache: rm -rf ~/.npm/_npx (macOS/Linux) or del /s /q %LocalAppData%\\npm-cache\\_npx (Windows)",
9417
- step2: "Restart Claude Desktop completely (Cmd+Q / Alt+F4, then reopen)",
9418
- step3: "Or update config to use: npx -y midnight-mcp@latest (forces latest)",
9419
- alternative: "You can also install globally: npm install -g midnight-mcp@latest"
9420
- },
9421
- newFeatures: isUpToDate ? null : [
9422
- "Auto-update config tool - AI agents update your config automatically",
9423
- "midnight-extract-contract-structure - Static analysis with 10 pre-compilation checks",
9424
- "MCP Logging, Progress, Completions capabilities"
9425
- ]
9481
+ message: isUpToDate ? "\u2705 You are running the latest published version. Note: midnight-mcp is deprecated \u2014 migrate to Kapa (docs Q&A) + Midnight Expert (dev): https://docs.midnight.network/blog/migrating-to-kapa-and-midnight-expert" : `\u26A0\uFE0F A newer version (v${latestVersion}) exists, but midnight-mcp is deprecated \u2014 migrate to Kapa (docs Q&A) + Midnight Expert (dev): https://docs.midnight.network/blog/migrating-to-kapa-and-midnight-expert`
9426
9482
  };
9483
+ if (!isUpToDate) {
9484
+ result.updateInstructions = {
9485
+ note: "midnight-mcp is deprecated; updating is not recommended.",
9486
+ kapa: "claude mcp add --transport http midnight https://midnight.mcp.kapa.ai",
9487
+ midnightExpert: "curl -fsSL https://midnightntwrk.expert/install.sh | bash",
9488
+ guide: "https://docs.midnight.network/blog/migrating-to-kapa-and-midnight-expert"
9489
+ };
9490
+ result.newFeatures = [
9491
+ "midnight-mcp is deprecated \u2014 see the migration guide for the official replacements."
9492
+ ];
9493
+ }
9494
+ return result;
9427
9495
  } catch (error) {
9428
9496
  return {
9429
9497
  currentVersion: CURRENT_VERSION,
@@ -11173,7 +11241,7 @@ var suggestToolOutputSchema = {
11173
11241
  var metaTools = [
11174
11242
  {
11175
11243
  name: "midnight-list-tool-categories",
11176
- description: "\u{1F4CB} DISCOVERY TOOL: List available tool categories for progressive exploration. Use this FIRST to understand what capabilities are available, then drill into specific categories with midnight-list-category-tools. Reduces cognitive load by organizing 28 tools into 7 logical groups.",
11244
+ description: "\u{1F4CB} DISCOVERY TOOL: List available tool categories for progressive exploration. Use this FIRST to understand what capabilities are available, then drill into specific categories with midnight-list-category-tools. Reduces cognitive load by organizing the available tools into logical groups.",
11177
11245
  inputSchema: {
11178
11246
  type: "object",
11179
11247
  properties: {
@@ -11266,8 +11334,44 @@ USAGE GUIDANCE:
11266
11334
  ];
11267
11335
  setMetaTools(metaTools);
11268
11336
 
11337
+ // src/tools/deprecation/index.ts
11338
+ var BLOG_URL = "https://docs.midnight.network/blog/migrating-to-kapa-and-midnight-expert";
11339
+ var deprecationTools = [
11340
+ {
11341
+ name: "midnight-new-mcp",
11342
+ description: "Show where midnight-mcp has moved. midnight-mcp is deprecated; Midnight now uses the official Kapa MCP (docs Q&A) and Midnight Expert (hands-on dev). Call this for the install commands and the migration guide.",
11343
+ inputSchema: {
11344
+ type: "object",
11345
+ properties: {}
11346
+ },
11347
+ annotations: {
11348
+ readOnlyHint: true,
11349
+ idempotentHint: true,
11350
+ title: "\u27A1\uFE0F Migrate off midnight-mcp",
11351
+ category: "health"
11352
+ },
11353
+ handler: async () => ({
11354
+ status: "deprecated",
11355
+ message: "midnight-mcp is being retired. Midnight has two official replacements.",
11356
+ kapa: {
11357
+ purpose: "Docs Q&A / search",
11358
+ install: "claude mcp add --transport http midnight https://midnight.mcp.kapa.ai",
11359
+ url: "https://midnight.mcp.kapa.ai"
11360
+ },
11361
+ midnightExpert: {
11362
+ purpose: "Hands-on dev (Claude Code plugins)",
11363
+ install: "curl -fsSL https://midnightntwrk.expert/install.sh | bash",
11364
+ url: "https://midnightntwrk.expert"
11365
+ },
11366
+ guide: BLOG_URL
11367
+ })
11368
+ }
11369
+ ];
11370
+
11269
11371
  // src/tools/index.ts
11270
11372
  var allTools = [
11373
+ ...deprecationTools,
11374
+ // Redirect to the official replacements, surfaced first
11271
11375
  ...metaTools,
11272
11376
  // Discovery tools first for visibility
11273
11377
  ...searchTools,
@@ -11289,4 +11393,4 @@ export {
11289
11393
  startServer,
11290
11394
  startHttpServer
11291
11395
  };
11292
- //# sourceMappingURL=chunk-F4KM42XU.js.map
11396
+ //# sourceMappingURL=chunk-VBZPDFKP.js.map
@@ -0,0 +1,7 @@
1
+ import {
2
+ vectorStore
3
+ } from "./chunk-KRDOSQPS.js";
4
+ export {
5
+ vectorStore
6
+ };
7
+ //# sourceMappingURL=db-3WSIJCLE.js.map
package/dist/index.js CHANGED
@@ -9,10 +9,10 @@ import {
9
9
  promptDefinitions,
10
10
  startHttpServer,
11
11
  startServer
12
- } from "./chunk-F4KM42XU.js";
12
+ } from "./chunk-VBZPDFKP.js";
13
13
  import {
14
14
  logger
15
- } from "./chunk-RCQYFKD3.js";
15
+ } from "./chunk-KRDOSQPS.js";
16
16
  export {
17
17
  allResources,
18
18
  allTools,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "midnight-mcp",
3
- "version": "0.2.20",
4
- "description": "Model Context Protocol Server for Midnight Blockchain Development",
3
+ "version": "0.3.0",
4
+ "description": "[DEPRECATED — migrate to Kapa + Midnight Expert: https://docs.midnight.network/blog/migrating-to-kapa-and-midnight-expert] Model Context Protocol Server for Midnight Blockchain Development",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
@@ -10,7 +10,7 @@
10
10
  "scripts": {
11
11
  "build": "tsup",
12
12
  "typecheck": "tsc --noEmit",
13
- "start": "node dist/bin.js --stdio",
13
+ "start": "node dist/bin.js",
14
14
  "start:http": "node dist/bin.js --http",
15
15
  "dev": "NODE_ENV=development tsup --watch",
16
16
  "test": "vitest",
@@ -1,7 +0,0 @@
1
- import {
2
- vectorStore
3
- } from "./chunk-RCQYFKD3.js";
4
- export {
5
- vectorStore
6
- };
7
- //# sourceMappingURL=db-VCUUBGDV.js.map