midnight-mcp 0.1.28 → 0.1.30

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.
@@ -51,7 +51,7 @@ export interface ToolAnnotations {
51
51
  * Tool categories for progressive disclosure
52
52
  * Clients can initially show categories, then expand to individual tools
53
53
  */
54
- export type ToolCategory = "search" | "analyze" | "repository" | "versioning" | "generation" | "health" | "compound" | "validation";
54
+ export type ToolCategory = "search" | "analyze" | "repository" | "versioning" | "generation" | "health" | "compound";
55
55
  /**
56
56
  * JSON Schema for structured tool outputs
57
57
  * Enables better LLM parsing and IDE integration
@@ -1,7 +1,7 @@
1
1
  export { config, isHostedMode, isLocalMode } from "./config.js";
2
2
  export type { Config, RepositoryConfig } from "./config.js";
3
3
  export { DEFAULT_REPOSITORIES } from "./config.js";
4
- export { logger } from "./logger.js";
4
+ export { logger, setMCPLogCallback } from "./logger.js";
5
5
  export { MCPError, ErrorCodes, createUserError, formatErrorResponse, withErrorHandling, SelfCorrectionHints, } from "./errors.js";
6
6
  export { validateQuery, validateRepository, validatePath, validateRef, validateNumber, validateToolArgs, sanitizeString, } from "./validation.js";
7
7
  export type { ValidationResult } from "./validation.js";
@@ -1,6 +1,6 @@
1
1
  export { config, isHostedMode, isLocalMode } from "./config.js";
2
2
  export { DEFAULT_REPOSITORIES } from "./config.js";
3
- export { logger } from "./logger.js";
3
+ export { logger, setMCPLogCallback } from "./logger.js";
4
4
  export { MCPError, ErrorCodes, createUserError, formatErrorResponse, withErrorHandling, SelfCorrectionHints, } from "./errors.js";
5
5
  // Validation utilities
6
6
  export { validateQuery, validateRepository, validatePath, validateRef, validateNumber, validateToolArgs, sanitizeString, } from "./validation.js";
@@ -1,5 +1,10 @@
1
1
  type LogLevel = "debug" | "info" | "warn" | "error";
2
2
  type LogFormat = "text" | "json";
3
+ type MCPLogCallback = (level: "debug" | "info" | "notice" | "warning" | "error", logger: string, data: unknown) => void;
4
+ /**
5
+ * Set the MCP log callback to send logs to the client
6
+ */
7
+ export declare function setMCPLogCallback(callback: MCPLogCallback | null): void;
3
8
  declare class Logger {
4
9
  private level;
5
10
  private format;
@@ -1,4 +1,12 @@
1
1
  import { config } from "./config.js";
2
+ // Global MCP log callback (set by server)
3
+ let mcpLogCallback = null;
4
+ /**
5
+ * Set the MCP log callback to send logs to the client
6
+ */
7
+ export function setMCPLogCallback(callback) {
8
+ mcpLogCallback = callback;
9
+ }
2
10
  const LOG_LEVELS = {
3
11
  debug: 0,
4
12
  info: 1,
@@ -56,21 +64,29 @@ class Logger {
56
64
  if (this.shouldLog("debug")) {
57
65
  console.error(this.formatMessage("debug", message, meta));
58
66
  }
67
+ // Also send to MCP client
68
+ mcpLogCallback?.("debug", this.service, { message, ...meta });
59
69
  }
60
70
  info(message, meta) {
61
71
  if (this.shouldLog("info")) {
62
72
  console.error(this.formatMessage("info", message, meta));
63
73
  }
74
+ // Also send to MCP client
75
+ mcpLogCallback?.("info", this.service, { message, ...meta });
64
76
  }
65
77
  warn(message, meta) {
66
78
  if (this.shouldLog("warn")) {
67
79
  console.error(this.formatMessage("warn", message, meta));
68
80
  }
81
+ // Also send to MCP client (MCP uses "warning" not "warn")
82
+ mcpLogCallback?.("warning", this.service, { message, ...meta });
69
83
  }
70
84
  error(message, meta) {
71
85
  if (this.shouldLog("error")) {
72
86
  console.error(this.formatMessage("error", message, meta));
73
87
  }
88
+ // Also send to MCP client
89
+ mcpLogCallback?.("error", this.service, { message, ...meta });
74
90
  }
75
91
  /**
76
92
  * Create a child logger with additional context
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "midnight-mcp",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "description": "Model Context Protocol Server for Midnight Blockchain Development",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",