@alcyone-labs/arg-parser 2.1.0 → 2.1.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/dist/config/ConfigurationManager.d.ts +74 -0
- package/dist/config/ConfigurationManager.d.ts.map +1 -0
- package/dist/config/plugins/ConfigPlugin.d.ts +60 -0
- package/dist/config/plugins/ConfigPlugin.d.ts.map +1 -0
- package/dist/config/plugins/ConfigPluginRegistry.d.ts +72 -0
- package/dist/config/plugins/ConfigPluginRegistry.d.ts.map +1 -0
- package/dist/config/plugins/TomlConfigPlugin.d.ts +30 -0
- package/dist/config/plugins/TomlConfigPlugin.d.ts.map +1 -0
- package/dist/config/plugins/YamlConfigPlugin.d.ts +29 -0
- package/dist/config/plugins/YamlConfigPlugin.d.ts.map +1 -0
- package/dist/config/plugins/index.d.ts +5 -0
- package/dist/config/plugins/index.d.ts.map +1 -0
- package/dist/core/ArgParser.d.ts +380 -0
- package/dist/core/ArgParser.d.ts.map +1 -0
- package/dist/core/ArgParserBase.d.ts +206 -0
- package/dist/core/ArgParserBase.d.ts.map +1 -0
- package/dist/core/FlagManager.d.ts +16 -0
- package/dist/core/FlagManager.d.ts.map +1 -0
- package/dist/core/types.d.ts +355 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/dxt/DxtGenerator.d.ts +111 -0
- package/dist/dxt/DxtGenerator.d.ts.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/mcp/ArgParserMcp.d.ts +21 -0
- package/dist/mcp/ArgParserMcp.d.ts.map +1 -0
- package/dist/mcp/mcp-integration.d.ts +86 -0
- package/dist/mcp/mcp-integration.d.ts.map +1 -0
- package/dist/mcp/mcp-notifications.d.ts +138 -0
- package/dist/mcp/mcp-notifications.d.ts.map +1 -0
- package/dist/mcp/mcp-prompts.d.ts +132 -0
- package/dist/mcp/mcp-prompts.d.ts.map +1 -0
- package/dist/mcp/mcp-protocol-versions.d.ts +150 -0
- package/dist/mcp/mcp-protocol-versions.d.ts.map +1 -0
- package/dist/mcp/mcp-resources.d.ts +133 -0
- package/dist/mcp/mcp-resources.d.ts.map +1 -0
- package/dist/testing/fuzzy-test-cli.d.ts +5 -0
- package/dist/testing/fuzzy-test-cli.d.ts.map +1 -0
- package/dist/testing/fuzzy-tester.d.ts +101 -0
- package/dist/testing/fuzzy-tester.d.ts.map +1 -0
- package/package.json +5 -3
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Change Notifications System
|
|
3
|
+
*
|
|
4
|
+
* This module provides functionality for managing MCP change notifications,
|
|
5
|
+
* allowing clients to subscribe to changes in tools, resources, and prompts.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Types of MCP entities that can change
|
|
9
|
+
*/
|
|
10
|
+
export type McpChangeType = 'tools' | 'resources' | 'prompts';
|
|
11
|
+
/**
|
|
12
|
+
* Change notification event
|
|
13
|
+
*/
|
|
14
|
+
export interface McpChangeEvent {
|
|
15
|
+
type: McpChangeType;
|
|
16
|
+
timestamp: Date;
|
|
17
|
+
action: 'added' | 'removed' | 'updated';
|
|
18
|
+
entityName?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Change listener function type
|
|
22
|
+
*/
|
|
23
|
+
export type McpChangeListener = (event: McpChangeEvent) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Client subscription information
|
|
26
|
+
*/
|
|
27
|
+
export interface McpClientSubscription {
|
|
28
|
+
clientId: string;
|
|
29
|
+
subscriptions: Set<McpChangeType>;
|
|
30
|
+
connection: any;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* MCP Change Notifications Manager
|
|
34
|
+
*
|
|
35
|
+
* Manages client subscriptions and change notifications for MCP entities
|
|
36
|
+
*/
|
|
37
|
+
export declare class McpNotificationsManager {
|
|
38
|
+
private clients;
|
|
39
|
+
private globalListeners;
|
|
40
|
+
private changeHistory;
|
|
41
|
+
private maxHistorySize;
|
|
42
|
+
/**
|
|
43
|
+
* Add a client connection
|
|
44
|
+
*/
|
|
45
|
+
addClient(clientId: string, connection: any): void;
|
|
46
|
+
/**
|
|
47
|
+
* Remove a client connection
|
|
48
|
+
*/
|
|
49
|
+
removeClient(clientId: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* Subscribe a client to changes of a specific type
|
|
52
|
+
*/
|
|
53
|
+
subscribe(clientId: string, type: McpChangeType): void;
|
|
54
|
+
/**
|
|
55
|
+
* Unsubscribe a client from changes of a specific type
|
|
56
|
+
*/
|
|
57
|
+
unsubscribe(clientId: string, type: McpChangeType): void;
|
|
58
|
+
/**
|
|
59
|
+
* Subscribe a client to all change types
|
|
60
|
+
*/
|
|
61
|
+
subscribeToAll(clientId: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* Unsubscribe a client from all change types
|
|
64
|
+
*/
|
|
65
|
+
unsubscribeFromAll(clientId: string): void;
|
|
66
|
+
/**
|
|
67
|
+
* Get client subscription status
|
|
68
|
+
*/
|
|
69
|
+
getClientSubscriptions(clientId: string): Set<McpChangeType> | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Check if a client is subscribed to a specific change type
|
|
72
|
+
*/
|
|
73
|
+
isClientSubscribed(clientId: string, type: McpChangeType): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Notify all subscribed clients of a change
|
|
76
|
+
*/
|
|
77
|
+
notifyChange(type: McpChangeType, action: 'added' | 'removed' | 'updated', entityName?: string): void;
|
|
78
|
+
/**
|
|
79
|
+
* Add a global change listener (not client-specific)
|
|
80
|
+
*/
|
|
81
|
+
addGlobalListener(listener: McpChangeListener): void;
|
|
82
|
+
/**
|
|
83
|
+
* Remove a global change listener
|
|
84
|
+
*/
|
|
85
|
+
removeGlobalListener(listener: McpChangeListener): void;
|
|
86
|
+
/**
|
|
87
|
+
* Get change history
|
|
88
|
+
*/
|
|
89
|
+
getChangeHistory(limit?: number): McpChangeEvent[];
|
|
90
|
+
/**
|
|
91
|
+
* Clear change history
|
|
92
|
+
*/
|
|
93
|
+
clearHistory(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Get connected client count
|
|
96
|
+
*/
|
|
97
|
+
getClientCount(): number;
|
|
98
|
+
/**
|
|
99
|
+
* Get subscription statistics
|
|
100
|
+
*/
|
|
101
|
+
getSubscriptionStats(): Record<McpChangeType, number>;
|
|
102
|
+
/**
|
|
103
|
+
* Send notification to a specific client
|
|
104
|
+
*/
|
|
105
|
+
private sendNotificationToClient;
|
|
106
|
+
/**
|
|
107
|
+
* Add event to change history
|
|
108
|
+
*/
|
|
109
|
+
private addToHistory;
|
|
110
|
+
/**
|
|
111
|
+
* Set maximum history size
|
|
112
|
+
*/
|
|
113
|
+
setMaxHistorySize(size: number): void;
|
|
114
|
+
/**
|
|
115
|
+
* Clear all subscriptions and clients
|
|
116
|
+
*/
|
|
117
|
+
clear(): void;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Utility functions for working with change notifications
|
|
121
|
+
*/
|
|
122
|
+
/**
|
|
123
|
+
* Create a debounced change notifier to batch rapid changes
|
|
124
|
+
*/
|
|
125
|
+
export declare function createDebouncedNotifier(manager: McpNotificationsManager, delay?: number): (type: McpChangeType, action: 'added' | 'removed' | 'updated', entityName?: string) => void;
|
|
126
|
+
/**
|
|
127
|
+
* Create a filtered change listener that only responds to specific types
|
|
128
|
+
*/
|
|
129
|
+
export declare function createFilteredListener(types: McpChangeType[], listener: McpChangeListener): McpChangeListener;
|
|
130
|
+
/**
|
|
131
|
+
* Create a logging change listener for debugging
|
|
132
|
+
*/
|
|
133
|
+
export declare function createLoggingListener(prefix?: string): McpChangeListener;
|
|
134
|
+
/**
|
|
135
|
+
* Default global notifications manager instance
|
|
136
|
+
*/
|
|
137
|
+
export declare const globalNotificationsManager: McpNotificationsManager;
|
|
138
|
+
//# sourceMappingURL=mcp-notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-notifications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AG,iBAAiB,CAKjF;AAED;;GAEG;AACH,eAAO,MAAM,0BAA0B,yBAAgC,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
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 { 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-prompts.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-prompts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAK,UAAU,EAAE,MAAM,KAAK,CAAC;AAEpC;;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;CAC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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,eAmBxC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAO,eA6B3C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,uBAAuB,QAAO,eAyBzC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAO,eAyB3C,CAAC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-protocol-versions.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-protocol-versions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,qDAIxB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,kBAAkB,oBAErB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,gBAAgB,8DAA6D,CAAC;AAE3F;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAE5D;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,kBAAiC,CAAC;AAE7E;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,EAAE,kBAAiC,CAAC;AAE7E;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,kBACe,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,kBAA6C,CAAC;AAEzF;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,IAAI,kBAAkB,CAEnF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,IAAI,eAAe,CAE7E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,IAAI,aAAa,CAEzE;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAIpE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAG1D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,gBAAgB,EAAE,MAAM,GAAG,aAAa,CAmBhF;AAED;;GAEG;AACH,wBAAgB,2BAA2B;;;;;;;;;;;;;;EAuB1C;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAG9D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAMnE;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;CA4CpB,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Resources Management
|
|
3
|
+
*
|
|
4
|
+
* This module provides functionality for managing MCP resources - server-side data sources
|
|
5
|
+
* that clients can access using URI templates. Resources are similar to GET endpoints
|
|
6
|
+
* in a REST API and should provide data without significant computation or side effects.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Resource response content item
|
|
10
|
+
*/
|
|
11
|
+
export interface McpResourceContent {
|
|
12
|
+
uri: string;
|
|
13
|
+
text?: string;
|
|
14
|
+
blob?: Uint8Array;
|
|
15
|
+
mimeType?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Resource response structure
|
|
19
|
+
*/
|
|
20
|
+
export interface McpResourceResponse {
|
|
21
|
+
contents: McpResourceContent[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Resource handler function type
|
|
25
|
+
*/
|
|
26
|
+
export type McpResourceHandler = (uri: URL, params: Record<string, string>) => Promise<McpResourceResponse>;
|
|
27
|
+
/**
|
|
28
|
+
* Resource configuration for registration
|
|
29
|
+
*/
|
|
30
|
+
export interface McpResourceConfig {
|
|
31
|
+
name: string;
|
|
32
|
+
uriTemplate: string;
|
|
33
|
+
title?: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
mimeType?: string;
|
|
36
|
+
handler: McpResourceHandler;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Internal resource storage structure
|
|
40
|
+
*/
|
|
41
|
+
export interface McpResourceEntry {
|
|
42
|
+
config: McpResourceConfig;
|
|
43
|
+
registeredAt: Date;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Resource template parser for URI patterns like "users://{userId}/profile"
|
|
47
|
+
*/
|
|
48
|
+
export declare class ResourceTemplateParser {
|
|
49
|
+
private pattern;
|
|
50
|
+
private paramNames;
|
|
51
|
+
constructor(template: string);
|
|
52
|
+
/**
|
|
53
|
+
* Parse a URI against this template and extract parameters
|
|
54
|
+
*/
|
|
55
|
+
parse(uri: string): Record<string, string> | null;
|
|
56
|
+
/**
|
|
57
|
+
* Check if a URI matches this template
|
|
58
|
+
*/
|
|
59
|
+
matches(uri: string): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Get the parameter names for this template
|
|
62
|
+
*/
|
|
63
|
+
getParameterNames(): string[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* MCP Resources Manager
|
|
67
|
+
*
|
|
68
|
+
* Manages registration, storage, and retrieval of MCP resources
|
|
69
|
+
*/
|
|
70
|
+
export declare class McpResourcesManager {
|
|
71
|
+
private resources;
|
|
72
|
+
private changeListeners;
|
|
73
|
+
/**
|
|
74
|
+
* Register a new resource
|
|
75
|
+
*/
|
|
76
|
+
addResource(config: McpResourceConfig): void;
|
|
77
|
+
/**
|
|
78
|
+
* Remove a resource by name
|
|
79
|
+
*/
|
|
80
|
+
removeResource(name: string): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Get all registered resources
|
|
83
|
+
*/
|
|
84
|
+
getResources(): McpResourceConfig[];
|
|
85
|
+
/**
|
|
86
|
+
* Get a specific resource by name
|
|
87
|
+
*/
|
|
88
|
+
getResource(name: string): McpResourceConfig | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Check if a resource exists
|
|
91
|
+
*/
|
|
92
|
+
hasResource(name: string): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Find resource that matches a URI
|
|
95
|
+
*/
|
|
96
|
+
findResourceForUri(uri: string): {
|
|
97
|
+
config: McpResourceConfig;
|
|
98
|
+
params: Record<string, string>;
|
|
99
|
+
} | null;
|
|
100
|
+
/**
|
|
101
|
+
* Add change listener
|
|
102
|
+
*/
|
|
103
|
+
onResourcesChange(listener: () => void): void;
|
|
104
|
+
/**
|
|
105
|
+
* Remove change listener
|
|
106
|
+
*/
|
|
107
|
+
offResourcesChange(listener: () => void): void;
|
|
108
|
+
/**
|
|
109
|
+
* Clear all resources
|
|
110
|
+
*/
|
|
111
|
+
clear(): void;
|
|
112
|
+
/**
|
|
113
|
+
* Get resource count
|
|
114
|
+
*/
|
|
115
|
+
count(): number;
|
|
116
|
+
/**
|
|
117
|
+
* Validate resource configuration
|
|
118
|
+
*/
|
|
119
|
+
private validateResourceConfig;
|
|
120
|
+
/**
|
|
121
|
+
* Notify all listeners of changes
|
|
122
|
+
*/
|
|
123
|
+
private notifyChange;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Helper function to create common resource configurations
|
|
127
|
+
*/
|
|
128
|
+
export declare const createFileResource: (basePath?: string) => McpResourceConfig;
|
|
129
|
+
/**
|
|
130
|
+
* Helper function to create JSON data resource
|
|
131
|
+
*/
|
|
132
|
+
export declare const createJsonResource: (name: string, data: any) => McpResourceConfig;
|
|
133
|
+
//# sourceMappingURL=mcp-resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-resources.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-resources.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,kBAAkB,EAAE,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAC/B,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAC3B,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAElC;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,kBAAkB,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,YAAY,EAAE,IAAI,CAAC;CACpB;AAED;;GAEG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,UAAU,CAAW;gBAEjB,QAAQ,EAAE,MAAM;IAU5B;;OAEG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAWj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"","sources":["../../src/testing/fuzzy-test-cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAgB9C,QAAA,MAAM,YAAY,iBAmEhB,CAAC;AAkPH,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { ArgParserBase } from "../core/ArgParserBase";
|
|
2
|
+
export interface FuzzyTestOptions {
|
|
3
|
+
/** Maximum depth for command path exploration */
|
|
4
|
+
maxDepth?: number;
|
|
5
|
+
/** Number of random test cases to generate per command path */
|
|
6
|
+
randomTestCases?: number;
|
|
7
|
+
/** Include performance timing in results */
|
|
8
|
+
includePerformance?: boolean;
|
|
9
|
+
/** Test invalid combinations to verify error handling */
|
|
10
|
+
testErrorCases?: boolean;
|
|
11
|
+
/** Verbose output for debugging */
|
|
12
|
+
verbose?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface TestResult {
|
|
15
|
+
commandPath: string[];
|
|
16
|
+
args: string[];
|
|
17
|
+
success: boolean;
|
|
18
|
+
error?: string;
|
|
19
|
+
executionTime?: number;
|
|
20
|
+
parsedResult?: any;
|
|
21
|
+
}
|
|
22
|
+
export interface FuzzyTestReport {
|
|
23
|
+
totalTests: number;
|
|
24
|
+
successfulTests: number;
|
|
25
|
+
failedTests: number;
|
|
26
|
+
commandPaths: string[][];
|
|
27
|
+
results: TestResult[];
|
|
28
|
+
summary: {
|
|
29
|
+
coverageByPath: Record<string, {
|
|
30
|
+
total: number;
|
|
31
|
+
passed: number;
|
|
32
|
+
}>;
|
|
33
|
+
errorTypes: Record<string, number>;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export declare class ArgParserFuzzyTester {
|
|
37
|
+
private parser;
|
|
38
|
+
private options;
|
|
39
|
+
constructor(parser: ArgParserBase, options?: FuzzyTestOptions);
|
|
40
|
+
/**
|
|
41
|
+
* Run comprehensive fuzzy testing on the ArgParser instance
|
|
42
|
+
*/
|
|
43
|
+
runFuzzyTest(): Promise<FuzzyTestReport>;
|
|
44
|
+
/**
|
|
45
|
+
* Discover all possible command paths in the parser
|
|
46
|
+
*/
|
|
47
|
+
private discoverCommandPaths;
|
|
48
|
+
/**
|
|
49
|
+
* Recursively discover subcommand paths
|
|
50
|
+
*/
|
|
51
|
+
private discoverSubCommandPaths;
|
|
52
|
+
/**
|
|
53
|
+
* Get subcommands from a parser instance
|
|
54
|
+
*/
|
|
55
|
+
private getSubCommands;
|
|
56
|
+
/**
|
|
57
|
+
* Get flags from a parser instance
|
|
58
|
+
*/
|
|
59
|
+
private getFlags;
|
|
60
|
+
/**
|
|
61
|
+
* Test a specific command path with various flag combinations
|
|
62
|
+
*/
|
|
63
|
+
private testCommandPath;
|
|
64
|
+
/**
|
|
65
|
+
* Get the parser instance for a specific command path
|
|
66
|
+
*/
|
|
67
|
+
private getParserForPath;
|
|
68
|
+
/**
|
|
69
|
+
* Generate valid flag combinations for testing
|
|
70
|
+
*/
|
|
71
|
+
private generateValidFlagCombinations;
|
|
72
|
+
/**
|
|
73
|
+
* Generate random flag combination
|
|
74
|
+
*/
|
|
75
|
+
private generateRandomFlagCombination;
|
|
76
|
+
/**
|
|
77
|
+
* Generate error test cases
|
|
78
|
+
*/
|
|
79
|
+
private generateErrorCases;
|
|
80
|
+
/**
|
|
81
|
+
* Generate arguments for a specific flag
|
|
82
|
+
*/
|
|
83
|
+
private generateFlagArgs;
|
|
84
|
+
/**
|
|
85
|
+
* Generate values for a flag based on its type and constraints
|
|
86
|
+
*/
|
|
87
|
+
private generateFlagValues;
|
|
88
|
+
/**
|
|
89
|
+
* Generate a single value for a flag
|
|
90
|
+
*/
|
|
91
|
+
private generateSingleFlagValue;
|
|
92
|
+
/**
|
|
93
|
+
* Execute a single test case
|
|
94
|
+
*/
|
|
95
|
+
private executeTest;
|
|
96
|
+
/**
|
|
97
|
+
* Generate comprehensive test report
|
|
98
|
+
*/
|
|
99
|
+
private generateReport;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=fuzzy-tester.d.ts.map
|