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.
- package/README.md +109 -84
- package/dist/server.d.ts +9 -1
- package/dist/server.js +183 -7
- package/dist/tools/meta.js +1 -10
- package/dist/tools/repository/handlers.d.ts +11 -3
- package/dist/tools/repository/handlers.js +36 -1
- package/dist/tools/repository/index.d.ts +2 -2
- package/dist/tools/repository/index.js +2 -2
- package/dist/tools/repository/schemas.d.ts +0 -22
- package/dist/tools/repository/schemas.js +0 -20
- package/dist/tools/repository/tools.js +9 -112
- package/dist/tools/repository/validation.d.ts +2 -533
- package/dist/tools/repository/validation.js +3 -741
- package/dist/types/mcp.d.ts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/logger.d.ts +5 -0
- package/dist/utils/logger.js +16 -0
- package/package.json +1 -1
package/dist/types/mcp.d.ts
CHANGED
|
@@ -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"
|
|
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
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -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";
|
package/dist/utils/index.js
CHANGED
|
@@ -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";
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -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;
|
package/dist/utils/logger.js
CHANGED
|
@@ -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
|