@alcyone-labs/arg-parser 2.14.1 → 3.0.0-beta.1
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 +22 -129
- package/dist/config/plugins/index.d.ts +36 -4
- package/dist/config/plugins/index.d.ts.map +1 -1
- package/dist/core/ArgParser.d.ts +124 -464
- package/dist/core/ArgParser.d.ts.map +1 -1
- package/dist/core/FlagManager.d.ts +36 -136
- package/dist/core/FlagManager.d.ts.map +1 -1
- package/dist/core/PromptManager.d.ts +42 -91
- package/dist/core/PromptManager.d.ts.map +1 -1
- package/dist/core/log-path-utils.d.ts +29 -37
- package/dist/core/log-path-utils.d.ts.map +1 -1
- package/dist/core/types.d.ts +89 -604
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index.cjs +599 -9697
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +29 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.min.mjs +612 -8263
- package/dist/index.min.mjs.map +1 -1
- package/dist/index.mjs +581 -8920
- package/dist/index.mjs.map +1 -1
- package/dist/plugin/types.d.ts +121 -0
- package/dist/plugin/types.d.ts.map +1 -0
- package/dist/utils/debug-utils.d.ts +4 -26
- package/dist/utils/debug-utils.d.ts.map +1 -1
- package/package.json +13 -74
- package/dist/assets/.dxtignore.template +0 -37
- package/dist/assets/logo_1_small.jpg +0 -0
- package/dist/config/ConfigurationManager.d.ts +0 -82
- package/dist/config/ConfigurationManager.d.ts.map +0 -1
- package/dist/config/plugins/ConfigPlugin.d.ts +0 -60
- package/dist/config/plugins/ConfigPlugin.d.ts.map +0 -1
- package/dist/config/plugins/ConfigPluginRegistry.d.ts +0 -72
- package/dist/config/plugins/ConfigPluginRegistry.d.ts.map +0 -1
- package/dist/config/plugins/TomlConfigPlugin.d.ts +0 -30
- package/dist/config/plugins/TomlConfigPlugin.d.ts.map +0 -1
- package/dist/config/plugins/YamlConfigPlugin.d.ts +0 -29
- package/dist/config/plugins/YamlConfigPlugin.d.ts.map +0 -1
- package/dist/core/ArgParserBase.d.ts +0 -319
- package/dist/core/ArgParserBase.d.ts.map +0 -1
- package/dist/core/dxt-path-resolver.d.ts +0 -100
- package/dist/core/dxt-path-resolver.d.ts.map +0 -1
- package/dist/dxt/DxtGenerator-testUtils.d.ts +0 -22
- package/dist/dxt/DxtGenerator-testUtils.d.ts.map +0 -1
- package/dist/dxt/DxtGenerator.d.ts +0 -120
- package/dist/dxt/DxtGenerator.d.ts.map +0 -1
- package/dist/mcp/ArgParserMcp.d.ts +0 -21
- package/dist/mcp/ArgParserMcp.d.ts.map +0 -1
- package/dist/mcp/mcp-integration.d.ts +0 -86
- package/dist/mcp/mcp-integration.d.ts.map +0 -1
- package/dist/mcp/mcp-lifecycle.d.ts +0 -163
- package/dist/mcp/mcp-lifecycle.d.ts.map +0 -1
- package/dist/mcp/mcp-notifications.d.ts +0 -132
- package/dist/mcp/mcp-notifications.d.ts.map +0 -1
- package/dist/mcp/mcp-prompts.d.ts +0 -132
- package/dist/mcp/mcp-prompts.d.ts.map +0 -1
- package/dist/mcp/mcp-protocol-versions.d.ts +0 -150
- package/dist/mcp/mcp-protocol-versions.d.ts.map +0 -1
- package/dist/mcp/mcp-resources.d.ts +0 -133
- package/dist/mcp/mcp-resources.d.ts.map +0 -1
- package/dist/mcp/mcp-utils.d.ts +0 -20
- package/dist/mcp/mcp-utils.d.ts.map +0 -1
- package/dist/mcp/zod-compatibility.d.ts +0 -74
- package/dist/mcp/zod-compatibility.d.ts.map +0 -1
- package/dist/testing/fuzzy-test-cli.d.ts +0 -5
- package/dist/testing/fuzzy-test-cli.d.ts.map +0 -1
- package/dist/testing/fuzzy-tester.d.ts +0 -101
- package/dist/testing/fuzzy-tester.d.ts.map +0 -1
- package/dist/tui/index.d.ts +0 -281
- package/dist/tui/types.d.ts +0 -60
- package/dist/tui/types.d.ts.map +0 -1
- package/dist/tui.cjs +0 -1060
- package/dist/tui.cjs.map +0 -1
- package/dist/tui.mjs +0 -967
- package/dist/tui.mjs.map +0 -1
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import type { ZodTypeAny } from "zod";
|
|
2
|
-
import { ArgParserBase } from "../core/ArgParserBase";
|
|
3
|
-
import type { IFlag, ProcessedFlag, TParsedArgs } from "../core/types";
|
|
4
|
-
/**
|
|
5
|
-
* Standard MCP response format
|
|
6
|
-
*/
|
|
7
|
-
export interface McpResponse {
|
|
8
|
-
content: Array<{
|
|
9
|
-
type: "text";
|
|
10
|
-
text: string;
|
|
11
|
-
}>;
|
|
12
|
-
isError?: boolean;
|
|
13
|
-
structuredContent?: any;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Create a standardized MCP success response
|
|
17
|
-
*/
|
|
18
|
-
export declare function createMcpSuccessResponse(data: any): McpResponse;
|
|
19
|
-
/**
|
|
20
|
-
* Create a standardized MCP error response
|
|
21
|
-
*/
|
|
22
|
-
export declare function createMcpErrorResponse(error: string | Error): McpResponse;
|
|
23
|
-
/**
|
|
24
|
-
* Convert a single ArgParser flag to JSON Schema property
|
|
25
|
-
*/
|
|
26
|
-
export declare function convertFlagToJsonSchemaProperty(flag: IFlag | ProcessedFlag): {
|
|
27
|
-
property: any;
|
|
28
|
-
isRequired: boolean;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Convert ArgParser flags to MCP JSON Schema
|
|
32
|
-
*/
|
|
33
|
-
export declare function convertFlagsToJsonSchema(flags: readonly (IFlag | ProcessedFlag)[]): {
|
|
34
|
-
type: "object";
|
|
35
|
-
properties: Record<string, any>;
|
|
36
|
-
required: string[];
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Convert ArgParser flags to Zod schema for MCP tools
|
|
40
|
-
*/
|
|
41
|
-
export declare function convertFlagsToZodSchema(flags: readonly (IFlag | ProcessedFlag)[]): ZodTypeAny;
|
|
42
|
-
/**
|
|
43
|
-
* Simplified response format for testing and validation
|
|
44
|
-
*/
|
|
45
|
-
export interface SimplifiedToolResponse {
|
|
46
|
-
success: boolean;
|
|
47
|
-
data?: any;
|
|
48
|
-
error?: string;
|
|
49
|
-
message?: string;
|
|
50
|
-
exitCode?: number;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Extract simplified response from MCP protocol response
|
|
54
|
-
*/
|
|
55
|
-
export declare function extractSimplifiedResponse(mcpResponse: any): SimplifiedToolResponse;
|
|
56
|
-
export interface IMcpToolStructure {
|
|
57
|
-
name: string;
|
|
58
|
-
description?: string;
|
|
59
|
-
inputSchema: ZodTypeAny;
|
|
60
|
-
outputSchema?: ZodTypeAny;
|
|
61
|
-
execute: (args: any) => Promise<any>;
|
|
62
|
-
executeForTesting?: (args: any) => Promise<SimplifiedToolResponse>;
|
|
63
|
-
}
|
|
64
|
-
export interface GenerateMcpToolsOptions {
|
|
65
|
-
outputSchemaMap?: Record<string, ZodTypeAny>;
|
|
66
|
-
defaultOutputSchema?: ZodTypeAny;
|
|
67
|
-
/** Automatically generate output schemas for tools that don't have explicit schemas */
|
|
68
|
-
autoGenerateOutputSchema?: boolean | keyof typeof import("../core/types").OutputSchemaPatterns;
|
|
69
|
-
generateToolName?: (commandPath: string[], appName?: string) => string;
|
|
70
|
-
includeSubCommands?: boolean;
|
|
71
|
-
toolNamePrefix?: string;
|
|
72
|
-
toolNameSuffix?: string;
|
|
73
|
-
}
|
|
74
|
-
interface ISpecialParseResultProps {
|
|
75
|
-
$commandChain?: string[];
|
|
76
|
-
$error?: {
|
|
77
|
-
type: string;
|
|
78
|
-
message: string;
|
|
79
|
-
details?: any;
|
|
80
|
-
};
|
|
81
|
-
handlerResponse?: any;
|
|
82
|
-
}
|
|
83
|
-
export type IParseExecutionResult = TParsedArgs<ProcessedFlag[]> & ISpecialParseResultProps;
|
|
84
|
-
export declare function generateMcpToolsFromArgParser(rootParser: ArgParserBase, options?: GenerateMcpToolsOptions): IMcpToolStructure[];
|
|
85
|
-
export {};
|
|
86
|
-
//# sourceMappingURL=mcp-integration.d.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IAC1D,eAAe,CAAC,EAAE,GAAG,CAAC;CACvB;AACD,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC,aAAa,EAAE,CAAC,GAAG,wBAAwB,CAAC;AAE5F,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,aAAa,EACzB,OAAO,CAAC,EAAE,uBAAuB,GAChC,iBAAiB,EAAE,CA20BrB"}
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Lifecycle Events System
|
|
3
|
-
*
|
|
4
|
-
* This module provides lifecycle event hooks for MCP servers, allowing applications
|
|
5
|
-
* to perform initialization, cleanup, and other lifecycle-related operations at
|
|
6
|
-
* specific points in the MCP protocol flow.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Base context interface shared by all lifecycle events
|
|
10
|
-
*/
|
|
11
|
-
export interface McpLifecycleBaseContext {
|
|
12
|
-
/** Get a parsed flag value by name */
|
|
13
|
-
getFlag(name: string): any;
|
|
14
|
-
/** MCP logger instance for this context */
|
|
15
|
-
logger: any;
|
|
16
|
-
/** Server information */
|
|
17
|
-
serverInfo: {
|
|
18
|
-
name: string;
|
|
19
|
-
version: string;
|
|
20
|
-
description?: string;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Context provided during the MCP initialize request
|
|
25
|
-
* This is called when a client sends the "initialize" request
|
|
26
|
-
*/
|
|
27
|
-
export interface McpInitializeContext extends McpLifecycleBaseContext {
|
|
28
|
-
/** Client information from the initialize request */
|
|
29
|
-
clientInfo: {
|
|
30
|
-
name: string;
|
|
31
|
-
version: string;
|
|
32
|
-
title?: string;
|
|
33
|
-
};
|
|
34
|
-
/** Protocol version being used */
|
|
35
|
-
protocolVersion: string;
|
|
36
|
-
/** Client capabilities */
|
|
37
|
-
clientCapabilities: Record<string, any>;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Context provided after the MCP initialized notification
|
|
41
|
-
* This is called when a client sends the "initialized" notification
|
|
42
|
-
*/
|
|
43
|
-
export interface McpInitializedContext extends McpLifecycleBaseContext {
|
|
44
|
-
/** Client information from the previous initialize request */
|
|
45
|
-
clientInfo: {
|
|
46
|
-
name: string;
|
|
47
|
-
version: string;
|
|
48
|
-
title?: string;
|
|
49
|
-
};
|
|
50
|
-
/** Protocol version being used */
|
|
51
|
-
protocolVersion: string;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Context provided during server shutdown
|
|
55
|
-
* This is called when the MCP server is being shut down
|
|
56
|
-
*/
|
|
57
|
-
export interface McpShutdownContext extends McpLifecycleBaseContext {
|
|
58
|
-
/** Reason for shutdown */
|
|
59
|
-
reason: "client_disconnect" | "server_shutdown" | "error" | "signal";
|
|
60
|
-
/** Optional error if shutdown was due to an error */
|
|
61
|
-
error?: Error;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Lifecycle event handlers interface
|
|
65
|
-
*/
|
|
66
|
-
export interface McpLifecycleEvents {
|
|
67
|
-
/**
|
|
68
|
-
* Called when a client sends an "initialize" request
|
|
69
|
-
* This is the first lifecycle event and is ideal for:
|
|
70
|
-
* - Database connection setup
|
|
71
|
-
* - Resource initialization
|
|
72
|
-
* - Configuration validation
|
|
73
|
-
* - Authentication setup
|
|
74
|
-
*/
|
|
75
|
-
onInitialize?: (context: McpInitializeContext) => Promise<void>;
|
|
76
|
-
/**
|
|
77
|
-
* Called when a client sends an "initialized" notification
|
|
78
|
-
* This indicates the client is ready for normal operations
|
|
79
|
-
* This is ideal for:
|
|
80
|
-
* - Final setup steps
|
|
81
|
-
* - Background task initialization
|
|
82
|
-
* - Health checks
|
|
83
|
-
*/
|
|
84
|
-
onInitialized?: (context: McpInitializedContext) => Promise<void>;
|
|
85
|
-
/**
|
|
86
|
-
* Called when the MCP server is shutting down
|
|
87
|
-
* This is ideal for:
|
|
88
|
-
* - Database connection cleanup
|
|
89
|
-
* - Resource disposal
|
|
90
|
-
* - Graceful shutdown procedures
|
|
91
|
-
*/
|
|
92
|
-
onShutdown?: (context: McpShutdownContext) => Promise<void>;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Internal state tracking for lifecycle events
|
|
96
|
-
*/
|
|
97
|
-
export interface McpLifecycleState {
|
|
98
|
-
/** Whether the initialize event has been called */
|
|
99
|
-
initialized: boolean;
|
|
100
|
-
/** Whether the initialized event has been called */
|
|
101
|
-
ready: boolean;
|
|
102
|
-
/** Whether shutdown has been initiated */
|
|
103
|
-
shuttingDown: boolean;
|
|
104
|
-
/** Stored client info from initialize */
|
|
105
|
-
clientInfo?: {
|
|
106
|
-
name: string;
|
|
107
|
-
version: string;
|
|
108
|
-
title?: string;
|
|
109
|
-
};
|
|
110
|
-
/** Protocol version being used */
|
|
111
|
-
protocolVersion?: string;
|
|
112
|
-
/** Client capabilities */
|
|
113
|
-
clientCapabilities?: Record<string, any>;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Lifecycle manager class for handling MCP lifecycle events
|
|
117
|
-
*/
|
|
118
|
-
export declare class McpLifecycleManager {
|
|
119
|
-
private events;
|
|
120
|
-
private logger;
|
|
121
|
-
private serverInfo;
|
|
122
|
-
private argParser?;
|
|
123
|
-
private state;
|
|
124
|
-
private parsedArgs;
|
|
125
|
-
constructor(events: McpLifecycleEvents, logger: any, serverInfo: {
|
|
126
|
-
name: string;
|
|
127
|
-
version: string;
|
|
128
|
-
description?: string;
|
|
129
|
-
}, argParser?: any | undefined);
|
|
130
|
-
/**
|
|
131
|
-
* Set the parsed arguments for flag access
|
|
132
|
-
*/
|
|
133
|
-
setParsedArgs(parsedArgs: any): void;
|
|
134
|
-
/**
|
|
135
|
-
* Get a flag value from parsed arguments or environment variables
|
|
136
|
-
*/
|
|
137
|
-
private getFlag;
|
|
138
|
-
/**
|
|
139
|
-
* Handle the initialize request
|
|
140
|
-
*/
|
|
141
|
-
handleInitialize(clientInfo: {
|
|
142
|
-
name: string;
|
|
143
|
-
version: string;
|
|
144
|
-
title?: string;
|
|
145
|
-
}, protocolVersion: string, clientCapabilities: Record<string, any>): Promise<void>;
|
|
146
|
-
/**
|
|
147
|
-
* Handle the initialized notification
|
|
148
|
-
*/
|
|
149
|
-
handleInitialized(): Promise<void>;
|
|
150
|
-
/**
|
|
151
|
-
* Handle server shutdown
|
|
152
|
-
*/
|
|
153
|
-
handleShutdown(reason: "client_disconnect" | "server_shutdown" | "error" | "signal", error?: Error): Promise<void>;
|
|
154
|
-
/**
|
|
155
|
-
* Get current lifecycle state
|
|
156
|
-
*/
|
|
157
|
-
getState(): Readonly<McpLifecycleState>;
|
|
158
|
-
/**
|
|
159
|
-
* Check if the server is ready for operations
|
|
160
|
-
*/
|
|
161
|
-
isReady(): boolean;
|
|
162
|
-
}
|
|
163
|
-
//# sourceMappingURL=mcp-lifecycle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-lifecycle.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,sCAAsC;IACtC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;IAC3B,2CAA2C;IAC3C,MAAM,EAAE,GAAG,CAAC;IACZ,yBAAyB;IACzB,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAqB,SAAQ,uBAAuB;IACnE,qDAAqD;IACrD,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,kCAAkC;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B;IAC1B,kBAAkB,EAAE,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-
*/
|
|
4
|
-
export type McpChangeType = "tools" | "resources" | "prompts";
|
|
5
|
-
/**
|
|
6
|
-
* Change notification event
|
|
7
|
-
*/
|
|
8
|
-
export interface McpChangeEvent {
|
|
9
|
-
type: McpChangeType;
|
|
10
|
-
timestamp: Date;
|
|
11
|
-
action: "added" | "removed" | "updated";
|
|
12
|
-
entityName?: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Change listener function type
|
|
16
|
-
*/
|
|
17
|
-
export type McpChangeListener = (event: McpChangeEvent) => void;
|
|
18
|
-
/**
|
|
19
|
-
* Client subscription information
|
|
20
|
-
*/
|
|
21
|
-
export interface McpClientSubscription {
|
|
22
|
-
clientId: string;
|
|
23
|
-
subscriptions: Set<McpChangeType>;
|
|
24
|
-
connection: any;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* MCP Change Notifications Manager
|
|
28
|
-
*
|
|
29
|
-
* Manages client subscriptions and change notifications for MCP entities
|
|
30
|
-
*/
|
|
31
|
-
export declare class McpNotificationsManager {
|
|
32
|
-
private clients;
|
|
33
|
-
private globalListeners;
|
|
34
|
-
private changeHistory;
|
|
35
|
-
private maxHistorySize;
|
|
36
|
-
/**
|
|
37
|
-
* Add a client connection
|
|
38
|
-
*/
|
|
39
|
-
addClient(clientId: string, connection: any): void;
|
|
40
|
-
/**
|
|
41
|
-
* Remove a client connection
|
|
42
|
-
*/
|
|
43
|
-
removeClient(clientId: string): void;
|
|
44
|
-
/**
|
|
45
|
-
* Subscribe a client to changes of a specific type
|
|
46
|
-
*/
|
|
47
|
-
subscribe(clientId: string, type: McpChangeType): void;
|
|
48
|
-
/**
|
|
49
|
-
* Unsubscribe a client from changes of a specific type
|
|
50
|
-
*/
|
|
51
|
-
unsubscribe(clientId: string, type: McpChangeType): void;
|
|
52
|
-
/**
|
|
53
|
-
* Subscribe a client to all change types
|
|
54
|
-
*/
|
|
55
|
-
subscribeToAll(clientId: string): void;
|
|
56
|
-
/**
|
|
57
|
-
* Unsubscribe a client from all change types
|
|
58
|
-
*/
|
|
59
|
-
unsubscribeFromAll(clientId: string): void;
|
|
60
|
-
/**
|
|
61
|
-
* Get client subscription status
|
|
62
|
-
*/
|
|
63
|
-
getClientSubscriptions(clientId: string): Set<McpChangeType> | undefined;
|
|
64
|
-
/**
|
|
65
|
-
* Check if a client is subscribed to a specific change type
|
|
66
|
-
*/
|
|
67
|
-
isClientSubscribed(clientId: string, type: McpChangeType): boolean;
|
|
68
|
-
/**
|
|
69
|
-
* Notify all subscribed clients of a change
|
|
70
|
-
*/
|
|
71
|
-
notifyChange(type: McpChangeType, action: "added" | "removed" | "updated", entityName?: string): void;
|
|
72
|
-
/**
|
|
73
|
-
* Add a global change listener (not client-specific)
|
|
74
|
-
*/
|
|
75
|
-
addGlobalListener(listener: McpChangeListener): void;
|
|
76
|
-
/**
|
|
77
|
-
* Remove a global change listener
|
|
78
|
-
*/
|
|
79
|
-
removeGlobalListener(listener: McpChangeListener): void;
|
|
80
|
-
/**
|
|
81
|
-
* Get change history
|
|
82
|
-
*/
|
|
83
|
-
getChangeHistory(limit?: number): McpChangeEvent[];
|
|
84
|
-
/**
|
|
85
|
-
* Clear change history
|
|
86
|
-
*/
|
|
87
|
-
clearHistory(): void;
|
|
88
|
-
/**
|
|
89
|
-
* Get connected client count
|
|
90
|
-
*/
|
|
91
|
-
getClientCount(): number;
|
|
92
|
-
/**
|
|
93
|
-
* Get subscription statistics
|
|
94
|
-
*/
|
|
95
|
-
getSubscriptionStats(): Record<McpChangeType, number>;
|
|
96
|
-
/**
|
|
97
|
-
* Send notification to a specific client
|
|
98
|
-
*/
|
|
99
|
-
private sendNotificationToClient;
|
|
100
|
-
/**
|
|
101
|
-
* Add event to change history
|
|
102
|
-
*/
|
|
103
|
-
private addToHistory;
|
|
104
|
-
/**
|
|
105
|
-
* Set maximum history size
|
|
106
|
-
*/
|
|
107
|
-
setMaxHistorySize(size: number): void;
|
|
108
|
-
/**
|
|
109
|
-
* Clear all subscriptions and clients
|
|
110
|
-
*/
|
|
111
|
-
clear(): void;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Utility functions for working with change notifications
|
|
115
|
-
*/
|
|
116
|
-
/**
|
|
117
|
-
* Create a debounced change notifier to batch rapid changes
|
|
118
|
-
*/
|
|
119
|
-
export declare function createDebouncedNotifier(manager: McpNotificationsManager, delay?: number): (type: McpChangeType, action: "added" | "removed" | "updated", entityName?: string) => void;
|
|
120
|
-
/**
|
|
121
|
-
* Create a filtered change listener that only responds to specific types
|
|
122
|
-
*/
|
|
123
|
-
export declare function createFilteredListener(types: McpChangeType[], listener: McpChangeListener): McpChangeListener;
|
|
124
|
-
/**
|
|
125
|
-
* Create a logging change listener for debugging
|
|
126
|
-
*/
|
|
127
|
-
export declare function createLoggingListener(prefix?: string): McpChangeListener;
|
|
128
|
-
/**
|
|
129
|
-
* Default global notifications manager instance
|
|
130
|
-
*/
|
|
131
|
-
export declare const globalNotificationsManager: McpNotificationsManager;
|
|
132
|
-
//# sourceMappingURL=mcp-notifications.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-notifications.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-notifications.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,WAAW,GAAG,SAAS,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,aAAa,CAAC;IACpB,SAAS,EAAE,IAAI,CAAC;IAChB,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,GAAG,CA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IAAI;IAIpB;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;OAEG;IACH,oBAAoB,IAAI,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC;IAgBrD;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAahC;;OAEG;IACH,OAAO,CAAC,YAAY;IASpB;;OAEG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IASrC;;OAEG;IACH,KAAK,IAAI,IAAI;CAKd;AAED;;GAEG;AAEH;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,uBAAuB,EAChC,KAAK,GAAE,MAAY,GAClB,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CA2B7F;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,aAAa,EAAE,EACtB,QAAQ,EAAE,iBAAiB,GAC1B,iBAAiB,CAMnB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,GAAE,MAAgB,GAAG,iBAAiB,CAQjF;AAED;;GAEG;AACH,eAAO,MAAM,0BAA0B,yBAAgC,CAAC"}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Prompts Management
|
|
3
|
-
*
|
|
4
|
-
* This module provides functionality for managing MCP prompts - server-side prompt templates
|
|
5
|
-
* that clients can discover and execute with custom parameters for dynamic text generation.
|
|
6
|
-
*/
|
|
7
|
-
import { type ZodTypeAny } from "zod";
|
|
8
|
-
/**
|
|
9
|
-
* Prompt message content types
|
|
10
|
-
*/
|
|
11
|
-
export interface McpPromptTextContent {
|
|
12
|
-
type: "text";
|
|
13
|
-
text: string;
|
|
14
|
-
}
|
|
15
|
-
export interface McpPromptImageContent {
|
|
16
|
-
type: "image";
|
|
17
|
-
data: string;
|
|
18
|
-
mimeType: string;
|
|
19
|
-
}
|
|
20
|
-
export type McpPromptContent = McpPromptTextContent | McpPromptImageContent;
|
|
21
|
-
/**
|
|
22
|
-
* Prompt message structure
|
|
23
|
-
*/
|
|
24
|
-
export interface McpPromptMessage {
|
|
25
|
-
role: "user" | "assistant" | "system";
|
|
26
|
-
content: McpPromptContent;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Prompt response structure
|
|
30
|
-
*/
|
|
31
|
-
export interface McpPromptResponse {
|
|
32
|
-
description?: string;
|
|
33
|
-
messages: McpPromptMessage[];
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Prompt handler function type
|
|
37
|
-
*/
|
|
38
|
-
export type McpPromptHandler = (args: any) => McpPromptResponse | Promise<McpPromptResponse>;
|
|
39
|
-
/**
|
|
40
|
-
* Prompt configuration for registration
|
|
41
|
-
*/
|
|
42
|
-
export interface McpPromptConfig {
|
|
43
|
-
name: string;
|
|
44
|
-
title?: string;
|
|
45
|
-
description?: string;
|
|
46
|
-
argsSchema: ZodTypeAny;
|
|
47
|
-
handler: McpPromptHandler;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Internal prompt storage structure
|
|
51
|
-
*/
|
|
52
|
-
export interface McpPromptEntry {
|
|
53
|
-
config: McpPromptConfig;
|
|
54
|
-
registeredAt: Date;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* MCP Prompts Manager
|
|
58
|
-
*
|
|
59
|
-
* Manages registration, storage, and execution of MCP prompts
|
|
60
|
-
*/
|
|
61
|
-
export declare class McpPromptsManager {
|
|
62
|
-
private prompts;
|
|
63
|
-
private changeListeners;
|
|
64
|
-
/**
|
|
65
|
-
* Register a new prompt
|
|
66
|
-
*/
|
|
67
|
-
addPrompt(config: McpPromptConfig): void;
|
|
68
|
-
/**
|
|
69
|
-
* Remove a prompt by name
|
|
70
|
-
*/
|
|
71
|
-
removePrompt(name: string): boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Get all registered prompts
|
|
74
|
-
*/
|
|
75
|
-
getPrompts(): McpPromptConfig[];
|
|
76
|
-
/**
|
|
77
|
-
* Get a specific prompt by name
|
|
78
|
-
*/
|
|
79
|
-
getPrompt(name: string): McpPromptConfig | undefined;
|
|
80
|
-
/**
|
|
81
|
-
* Check if a prompt exists
|
|
82
|
-
*/
|
|
83
|
-
hasPrompt(name: string): boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Execute a prompt with given arguments
|
|
86
|
-
*/
|
|
87
|
-
executePrompt(name: string, args: any): Promise<McpPromptResponse>;
|
|
88
|
-
/**
|
|
89
|
-
* Add change listener
|
|
90
|
-
*/
|
|
91
|
-
onPromptsChange(listener: () => void): void;
|
|
92
|
-
/**
|
|
93
|
-
* Remove change listener
|
|
94
|
-
*/
|
|
95
|
-
offPromptsChange(listener: () => void): void;
|
|
96
|
-
/**
|
|
97
|
-
* Clear all prompts
|
|
98
|
-
*/
|
|
99
|
-
clear(): void;
|
|
100
|
-
/**
|
|
101
|
-
* Get prompt count
|
|
102
|
-
*/
|
|
103
|
-
count(): number;
|
|
104
|
-
/**
|
|
105
|
-
* Validate prompt configuration
|
|
106
|
-
*/
|
|
107
|
-
private validatePromptConfig;
|
|
108
|
-
/**
|
|
109
|
-
* Notify all listeners of changes
|
|
110
|
-
*/
|
|
111
|
-
private notifyChange;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Helper function to create common prompt configurations
|
|
115
|
-
*/
|
|
116
|
-
/**
|
|
117
|
-
* Create a code review prompt
|
|
118
|
-
*/
|
|
119
|
-
export declare const createCodeReviewPrompt: () => McpPromptConfig;
|
|
120
|
-
/**
|
|
121
|
-
* Create a text summarization prompt
|
|
122
|
-
*/
|
|
123
|
-
export declare const createSummarizationPrompt: () => McpPromptConfig;
|
|
124
|
-
/**
|
|
125
|
-
* Create a translation prompt
|
|
126
|
-
*/
|
|
127
|
-
export declare const createTranslationPrompt: () => McpPromptConfig;
|
|
128
|
-
/**
|
|
129
|
-
* Create a documentation prompt
|
|
130
|
-
*/
|
|
131
|
-
export declare const createDocumentationPrompt: () => McpPromptConfig;
|
|
132
|
-
//# sourceMappingURL=mcp-prompts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-prompts.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-prompts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAK,KAAK,UAAU,EAAE,MAAM,KAAK,CAAC;AAKzC;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,qBAAqB,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;IACtC,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,GAAG,KAAK,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE7F;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,eAAe,CAAC;IACxB,YAAY,EAAE,IAAI,CAAC;CACpB;AAED;;;;GAIG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAAqC;IACpD,OAAO,CAAC,eAAe,CAAyB;IAEhD;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;IAcxC;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAQnC;;OAEG;IACH,UAAU,IAAI,eAAe,EAAE;IAI/B;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAIpD;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIhC;;OAEG;IACG,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAkBxE;;OAEG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAI3C;;OAEG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAI5C;;OAEG;IACH,KAAK,IAAI,IAAI;IAQb;;OAEG;IACH,KAAK,IAAI,MAAM;IAIf;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAkB5B;;OAEG;IACH,OAAO,CAAC,YAAY;CASrB;AAED;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,sBAAsB,QAAO,eAwBxC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAO,eAqC3C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,uBAAuB,QAAO,eAgCzC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAO,eA8B3C,CAAC"}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Protocol Version Configuration
|
|
3
|
-
*
|
|
4
|
-
* This module defines the supported MCP protocol versions and provides
|
|
5
|
-
* utilities for version negotiation according to the MCP specification.
|
|
6
|
-
*
|
|
7
|
-
* Version Negotiation Rules (per MCP specification):
|
|
8
|
-
* 1. If server supports the requested protocol version, it MUST respond with the same version
|
|
9
|
-
* 2. Otherwise, server MUST respond with another protocol version it supports
|
|
10
|
-
* 3. Server SHOULD respond with the latest version it supports
|
|
11
|
-
* 4. If client doesn't support the server's response version, it SHOULD disconnect
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Official MCP protocol versions in chronological order
|
|
15
|
-
* Based on the official MCP specification releases found in docs/MCP/modelcontextprotocol/docs/specification/
|
|
16
|
-
*
|
|
17
|
-
* According to versioning.mdx:
|
|
18
|
-
* - 2025-06-18 is the **current** protocol version
|
|
19
|
-
* - Previous versions are marked as **final** (complete, no changes)
|
|
20
|
-
* - Draft versions are in-progress specifications
|
|
21
|
-
*/
|
|
22
|
-
export declare const MCP_PROTOCOL_VERSIONS: readonly ["2024-11-05", "2025-03-26", "2025-06-18"];
|
|
23
|
-
/**
|
|
24
|
-
* Draft protocol versions (in-progress specifications)
|
|
25
|
-
* These are not yet ready for production use
|
|
26
|
-
*/
|
|
27
|
-
export declare const MCP_DRAFT_VERSIONS: readonly ["draft"];
|
|
28
|
-
/**
|
|
29
|
-
* All available protocol versions (stable + draft)
|
|
30
|
-
*/
|
|
31
|
-
export declare const ALL_MCP_VERSIONS: readonly ["2024-11-05", "2025-03-26", "2025-06-18", "draft"];
|
|
32
|
-
/**
|
|
33
|
-
* Type for stable MCP protocol versions
|
|
34
|
-
*/
|
|
35
|
-
export type McpProtocolVersion = (typeof MCP_PROTOCOL_VERSIONS)[number];
|
|
36
|
-
/**
|
|
37
|
-
* Type for draft MCP protocol versions
|
|
38
|
-
*/
|
|
39
|
-
export type McpDraftVersion = (typeof MCP_DRAFT_VERSIONS)[number];
|
|
40
|
-
/**
|
|
41
|
-
* Type for all MCP protocol versions (stable + draft)
|
|
42
|
-
*/
|
|
43
|
-
export type McpAnyVersion = (typeof ALL_MCP_VERSIONS)[number];
|
|
44
|
-
/**
|
|
45
|
-
* Current protocol version according to the official MCP specification
|
|
46
|
-
* This is marked as "current" in versioning.mdx and should be the preferred version
|
|
47
|
-
*/
|
|
48
|
-
export declare const CURRENT_MCP_PROTOCOL_VERSION: McpProtocolVersion;
|
|
49
|
-
/**
|
|
50
|
-
* Default protocol version used by this implementation for backward compatibility
|
|
51
|
-
* We start with this version but can negotiate to newer versions
|
|
52
|
-
*
|
|
53
|
-
* Note: The official MCP SDK may support newer versions automatically.
|
|
54
|
-
* This constant represents our fallback/minimum version.
|
|
55
|
-
*/
|
|
56
|
-
export declare const DEFAULT_MCP_PROTOCOL_VERSION: McpProtocolVersion;
|
|
57
|
-
/**
|
|
58
|
-
* Latest stable protocol version (highest version number from stable versions)
|
|
59
|
-
*/
|
|
60
|
-
export declare const LATEST_MCP_PROTOCOL_VERSION: McpProtocolVersion;
|
|
61
|
-
/**
|
|
62
|
-
* Minimum supported protocol version (oldest stable version)
|
|
63
|
-
*/
|
|
64
|
-
export declare const MINIMUM_MCP_PROTOCOL_VERSION: McpProtocolVersion;
|
|
65
|
-
/**
|
|
66
|
-
* Validates if a protocol version string follows the MCP format (YYYY-MM-DD or 'draft')
|
|
67
|
-
*/
|
|
68
|
-
export declare function isValidMcpVersionFormat(version: string): boolean;
|
|
69
|
-
/**
|
|
70
|
-
* Checks if a protocol version is an official stable MCP version
|
|
71
|
-
*/
|
|
72
|
-
export declare function isOfficialMcpVersion(version: string): version is McpProtocolVersion;
|
|
73
|
-
/**
|
|
74
|
-
* Checks if a protocol version is a draft MCP version
|
|
75
|
-
*/
|
|
76
|
-
export declare function isDraftMcpVersion(version: string): version is McpDraftVersion;
|
|
77
|
-
/**
|
|
78
|
-
* Checks if a protocol version is any valid MCP version (stable or draft)
|
|
79
|
-
*/
|
|
80
|
-
export declare function isAnyMcpVersion(version: string): version is McpAnyVersion;
|
|
81
|
-
/**
|
|
82
|
-
* Checks if a protocol version is supported by this implementation
|
|
83
|
-
* Note: The official MCP SDK may support additional versions automatically
|
|
84
|
-
*/
|
|
85
|
-
export declare function isSupportedByImplementation(version: string): boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Checks if a protocol version is recommended for production use
|
|
88
|
-
*/
|
|
89
|
-
export declare function isProductionReady(version: string): boolean;
|
|
90
|
-
/**
|
|
91
|
-
* Performs version negotiation according to MCP specification
|
|
92
|
-
*
|
|
93
|
-
* @param requestedVersion The protocol version requested by the client
|
|
94
|
-
* @returns The protocol version the server should respond with
|
|
95
|
-
*
|
|
96
|
-
* According to MCP specification:
|
|
97
|
-
* - If server supports requested version → return SAME version (MUST)
|
|
98
|
-
* - If server doesn't support requested version → return different supported version (MUST)
|
|
99
|
-
* - Server SHOULD return latest version it supports
|
|
100
|
-
*
|
|
101
|
-
* Note: The actual MCP SDK may implement its own version negotiation.
|
|
102
|
-
*/
|
|
103
|
-
export declare function negotiateProtocolVersion(requestedVersion: string): McpAnyVersion;
|
|
104
|
-
/**
|
|
105
|
-
* Gets comprehensive version compatibility information
|
|
106
|
-
*/
|
|
107
|
-
export declare function getVersionCompatibilityInfo(): {
|
|
108
|
-
stableVersions: ("2024-11-05" | "2025-03-26" | "2025-06-18")[];
|
|
109
|
-
currentVersion: "2024-11-05" | "2025-03-26" | "2025-06-18";
|
|
110
|
-
defaultVersion: "2024-11-05" | "2025-03-26" | "2025-06-18";
|
|
111
|
-
latestStableVersion: "2024-11-05" | "2025-03-26" | "2025-06-18";
|
|
112
|
-
minimumVersion: "2024-11-05" | "2025-03-26" | "2025-06-18";
|
|
113
|
-
draftVersions: "draft"[];
|
|
114
|
-
allSupportedVersions: ("2024-11-05" | "2025-03-26" | "2025-06-18" | "draft")[];
|
|
115
|
-
versionStatus: {
|
|
116
|
-
"2024-11-05": string;
|
|
117
|
-
"2025-03-26": string;
|
|
118
|
-
"2025-06-18": string;
|
|
119
|
-
draft: string;
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* Compares two MCP protocol versions
|
|
124
|
-
* Returns: -1 if v1 < v2, 0 if v1 === v2, 1 if v1 > v2
|
|
125
|
-
*/
|
|
126
|
-
export declare function compareVersions(v1: string, v2: string): number;
|
|
127
|
-
/**
|
|
128
|
-
* Finds the highest version from a list of versions
|
|
129
|
-
*/
|
|
130
|
-
export declare function getHighestVersion(versions: string[]): string | null;
|
|
131
|
-
/**
|
|
132
|
-
* Comprehensive test data for version negotiation testing
|
|
133
|
-
*/
|
|
134
|
-
export declare const VERSION_TEST_DATA: {
|
|
135
|
-
readonly stableVersions: readonly ["2024-11-05", "2025-03-26", "2025-06-18"];
|
|
136
|
-
readonly draftVersions: readonly ["draft"];
|
|
137
|
-
readonly allSupportedVersions: readonly ["2024-11-05", "2025-03-26", "2025-06-18", "draft"];
|
|
138
|
-
readonly unsupportedVersions: readonly ["2020-01-01", "2023-01-01", "2024-01-01", "2030-12-31", "2026-01-01"];
|
|
139
|
-
readonly malformedVersions: readonly ["", "invalid", "2024", "2024-13-01", "2024-01-32", "v2024-11-05", "2024.11.05", "24-11-05", "2024-11-5", "beta", "v1.0.0"];
|
|
140
|
-
readonly expectedNegotiations: {
|
|
141
|
-
readonly "2024-11-05": "2024-11-05";
|
|
142
|
-
readonly "2025-03-26": "2025-03-26";
|
|
143
|
-
readonly "2025-06-18": "2025-06-18";
|
|
144
|
-
readonly draft: "2025-06-18";
|
|
145
|
-
readonly "2020-01-01": "2025-06-18";
|
|
146
|
-
readonly "2030-12-31": "2025-06-18";
|
|
147
|
-
readonly invalid: "2025-06-18";
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
//# sourceMappingURL=mcp-protocol-versions.d.ts.map
|