@nam088/mcp-swagger-parser 3.0.1 → 3.0.3

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.
File without changes
@@ -0,0 +1,4 @@
1
+ export * from './types.js';
2
+ export * from './plugin-base.js';
3
+ export * from './plugin-registry.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vendor/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './types.js';
2
+ export * from './plugin-base.js';
3
+ export * from './plugin-registry.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/vendor/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,78 @@
1
+ import type { IPlugin, PluginConfig, PluginContext } from './types.js';
2
+ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
3
+ import type { ZodRawShape } from 'zod';
4
+ /**
5
+ * Tool schema definition
6
+ */
7
+ export type ToolSchema = {
8
+ description: string;
9
+ inputSchema: ZodRawShape;
10
+ };
11
+ /**
12
+ * Tool handler function type
13
+ */
14
+ export type ToolHandler<TArgs = Record<string, unknown>> = (args: TArgs) => CallToolResult | Promise<CallToolResult>;
15
+ /**
16
+ * Abstract base class for plugins
17
+ * Provides common functionality and enforces interface implementation
18
+ */
19
+ export declare abstract class PluginBase implements IPlugin {
20
+ abstract readonly metadata: PluginConfig;
21
+ protected context?: PluginContext;
22
+ protected config: Record<string, unknown>;
23
+ constructor(config?: Record<string, unknown>);
24
+ /**
25
+ * Initialize plugin
26
+ * Override this to add custom initialization logic
27
+ */
28
+ initialize(context: PluginContext): Promise<void> | void;
29
+ /**
30
+ * Register tools, resources, prompts
31
+ * Must be implemented by subclasses
32
+ */
33
+ abstract register(context: PluginContext): Promise<void> | void;
34
+ /**
35
+ * Cleanup resources
36
+ * Override this to add custom cleanup logic
37
+ */
38
+ cleanup(): Promise<void> | void;
39
+ /**
40
+ * Health check
41
+ * Override this to add custom health checks
42
+ */
43
+ healthCheck(): Promise<boolean> | boolean;
44
+ /**
45
+ * Get plugin context
46
+ */
47
+ protected getContext(): PluginContext;
48
+ /**
49
+ * Get plugin configuration
50
+ */
51
+ protected getConfig<T = Record<string, unknown>>(): T;
52
+ /**
53
+ * Check if plugin is in readonly mode
54
+ */
55
+ protected isReadonly(): boolean;
56
+ /**
57
+ * Check if plugin is in full mode
58
+ */
59
+ protected isFullMode(): boolean;
60
+ /**
61
+ * Register a tool with automatic mode checking
62
+ * Write tools are automatically skipped in readonly mode
63
+ * @param options Tool registration options
64
+ * @param options.context Plugin context
65
+ * @param options.name Tool name
66
+ * @param options.schema Tool schema with description and inputSchema
67
+ * @param options.handler Tool handler function
68
+ * @param options.isWriteTool Whether this is a write operation (default: false)
69
+ */
70
+ protected registerTool<TArgs = Record<string, unknown>>(options: {
71
+ context: PluginContext;
72
+ name: string;
73
+ schema: ToolSchema;
74
+ handler: ToolHandler<TArgs>;
75
+ isWriteTool?: boolean;
76
+ }): void;
77
+ }
78
+ //# sourceMappingURL=plugin-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-base.d.ts","sourceRoot":"","sources":["../../../src/vendor/plugin-base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEvE,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB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C/D,OAAO,EAAE,aAAa,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,UAAU,CAAC;QACnB,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;QAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,GAAG,IAAI;CAqBT"}
@@ -0,0 +1,84 @@
1
+ import { PluginMode } from './types.js';
2
+ /**
3
+ * Abstract base class for plugins
4
+ * Provides common functionality and enforces interface implementation
5
+ */
6
+ export class PluginBase {
7
+ context;
8
+ config;
9
+ constructor(config) {
10
+ this.config = config ?? {};
11
+ }
12
+ /**
13
+ * Initialize plugin
14
+ * Override this to add custom initialization logic
15
+ */
16
+ initialize(context) {
17
+ this.context = context;
18
+ }
19
+ /**
20
+ * Cleanup resources
21
+ * Override this to add custom cleanup logic
22
+ */
23
+ cleanup() {
24
+ // Override this method to add custom cleanup logic
25
+ }
26
+ /**
27
+ * Health check
28
+ * Override this to add custom health checks
29
+ */
30
+ healthCheck() {
31
+ return true;
32
+ }
33
+ /**
34
+ * Get plugin context
35
+ */
36
+ getContext() {
37
+ if (!this.context) {
38
+ throw new Error(`Plugin ${this.metadata.name} not initialized`);
39
+ }
40
+ return this.context;
41
+ }
42
+ /**
43
+ * Get plugin configuration
44
+ */
45
+ getConfig() {
46
+ return (this.config || {});
47
+ }
48
+ /**
49
+ * Check if plugin is in readonly mode
50
+ */
51
+ isReadonly() {
52
+ return this.metadata.mode === PluginMode.READONLY;
53
+ }
54
+ /**
55
+ * Check if plugin is in full mode
56
+ */
57
+ isFullMode() {
58
+ return this.metadata.mode === PluginMode.FULL;
59
+ }
60
+ /**
61
+ * Register a tool with automatic mode checking
62
+ * Write tools are automatically skipped in readonly mode
63
+ * @param options Tool registration options
64
+ * @param options.context Plugin context
65
+ * @param options.name Tool name
66
+ * @param options.schema Tool schema with description and inputSchema
67
+ * @param options.handler Tool handler function
68
+ * @param options.isWriteTool Whether this is a write operation (default: false)
69
+ */
70
+ registerTool(options) {
71
+ const { context, name, schema, handler, isWriteTool = false } = options;
72
+ // Skip write tools in readonly mode
73
+ if (isWriteTool && this.isReadonly()) {
74
+ console.warn(`[WARN] [${this.metadata.name}] Skipping write tool '${name}' in readonly mode`);
75
+ return;
76
+ }
77
+ // Wrap handler to match MCP SDK signature: (args, extra) => ...
78
+ // The SDK expects both args and extra, but our handler only needs args
79
+ context.server.registerTool(name, schema, (args, _extra) => {
80
+ return handler(args);
81
+ });
82
+ }
83
+ }
84
+ //# sourceMappingURL=plugin-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-base.js","sourceRoot":"","sources":["../../../src/vendor/plugin-base.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAwBxC;;;GAGG;AACH,MAAM,OAAgB,UAAU;IAGpB,OAAO,CAAiB;IACxB,MAAM,CAA0B;IAE1C,YAAY,MAAgC;QAC1C,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACH,UAAU,CAAC,OAAsB;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAQD;;;OAGG;IACH,OAAO;QACL,mDAAmD;IACrD,CAAC;IAED;;;OAGG;IACH,WAAW;QACT,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACO,UAAU;QAClB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,UAAU,IAAI,CAAC,QAAQ,CAAC,IAAI,kBAAkB,CAAC,CAAC;QAClE,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;OAEG;IACO,SAAS;QACjB,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAM,CAAC;IAClC,CAAC;IAED;;OAEG;IACO,UAAU;QAClB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,UAAU,CAAC,QAAQ,CAAC;IACpD,CAAC;IAED;;OAEG;IACO,UAAU;QAClB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,CAAC;IAChD,CAAC;IAED;;;;;;;;;OASG;IACO,YAAY,CAAkC,OAMvD;QACC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;QAExE,oCAAoC;QACpC,IAAI,WAAW,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC;YACrC,OAAO,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,QAAQ,CAAC,IAAI,0BAA0B,IAAI,oBAAoB,CAAC,CAAC;YAC9F,OAAO;QACT,CAAC;QACD,gEAAgE;QAChE,uEAAuE;QACvE,OAAO,CAAC,MAAM,CAAC,YAAY,CACzB,IAAI,EACJ,MAAM,EACN,CACE,IAA8B,EAC9B,MAA8D,EAC9D,EAAE;YACF,OAAO,OAAO,CAAC,IAAa,CAAC,CAAC;QAChC,CAAC,CACF,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,51 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { IPlugin, PluginConstructor } from './types.js';
3
+ import { PluginMode } from './types.js';
4
+ /**
5
+ * Plugin Registry Options
6
+ */
7
+ export interface PluginRegistryOptions {
8
+ /**
9
+ * Default mode for all plugins (default: READONLY)
10
+ */
11
+ defaultMode?: PluginMode;
12
+ }
13
+ /**
14
+ * Plugin Registry
15
+ * Manages plugin lifecycle and registration
16
+ */
17
+ export declare class PluginRegistry {
18
+ private plugins;
19
+ private server;
20
+ private defaultMode;
21
+ constructor(server: McpServer, options?: PluginRegistryOptions);
22
+ /**
23
+ * Register a plugin
24
+ */
25
+ registerPlugin(PluginClass: PluginConstructor, config?: Record<string, unknown>): Promise<void>;
26
+ /**
27
+ * Get a registered plugin
28
+ */
29
+ getPlugin(name: string): IPlugin | undefined;
30
+ /**
31
+ * Get all registered plugins
32
+ */
33
+ getAllPlugins(): IPlugin[];
34
+ /**
35
+ * Check if plugin is registered
36
+ */
37
+ hasPlugin(name: string): boolean;
38
+ /**
39
+ * Unregister a plugin
40
+ */
41
+ unregisterPlugin(name: string): Promise<void>;
42
+ /**
43
+ * Cleanup all plugins
44
+ */
45
+ cleanup(): Promise<void>;
46
+ /**
47
+ * Health check all plugins
48
+ */
49
+ healthCheckAll(): Promise<Record<string, boolean>>;
50
+ }
51
+ //# sourceMappingURL=plugin-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-registry.d.ts","sourceRoot":"","sources":["../../../src/vendor/plugin-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAiB,MAAM,YAAY,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,WAAW,CAAC,EAAE,UAAU,CAAC;CAC1B;AAED;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAAmC;IAClD,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,WAAW,CAAa;gBAEpB,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,qBAAqB;IAK9D;;OAEG;IACG,cAAc,CAClB,WAAW,EAAE,iBAAiB,EAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,IAAI,CAAC;IAgChB;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAI5C;;OAEG;IACH,aAAa,IAAI,OAAO,EAAE;IAI1B;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIhC;;OAEG;IACG,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAanD;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAc9B;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAczD"}
@@ -0,0 +1,107 @@
1
+ import { PluginMode } from './types.js';
2
+ /**
3
+ * Plugin Registry
4
+ * Manages plugin lifecycle and registration
5
+ */
6
+ export class PluginRegistry {
7
+ plugins = new Map();
8
+ server;
9
+ defaultMode;
10
+ constructor(server, options) {
11
+ this.server = server;
12
+ this.defaultMode = options?.defaultMode ?? PluginMode.READONLY;
13
+ }
14
+ /**
15
+ * Register a plugin
16
+ */
17
+ async registerPlugin(PluginClass, config) {
18
+ const plugin = new PluginClass(config);
19
+ const pluginName = plugin.metadata.name;
20
+ if (this.plugins.has(pluginName)) {
21
+ throw new Error(`Plugin ${pluginName} is already registered`);
22
+ }
23
+ // Apply default mode if not specified
24
+ if (!plugin.metadata.mode) {
25
+ plugin.metadata.mode = this.defaultMode;
26
+ }
27
+ const context = {
28
+ server: this.server,
29
+ };
30
+ try {
31
+ // Initialize plugin
32
+ await plugin.initialize(context);
33
+ // Register plugin's tools/resources/prompts
34
+ await plugin.register(context);
35
+ // Store plugin
36
+ this.plugins.set(pluginName, plugin);
37
+ }
38
+ catch (error) {
39
+ console.error(`[ERROR] [PluginRegistry] Failed to register plugin ${pluginName}:`, error);
40
+ throw error;
41
+ }
42
+ }
43
+ /**
44
+ * Get a registered plugin
45
+ */
46
+ getPlugin(name) {
47
+ return this.plugins.get(name);
48
+ }
49
+ /**
50
+ * Get all registered plugins
51
+ */
52
+ getAllPlugins() {
53
+ return Array.from(this.plugins.values());
54
+ }
55
+ /**
56
+ * Check if plugin is registered
57
+ */
58
+ hasPlugin(name) {
59
+ return this.plugins.has(name);
60
+ }
61
+ /**
62
+ * Unregister a plugin
63
+ */
64
+ async unregisterPlugin(name) {
65
+ const plugin = this.plugins.get(name);
66
+ if (!plugin) {
67
+ throw new Error(`Plugin ${name} not found`);
68
+ }
69
+ if (plugin.cleanup) {
70
+ await plugin.cleanup();
71
+ }
72
+ this.plugins.delete(name);
73
+ }
74
+ /**
75
+ * Cleanup all plugins
76
+ */
77
+ async cleanup() {
78
+ for (const [name, plugin] of this.plugins) {
79
+ try {
80
+ if (plugin.cleanup) {
81
+ await plugin.cleanup();
82
+ }
83
+ }
84
+ catch (error) {
85
+ console.error(`[ERROR] [PluginRegistry] Error cleaning up plugin ${name}:`, error);
86
+ }
87
+ }
88
+ this.plugins.clear();
89
+ }
90
+ /**
91
+ * Health check all plugins
92
+ */
93
+ async healthCheckAll() {
94
+ const results = {};
95
+ for (const [name, plugin] of this.plugins) {
96
+ try {
97
+ results[name] = plugin.healthCheck ? await plugin.healthCheck() : true;
98
+ }
99
+ catch (error) {
100
+ console.error(`[ERROR] [PluginRegistry] Health check failed for ${name}:`, error);
101
+ results[name] = false;
102
+ }
103
+ }
104
+ return results;
105
+ }
106
+ }
107
+ //# sourceMappingURL=plugin-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-registry.js","sourceRoot":"","sources":["../../../src/vendor/plugin-registry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAYxC;;;GAGG;AACH,MAAM,OAAO,cAAc;IACjB,OAAO,GAAyB,IAAI,GAAG,EAAE,CAAC;IAC1C,MAAM,CAAY;IAClB,WAAW,CAAa;IAEhC,YAAY,MAAiB,EAAE,OAA+B;QAC5D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,OAAO,EAAE,WAAW,IAAI,UAAU,CAAC,QAAQ,CAAC;IACjE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAClB,WAA8B,EAC9B,MAAgC;QAEhC,MAAM,MAAM,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AAG,EAAE,KAAK,CAAC,CAAC;gBAClF,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;YACxB,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
@@ -0,0 +1,88 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
3
+ import type { ServerRequest, ServerNotification } from '@modelcontextprotocol/sdk/types.js';
4
+ /**
5
+ * Plugin access mode
6
+ */
7
+ export declare enum PluginMode {
8
+ /**
9
+ * Read-only mode - only read operations allowed
10
+ */
11
+ READONLY = "readonly",
12
+ /**
13
+ * Full mode - all operations allowed
14
+ */
15
+ FULL = "full"
16
+ }
17
+ /**
18
+ * Plugin configuration interface
19
+ */
20
+ export interface PluginConfig {
21
+ /**
22
+ * Plugin name
23
+ */
24
+ name: string;
25
+ /**
26
+ * Plugin version
27
+ */
28
+ version: string;
29
+ /**
30
+ * Plugin description
31
+ */
32
+ description?: string;
33
+ /**
34
+ * Plugin access mode (default: FULL)
35
+ */
36
+ mode?: PluginMode;
37
+ /**
38
+ * Plugin-specific configuration
39
+ */
40
+ config?: Record<string, unknown>;
41
+ }
42
+ /**
43
+ * Context provided to plugins
44
+ */
45
+ export interface PluginContext {
46
+ /**
47
+ * MCP Server instance
48
+ */
49
+ server: McpServer;
50
+ /**
51
+ * Request handler extra context
52
+ */
53
+ extra?: RequestHandlerExtra<ServerRequest, ServerNotification>;
54
+ }
55
+ /**
56
+ * Base Plugin interface that all plugins must implement
57
+ */
58
+ export interface IPlugin {
59
+ /**
60
+ * Plugin metadata
61
+ */
62
+ readonly metadata: PluginConfig;
63
+ /**
64
+ * Initialize the plugin
65
+ * Called when plugin is loaded
66
+ */
67
+ initialize(context: PluginContext): Promise<void> | void;
68
+ /**
69
+ * Register plugin's tools, resources, and prompts
70
+ * Called after initialization
71
+ */
72
+ register(context: PluginContext): Promise<void> | void;
73
+ /**
74
+ * Cleanup plugin resources
75
+ * Called when server is shutting down
76
+ */
77
+ cleanup?(): Promise<void> | void;
78
+ /**
79
+ * Health check for the plugin
80
+ * Returns true if plugin is healthy
81
+ */
82
+ healthCheck?(): Promise<boolean> | boolean;
83
+ }
84
+ /**
85
+ * Plugin constructor type
86
+ */
87
+ export type PluginConstructor = new (config?: Record<string, unknown>) => IPlugin;
88
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/vendor/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAE5F;;GAEG;AACH,oBAAY,UAAU;IACpB;;OAEG;IACH,QAAQ,aAAa;IAErB;;OAEG;IACH,IAAI,SAAS;CACd;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,MAAM,EAAE,SAAS,CAAC;IAElB;;OAEG;IACH,KAAK,CAAC,EAAE,mBAAmB,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;CAChE;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAEhC;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAEzD;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAEvD;;;OAGG;IACH,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAEjC;;;OAGG;IACH,WAAW,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;CAC5C;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Plugin access mode
3
+ */
4
+ export var PluginMode;
5
+ (function (PluginMode) {
6
+ /**
7
+ * Read-only mode - only read operations allowed
8
+ */
9
+ PluginMode["READONLY"] = "readonly";
10
+ /**
11
+ * Full mode - all operations allowed
12
+ */
13
+ PluginMode["FULL"] = "full";
14
+ })(PluginMode || (PluginMode = {}));
15
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/vendor/types.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,CAAN,IAAY,UAUX;AAVD,WAAY,UAAU;IACpB;;OAEG;IACH,mCAAqB,CAAA;IAErB;;OAEG;IACH,2BAAa,CAAA;AACf,CAAC,EAVW,UAAU,KAAV,UAAU,QAUrB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nam088/mcp-swagger-parser",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "Enhanced OpenAPI/Swagger MCP plugin with 12 tools, YAML support, and auto-resolved schemas",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -35,19 +35,16 @@
35
35
  "bin",
36
36
  "README.md"
37
37
  ],
38
- "devDependencies": {
39
- "@types/js-yaml": "^4.0.9",
40
- "@types/node": "^20.0.0"
41
- },
42
38
  "dependencies": {
39
+ "@modelcontextprotocol/sdk": "^1.21.1",
40
+ "@nam088/mcp-core": "^0.2.9",
43
41
  "axios": "^1.13.2",
44
42
  "js-yaml": "^4.1.1",
45
- "@nam088/mcp-core": "workspace:*",
46
- "@modelcontextprotocol/sdk": "^1.0.4",
47
- "zod": "^3.24.1"
43
+ "zod": "^3.23.8"
48
44
  },
49
- "peerDependencies": {
50
- "@nam088/mcp-core": "^1.0.0",
51
- "@modelcontextprotocol/sdk": "^1.0.0"
45
+ "devDependencies": {
46
+ "@types/js-yaml": "^4.0.9",
47
+ "@types/node": "^24.10.0",
48
+ "typescript": "^5.9.3"
52
49
  }
53
50
  }