@agiflowai/one-mcp 0.3.10 → 0.3.12
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 +136 -200
- package/dist/cli.cjs +251 -98
- package/dist/cli.mjs +250 -97
- package/dist/{http-pwzeCOpM.cjs → http-B4_JfY6t.cjs} +1079 -450
- package/dist/{http-BDeLFFzK.mjs → http-ClRbCldm.mjs} +1049 -444
- package/dist/index.cjs +3 -1
- package/dist/index.d.cts +156 -22
- package/dist/index.d.mts +156 -22
- package/dist/index.mjs +2 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
const require_http = require('./http-
|
|
1
|
+
const require_http = require('./http-B4_JfY6t.cjs');
|
|
2
2
|
|
|
3
3
|
exports.ConfigFetcherService = require_http.ConfigFetcherService;
|
|
4
|
+
exports.DefinitionsCacheService = require_http.DefinitionsCacheService;
|
|
4
5
|
exports.DescribeToolsTool = require_http.DescribeToolsTool;
|
|
5
6
|
exports.HttpTransportHandler = require_http.HttpTransportHandler;
|
|
6
7
|
exports.McpClientManagerService = require_http.McpClientManagerService;
|
|
8
|
+
exports.SearchListToolsTool = require_http.SearchListToolsTool;
|
|
7
9
|
exports.SkillService = require_http.SkillService;
|
|
8
10
|
exports.SseTransportHandler = require_http.SseTransportHandler;
|
|
9
11
|
exports.StdioTransportHandler = require_http.StdioTransportHandler;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
2
2
|
import { CallToolResult, GetPromptResult, ReadResourceResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
3
|
|
|
4
|
-
//#region src/server/index.d.ts
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Configuration options for creating an MCP server instance
|
|
8
|
-
* @property configFilePath - Path to the MCP configuration file
|
|
9
|
-
* @property noCache - Skip cache when fetching remote configuration
|
|
10
|
-
* @property skills - Skills configuration with paths array (optional, skills disabled if not provided)
|
|
11
|
-
* @property serverId - CLI-provided server ID (takes precedence over config file id)
|
|
12
|
-
*/
|
|
13
|
-
interface ServerOptions {
|
|
14
|
-
configFilePath?: string;
|
|
15
|
-
noCache?: boolean;
|
|
16
|
-
skills?: {
|
|
17
|
-
paths: string[];
|
|
18
|
-
};
|
|
19
|
-
serverId?: string;
|
|
20
|
-
}
|
|
21
|
-
declare function createServer(options?: ServerOptions): Promise<Server>;
|
|
22
|
-
//#endregion
|
|
23
4
|
//#region src/types/index.d.ts
|
|
5
|
+
|
|
24
6
|
/**
|
|
25
7
|
* Tool definition for MCP
|
|
26
8
|
* @property name - The unique name of the tool
|
|
@@ -36,6 +18,7 @@ interface ToolDefinition {
|
|
|
36
18
|
required?: string[];
|
|
37
19
|
additionalProperties?: boolean;
|
|
38
20
|
};
|
|
21
|
+
_meta?: Record<string, unknown>;
|
|
39
22
|
}
|
|
40
23
|
/**
|
|
41
24
|
* Base tool interface following MCP SDK patterns
|
|
@@ -195,6 +178,7 @@ interface McpToolInfo {
|
|
|
195
178
|
name: string;
|
|
196
179
|
description?: string;
|
|
197
180
|
inputSchema: Record<string, unknown>;
|
|
181
|
+
_meta?: Record<string, unknown>;
|
|
198
182
|
}
|
|
199
183
|
/**
|
|
200
184
|
* MCP resource information returned from listResources
|
|
@@ -255,6 +239,54 @@ interface McpClientConnection {
|
|
|
255
239
|
/** Close the connection */
|
|
256
240
|
close(): Promise<void>;
|
|
257
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Cached prompt-based skill metadata.
|
|
244
|
+
* Used to avoid re-fetching prompt front matter during startup discovery.
|
|
245
|
+
*/
|
|
246
|
+
interface CachedPromptSkillInfo {
|
|
247
|
+
promptName: string;
|
|
248
|
+
skill: PromptSkillConfig;
|
|
249
|
+
autoDetected?: boolean;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Cached server metadata used for startup-time capability discovery.
|
|
253
|
+
*/
|
|
254
|
+
interface CachedServerDefinition {
|
|
255
|
+
serverName: string;
|
|
256
|
+
serverInstruction?: string;
|
|
257
|
+
omitToolDescription?: boolean;
|
|
258
|
+
toolBlacklist?: string[];
|
|
259
|
+
tools: McpToolInfo[];
|
|
260
|
+
resources: McpResourceInfo[];
|
|
261
|
+
prompts: McpPromptInfo[];
|
|
262
|
+
promptSkills: CachedPromptSkillInfo[];
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Cached file-based skill metadata.
|
|
266
|
+
*/
|
|
267
|
+
interface CachedFileSkillInfo {
|
|
268
|
+
name: string;
|
|
269
|
+
description: string;
|
|
270
|
+
location: 'project' | 'user';
|
|
271
|
+
basePath: string;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Cache file storing precomputed definitions for one-mcp startup.
|
|
275
|
+
*/
|
|
276
|
+
interface DefinitionsCacheFile {
|
|
277
|
+
version: 1;
|
|
278
|
+
oneMcpVersion?: string;
|
|
279
|
+
generatedAt: string;
|
|
280
|
+
configPath?: string;
|
|
281
|
+
configHash?: string;
|
|
282
|
+
serverId?: string;
|
|
283
|
+
servers: Record<string, CachedServerDefinition>;
|
|
284
|
+
skills: CachedFileSkillInfo[];
|
|
285
|
+
failures: Array<{
|
|
286
|
+
serverName: string;
|
|
287
|
+
error: string;
|
|
288
|
+
}>;
|
|
289
|
+
}
|
|
258
290
|
/**
|
|
259
291
|
* Skill metadata from YAML frontmatter in SKILL.md files
|
|
260
292
|
* @property name - Skill identifier used with skill__ prefix
|
|
@@ -282,6 +314,27 @@ interface Skill {
|
|
|
282
314
|
basePath: string;
|
|
283
315
|
}
|
|
284
316
|
//#endregion
|
|
317
|
+
//#region src/server/index.d.ts
|
|
318
|
+
/**
|
|
319
|
+
* Configuration options for creating an MCP server instance
|
|
320
|
+
* @property configFilePath - Path to the MCP configuration file
|
|
321
|
+
* @property noCache - Skip cache when fetching remote configuration
|
|
322
|
+
* @property skills - Skills configuration with paths array (optional, skills disabled if not provided)
|
|
323
|
+
* @property serverId - CLI-provided server ID (takes precedence over config file id)
|
|
324
|
+
*/
|
|
325
|
+
interface ServerOptions {
|
|
326
|
+
configFilePath?: string;
|
|
327
|
+
noCache?: boolean;
|
|
328
|
+
skills?: {
|
|
329
|
+
paths: string[];
|
|
330
|
+
};
|
|
331
|
+
serverId?: string;
|
|
332
|
+
definitionsCachePath?: string;
|
|
333
|
+
clearDefinitionsCache?: boolean;
|
|
334
|
+
proxyMode?: 'meta' | 'flat' | 'search';
|
|
335
|
+
}
|
|
336
|
+
declare function createServer(options?: ServerOptions): Promise<Server>;
|
|
337
|
+
//#endregion
|
|
285
338
|
//#region src/transports/stdio.d.ts
|
|
286
339
|
/**
|
|
287
340
|
* Stdio transport handler for MCP server
|
|
@@ -347,6 +400,8 @@ declare class HttpTransportHandler implements HttpTransportHandler$1 {
|
|
|
347
400
|
*/
|
|
348
401
|
declare class McpClientManagerService {
|
|
349
402
|
private clients;
|
|
403
|
+
private serverConfigs;
|
|
404
|
+
private connectionPromises;
|
|
350
405
|
constructor();
|
|
351
406
|
/**
|
|
352
407
|
* Cleanup all resources on exit (child processes)
|
|
@@ -357,6 +412,10 @@ declare class McpClientManagerService {
|
|
|
357
412
|
* Uses the timeout from server config, falling back to default (30s)
|
|
358
413
|
*/
|
|
359
414
|
connectToServer(serverName: string, config: McpServerConfig): Promise<void>;
|
|
415
|
+
registerServerConfigs(configs: Record<string, McpServerConfig>): void;
|
|
416
|
+
getKnownServerNames(): string[];
|
|
417
|
+
ensureConnected(serverName: string): Promise<McpClientConnection>;
|
|
418
|
+
private createConnection;
|
|
360
419
|
/**
|
|
361
420
|
* Perform the actual connection to MCP server
|
|
362
421
|
*/
|
|
@@ -413,6 +472,8 @@ declare class SkillService {
|
|
|
413
472
|
private skillsByName;
|
|
414
473
|
/** Active file watchers for skill directories */
|
|
415
474
|
private watchers;
|
|
475
|
+
/** Polling timers used when native file watching is unavailable */
|
|
476
|
+
private pollingTimers;
|
|
416
477
|
/** Callback invoked when cache is invalidated due to file changes */
|
|
417
478
|
private onCacheInvalidated?;
|
|
418
479
|
/**
|
|
@@ -472,6 +533,12 @@ declare class SkillService {
|
|
|
472
533
|
* @param signal - AbortSignal to stop watching
|
|
473
534
|
*/
|
|
474
535
|
private watchDirectory;
|
|
536
|
+
private invalidateCache;
|
|
537
|
+
private isWatchResourceLimitError;
|
|
538
|
+
private startPollingDirectory;
|
|
539
|
+
private createSkillSnapshot;
|
|
540
|
+
private collectSkillSnapshots;
|
|
541
|
+
private snapshotsEqual;
|
|
475
542
|
/**
|
|
476
543
|
* Load skills from a directory.
|
|
477
544
|
* Supports both flat structure (SKILL.md) and nested structure (name/SKILL.md).
|
|
@@ -505,6 +572,56 @@ declare class SkillService {
|
|
|
505
572
|
private loadSkillFile;
|
|
506
573
|
}
|
|
507
574
|
//#endregion
|
|
575
|
+
//#region src/services/DefinitionsCacheService.d.ts
|
|
576
|
+
interface DefinitionsCacheServiceOptions {
|
|
577
|
+
cacheData?: DefinitionsCacheFile;
|
|
578
|
+
}
|
|
579
|
+
interface PromptSkillMatch {
|
|
580
|
+
serverName: string;
|
|
581
|
+
promptName: string;
|
|
582
|
+
skill: PromptSkillConfig;
|
|
583
|
+
autoDetected?: boolean;
|
|
584
|
+
}
|
|
585
|
+
interface CollectOptions {
|
|
586
|
+
serverId?: string;
|
|
587
|
+
configPath?: string;
|
|
588
|
+
configHash?: string;
|
|
589
|
+
oneMcpVersion?: string;
|
|
590
|
+
}
|
|
591
|
+
declare class DefinitionsCacheService {
|
|
592
|
+
private clientManager;
|
|
593
|
+
private skillService?;
|
|
594
|
+
private cacheData?;
|
|
595
|
+
private liveDefinitionsPromise;
|
|
596
|
+
private mergedDefinitionsPromise;
|
|
597
|
+
constructor(clientManager: McpClientManagerService, skillService?: SkillService, options?: DefinitionsCacheServiceOptions);
|
|
598
|
+
static readFromFile(filePath: string): Promise<DefinitionsCacheFile>;
|
|
599
|
+
static writeToFile(filePath: string, cache: DefinitionsCacheFile): Promise<void>;
|
|
600
|
+
static getDefaultCachePath(configFilePath: string): string;
|
|
601
|
+
static generateConfigHash(config: unknown): string;
|
|
602
|
+
static isCacheValid(cache: DefinitionsCacheFile, options: {
|
|
603
|
+
configHash?: string;
|
|
604
|
+
oneMcpVersion?: string;
|
|
605
|
+
}): boolean;
|
|
606
|
+
static clearFile(filePath: string): Promise<void>;
|
|
607
|
+
clearLiveCache(): void;
|
|
608
|
+
setCacheData(cacheData?: DefinitionsCacheFile): void;
|
|
609
|
+
collectForCache(options?: CollectOptions): Promise<DefinitionsCacheFile>;
|
|
610
|
+
getDefinitions(): Promise<DefinitionsCacheFile>;
|
|
611
|
+
getServerDefinitions(): Promise<CachedServerDefinition[]>;
|
|
612
|
+
getServersForTool(toolName: string): Promise<string[]>;
|
|
613
|
+
getServersForResource(uri: string): Promise<string[]>;
|
|
614
|
+
getPromptSkillByName(skillName: string): Promise<PromptSkillMatch | undefined>;
|
|
615
|
+
getCachedFileSkills(): Promise<CachedFileSkillInfo[]>;
|
|
616
|
+
private getLiveDefinitions;
|
|
617
|
+
private collectLiveDefinitions;
|
|
618
|
+
private collectFileSkills;
|
|
619
|
+
private toCachedFileSkill;
|
|
620
|
+
private listPromptsSafe;
|
|
621
|
+
private listResourcesSafe;
|
|
622
|
+
private collectPromptSkillsForClient;
|
|
623
|
+
}
|
|
624
|
+
//#endregion
|
|
508
625
|
//#region src/tools/DescribeToolsTool.d.ts
|
|
509
626
|
/**
|
|
510
627
|
* Input schema for the DescribeToolsTool
|
|
@@ -534,6 +651,7 @@ declare class DescribeToolsTool implements Tool<DescribeToolsToolInput> {
|
|
|
534
651
|
static readonly TOOL_NAME = "describe_tools";
|
|
535
652
|
private clientManager;
|
|
536
653
|
private skillService;
|
|
654
|
+
private definitionsCacheService;
|
|
537
655
|
private readonly liquid;
|
|
538
656
|
/** Cache for auto-detected skills from prompt front-matter */
|
|
539
657
|
private autoDetectedSkillsCache;
|
|
@@ -545,7 +663,7 @@ declare class DescribeToolsTool implements Tool<DescribeToolsToolInput> {
|
|
|
545
663
|
* @param skillService - Optional skill service for loading skills
|
|
546
664
|
* @param serverId - Unique server identifier for this one-mcp instance
|
|
547
665
|
*/
|
|
548
|
-
constructor(clientManager: McpClientManagerService, skillService?: SkillService, serverId?: string);
|
|
666
|
+
constructor(clientManager: McpClientManagerService, skillService?: SkillService, serverId?: string, definitionsCacheService?: DefinitionsCacheService);
|
|
549
667
|
/**
|
|
550
668
|
* Clears the cached auto-detected skills from prompt front-matter.
|
|
551
669
|
* Use this when prompt configurations may have changed or when
|
|
@@ -632,6 +750,21 @@ declare class DescribeToolsTool implements Tool<DescribeToolsToolInput> {
|
|
|
632
750
|
execute(input: DescribeToolsToolInput): Promise<CallToolResult>;
|
|
633
751
|
}
|
|
634
752
|
//#endregion
|
|
753
|
+
//#region src/tools/SearchListToolsTool.d.ts
|
|
754
|
+
interface SearchListToolsToolInput {
|
|
755
|
+
capability?: string;
|
|
756
|
+
serverName?: string;
|
|
757
|
+
}
|
|
758
|
+
declare class SearchListToolsTool implements Tool<SearchListToolsToolInput> {
|
|
759
|
+
private readonly _clientManager;
|
|
760
|
+
private readonly definitionsCacheService;
|
|
761
|
+
static readonly TOOL_NAME = "list_tools";
|
|
762
|
+
constructor(_clientManager: unknown, definitionsCacheService: DefinitionsCacheService);
|
|
763
|
+
private formatToolName;
|
|
764
|
+
getDefinition(): Promise<ToolDefinition>;
|
|
765
|
+
execute(input: SearchListToolsToolInput): Promise<CallToolResult>;
|
|
766
|
+
}
|
|
767
|
+
//#endregion
|
|
635
768
|
//#region src/tools/UseToolTool.d.ts
|
|
636
769
|
/**
|
|
637
770
|
* Input schema for UseToolTool
|
|
@@ -659,6 +792,7 @@ declare class UseToolTool implements Tool<UseToolToolInput> {
|
|
|
659
792
|
static readonly TOOL_NAME = "use_tool";
|
|
660
793
|
private clientManager;
|
|
661
794
|
private skillService;
|
|
795
|
+
private definitionsCacheService;
|
|
662
796
|
/** Unique server identifier for this one-mcp instance */
|
|
663
797
|
private serverId;
|
|
664
798
|
/**
|
|
@@ -667,7 +801,7 @@ declare class UseToolTool implements Tool<UseToolToolInput> {
|
|
|
667
801
|
* @param skillService - Optional skill service for loading and executing skills
|
|
668
802
|
* @param serverId - Unique server identifier for this one-mcp instance
|
|
669
803
|
*/
|
|
670
|
-
constructor(clientManager: McpClientManagerService, skillService?: SkillService, serverId?: string);
|
|
804
|
+
constructor(clientManager: McpClientManagerService, skillService?: SkillService, serverId?: string, definitionsCacheService?: DefinitionsCacheService);
|
|
671
805
|
/**
|
|
672
806
|
* Returns the MCP tool definition with name, description, and input schema.
|
|
673
807
|
*
|
|
@@ -792,4 +926,4 @@ declare class ConfigFetcherService {
|
|
|
792
926
|
isCacheValid(): boolean;
|
|
793
927
|
}
|
|
794
928
|
//#endregion
|
|
795
|
-
export { ConfigFetcherService, DescribeToolsTool, HttpTransportHandler, McpClientConnection, McpClientManagerService, McpHttpConfig, McpPromptInfo, McpResourceInfo, McpServerConfig, McpServerTransportConfig, McpServerTransportType, McpSseConfig, McpStdioConfig, McpToolInfo, PromptConfig, PromptSkillConfig, RemoteMcpConfiguration, type ServerOptions, Skill, SkillMetadata, SkillService, SkillsConfig, SseTransportHandler, StdioTransportHandler, TRANSPORT_MODE, Tool, ToolDefinition, TransportConfig, TransportHandler, TransportMode, UseToolTool, createServer };
|
|
929
|
+
export { CachedFileSkillInfo, CachedPromptSkillInfo, CachedServerDefinition, ConfigFetcherService, DefinitionsCacheFile, DefinitionsCacheService, DescribeToolsTool, HttpTransportHandler, McpClientConnection, McpClientManagerService, McpHttpConfig, McpPromptInfo, McpResourceInfo, McpServerConfig, McpServerTransportConfig, McpServerTransportType, McpSseConfig, McpStdioConfig, McpToolInfo, PromptConfig, PromptSkillConfig, RemoteMcpConfiguration, SearchListToolsTool, type ServerOptions, Skill, SkillMetadata, SkillService, SkillsConfig, SseTransportHandler, StdioTransportHandler, TRANSPORT_MODE, Tool, ToolDefinition, TransportConfig, TransportHandler, TransportMode, UseToolTool, createServer };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
2
2
|
import { CallToolResult, GetPromptResult, ReadResourceResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
3
|
|
|
4
|
-
//#region src/server/index.d.ts
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Configuration options for creating an MCP server instance
|
|
8
|
-
* @property configFilePath - Path to the MCP configuration file
|
|
9
|
-
* @property noCache - Skip cache when fetching remote configuration
|
|
10
|
-
* @property skills - Skills configuration with paths array (optional, skills disabled if not provided)
|
|
11
|
-
* @property serverId - CLI-provided server ID (takes precedence over config file id)
|
|
12
|
-
*/
|
|
13
|
-
interface ServerOptions {
|
|
14
|
-
configFilePath?: string;
|
|
15
|
-
noCache?: boolean;
|
|
16
|
-
skills?: {
|
|
17
|
-
paths: string[];
|
|
18
|
-
};
|
|
19
|
-
serverId?: string;
|
|
20
|
-
}
|
|
21
|
-
declare function createServer(options?: ServerOptions): Promise<Server>;
|
|
22
|
-
//#endregion
|
|
23
4
|
//#region src/types/index.d.ts
|
|
5
|
+
|
|
24
6
|
/**
|
|
25
7
|
* Tool definition for MCP
|
|
26
8
|
* @property name - The unique name of the tool
|
|
@@ -36,6 +18,7 @@ interface ToolDefinition {
|
|
|
36
18
|
required?: string[];
|
|
37
19
|
additionalProperties?: boolean;
|
|
38
20
|
};
|
|
21
|
+
_meta?: Record<string, unknown>;
|
|
39
22
|
}
|
|
40
23
|
/**
|
|
41
24
|
* Base tool interface following MCP SDK patterns
|
|
@@ -195,6 +178,7 @@ interface McpToolInfo {
|
|
|
195
178
|
name: string;
|
|
196
179
|
description?: string;
|
|
197
180
|
inputSchema: Record<string, unknown>;
|
|
181
|
+
_meta?: Record<string, unknown>;
|
|
198
182
|
}
|
|
199
183
|
/**
|
|
200
184
|
* MCP resource information returned from listResources
|
|
@@ -255,6 +239,54 @@ interface McpClientConnection {
|
|
|
255
239
|
/** Close the connection */
|
|
256
240
|
close(): Promise<void>;
|
|
257
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Cached prompt-based skill metadata.
|
|
244
|
+
* Used to avoid re-fetching prompt front matter during startup discovery.
|
|
245
|
+
*/
|
|
246
|
+
interface CachedPromptSkillInfo {
|
|
247
|
+
promptName: string;
|
|
248
|
+
skill: PromptSkillConfig;
|
|
249
|
+
autoDetected?: boolean;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Cached server metadata used for startup-time capability discovery.
|
|
253
|
+
*/
|
|
254
|
+
interface CachedServerDefinition {
|
|
255
|
+
serverName: string;
|
|
256
|
+
serverInstruction?: string;
|
|
257
|
+
omitToolDescription?: boolean;
|
|
258
|
+
toolBlacklist?: string[];
|
|
259
|
+
tools: McpToolInfo[];
|
|
260
|
+
resources: McpResourceInfo[];
|
|
261
|
+
prompts: McpPromptInfo[];
|
|
262
|
+
promptSkills: CachedPromptSkillInfo[];
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Cached file-based skill metadata.
|
|
266
|
+
*/
|
|
267
|
+
interface CachedFileSkillInfo {
|
|
268
|
+
name: string;
|
|
269
|
+
description: string;
|
|
270
|
+
location: 'project' | 'user';
|
|
271
|
+
basePath: string;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Cache file storing precomputed definitions for one-mcp startup.
|
|
275
|
+
*/
|
|
276
|
+
interface DefinitionsCacheFile {
|
|
277
|
+
version: 1;
|
|
278
|
+
oneMcpVersion?: string;
|
|
279
|
+
generatedAt: string;
|
|
280
|
+
configPath?: string;
|
|
281
|
+
configHash?: string;
|
|
282
|
+
serverId?: string;
|
|
283
|
+
servers: Record<string, CachedServerDefinition>;
|
|
284
|
+
skills: CachedFileSkillInfo[];
|
|
285
|
+
failures: Array<{
|
|
286
|
+
serverName: string;
|
|
287
|
+
error: string;
|
|
288
|
+
}>;
|
|
289
|
+
}
|
|
258
290
|
/**
|
|
259
291
|
* Skill metadata from YAML frontmatter in SKILL.md files
|
|
260
292
|
* @property name - Skill identifier used with skill__ prefix
|
|
@@ -282,6 +314,27 @@ interface Skill {
|
|
|
282
314
|
basePath: string;
|
|
283
315
|
}
|
|
284
316
|
//#endregion
|
|
317
|
+
//#region src/server/index.d.ts
|
|
318
|
+
/**
|
|
319
|
+
* Configuration options for creating an MCP server instance
|
|
320
|
+
* @property configFilePath - Path to the MCP configuration file
|
|
321
|
+
* @property noCache - Skip cache when fetching remote configuration
|
|
322
|
+
* @property skills - Skills configuration with paths array (optional, skills disabled if not provided)
|
|
323
|
+
* @property serverId - CLI-provided server ID (takes precedence over config file id)
|
|
324
|
+
*/
|
|
325
|
+
interface ServerOptions {
|
|
326
|
+
configFilePath?: string;
|
|
327
|
+
noCache?: boolean;
|
|
328
|
+
skills?: {
|
|
329
|
+
paths: string[];
|
|
330
|
+
};
|
|
331
|
+
serverId?: string;
|
|
332
|
+
definitionsCachePath?: string;
|
|
333
|
+
clearDefinitionsCache?: boolean;
|
|
334
|
+
proxyMode?: 'meta' | 'flat' | 'search';
|
|
335
|
+
}
|
|
336
|
+
declare function createServer(options?: ServerOptions): Promise<Server>;
|
|
337
|
+
//#endregion
|
|
285
338
|
//#region src/transports/stdio.d.ts
|
|
286
339
|
/**
|
|
287
340
|
* Stdio transport handler for MCP server
|
|
@@ -347,6 +400,8 @@ declare class HttpTransportHandler implements HttpTransportHandler$1 {
|
|
|
347
400
|
*/
|
|
348
401
|
declare class McpClientManagerService {
|
|
349
402
|
private clients;
|
|
403
|
+
private serverConfigs;
|
|
404
|
+
private connectionPromises;
|
|
350
405
|
constructor();
|
|
351
406
|
/**
|
|
352
407
|
* Cleanup all resources on exit (child processes)
|
|
@@ -357,6 +412,10 @@ declare class McpClientManagerService {
|
|
|
357
412
|
* Uses the timeout from server config, falling back to default (30s)
|
|
358
413
|
*/
|
|
359
414
|
connectToServer(serverName: string, config: McpServerConfig): Promise<void>;
|
|
415
|
+
registerServerConfigs(configs: Record<string, McpServerConfig>): void;
|
|
416
|
+
getKnownServerNames(): string[];
|
|
417
|
+
ensureConnected(serverName: string): Promise<McpClientConnection>;
|
|
418
|
+
private createConnection;
|
|
360
419
|
/**
|
|
361
420
|
* Perform the actual connection to MCP server
|
|
362
421
|
*/
|
|
@@ -413,6 +472,8 @@ declare class SkillService {
|
|
|
413
472
|
private skillsByName;
|
|
414
473
|
/** Active file watchers for skill directories */
|
|
415
474
|
private watchers;
|
|
475
|
+
/** Polling timers used when native file watching is unavailable */
|
|
476
|
+
private pollingTimers;
|
|
416
477
|
/** Callback invoked when cache is invalidated due to file changes */
|
|
417
478
|
private onCacheInvalidated?;
|
|
418
479
|
/**
|
|
@@ -472,6 +533,12 @@ declare class SkillService {
|
|
|
472
533
|
* @param signal - AbortSignal to stop watching
|
|
473
534
|
*/
|
|
474
535
|
private watchDirectory;
|
|
536
|
+
private invalidateCache;
|
|
537
|
+
private isWatchResourceLimitError;
|
|
538
|
+
private startPollingDirectory;
|
|
539
|
+
private createSkillSnapshot;
|
|
540
|
+
private collectSkillSnapshots;
|
|
541
|
+
private snapshotsEqual;
|
|
475
542
|
/**
|
|
476
543
|
* Load skills from a directory.
|
|
477
544
|
* Supports both flat structure (SKILL.md) and nested structure (name/SKILL.md).
|
|
@@ -505,6 +572,56 @@ declare class SkillService {
|
|
|
505
572
|
private loadSkillFile;
|
|
506
573
|
}
|
|
507
574
|
//#endregion
|
|
575
|
+
//#region src/services/DefinitionsCacheService.d.ts
|
|
576
|
+
interface DefinitionsCacheServiceOptions {
|
|
577
|
+
cacheData?: DefinitionsCacheFile;
|
|
578
|
+
}
|
|
579
|
+
interface PromptSkillMatch {
|
|
580
|
+
serverName: string;
|
|
581
|
+
promptName: string;
|
|
582
|
+
skill: PromptSkillConfig;
|
|
583
|
+
autoDetected?: boolean;
|
|
584
|
+
}
|
|
585
|
+
interface CollectOptions {
|
|
586
|
+
serverId?: string;
|
|
587
|
+
configPath?: string;
|
|
588
|
+
configHash?: string;
|
|
589
|
+
oneMcpVersion?: string;
|
|
590
|
+
}
|
|
591
|
+
declare class DefinitionsCacheService {
|
|
592
|
+
private clientManager;
|
|
593
|
+
private skillService?;
|
|
594
|
+
private cacheData?;
|
|
595
|
+
private liveDefinitionsPromise;
|
|
596
|
+
private mergedDefinitionsPromise;
|
|
597
|
+
constructor(clientManager: McpClientManagerService, skillService?: SkillService, options?: DefinitionsCacheServiceOptions);
|
|
598
|
+
static readFromFile(filePath: string): Promise<DefinitionsCacheFile>;
|
|
599
|
+
static writeToFile(filePath: string, cache: DefinitionsCacheFile): Promise<void>;
|
|
600
|
+
static getDefaultCachePath(configFilePath: string): string;
|
|
601
|
+
static generateConfigHash(config: unknown): string;
|
|
602
|
+
static isCacheValid(cache: DefinitionsCacheFile, options: {
|
|
603
|
+
configHash?: string;
|
|
604
|
+
oneMcpVersion?: string;
|
|
605
|
+
}): boolean;
|
|
606
|
+
static clearFile(filePath: string): Promise<void>;
|
|
607
|
+
clearLiveCache(): void;
|
|
608
|
+
setCacheData(cacheData?: DefinitionsCacheFile): void;
|
|
609
|
+
collectForCache(options?: CollectOptions): Promise<DefinitionsCacheFile>;
|
|
610
|
+
getDefinitions(): Promise<DefinitionsCacheFile>;
|
|
611
|
+
getServerDefinitions(): Promise<CachedServerDefinition[]>;
|
|
612
|
+
getServersForTool(toolName: string): Promise<string[]>;
|
|
613
|
+
getServersForResource(uri: string): Promise<string[]>;
|
|
614
|
+
getPromptSkillByName(skillName: string): Promise<PromptSkillMatch | undefined>;
|
|
615
|
+
getCachedFileSkills(): Promise<CachedFileSkillInfo[]>;
|
|
616
|
+
private getLiveDefinitions;
|
|
617
|
+
private collectLiveDefinitions;
|
|
618
|
+
private collectFileSkills;
|
|
619
|
+
private toCachedFileSkill;
|
|
620
|
+
private listPromptsSafe;
|
|
621
|
+
private listResourcesSafe;
|
|
622
|
+
private collectPromptSkillsForClient;
|
|
623
|
+
}
|
|
624
|
+
//#endregion
|
|
508
625
|
//#region src/tools/DescribeToolsTool.d.ts
|
|
509
626
|
/**
|
|
510
627
|
* Input schema for the DescribeToolsTool
|
|
@@ -534,6 +651,7 @@ declare class DescribeToolsTool implements Tool<DescribeToolsToolInput> {
|
|
|
534
651
|
static readonly TOOL_NAME = "describe_tools";
|
|
535
652
|
private clientManager;
|
|
536
653
|
private skillService;
|
|
654
|
+
private definitionsCacheService;
|
|
537
655
|
private readonly liquid;
|
|
538
656
|
/** Cache for auto-detected skills from prompt front-matter */
|
|
539
657
|
private autoDetectedSkillsCache;
|
|
@@ -545,7 +663,7 @@ declare class DescribeToolsTool implements Tool<DescribeToolsToolInput> {
|
|
|
545
663
|
* @param skillService - Optional skill service for loading skills
|
|
546
664
|
* @param serverId - Unique server identifier for this one-mcp instance
|
|
547
665
|
*/
|
|
548
|
-
constructor(clientManager: McpClientManagerService, skillService?: SkillService, serverId?: string);
|
|
666
|
+
constructor(clientManager: McpClientManagerService, skillService?: SkillService, serverId?: string, definitionsCacheService?: DefinitionsCacheService);
|
|
549
667
|
/**
|
|
550
668
|
* Clears the cached auto-detected skills from prompt front-matter.
|
|
551
669
|
* Use this when prompt configurations may have changed or when
|
|
@@ -632,6 +750,21 @@ declare class DescribeToolsTool implements Tool<DescribeToolsToolInput> {
|
|
|
632
750
|
execute(input: DescribeToolsToolInput): Promise<CallToolResult>;
|
|
633
751
|
}
|
|
634
752
|
//#endregion
|
|
753
|
+
//#region src/tools/SearchListToolsTool.d.ts
|
|
754
|
+
interface SearchListToolsToolInput {
|
|
755
|
+
capability?: string;
|
|
756
|
+
serverName?: string;
|
|
757
|
+
}
|
|
758
|
+
declare class SearchListToolsTool implements Tool<SearchListToolsToolInput> {
|
|
759
|
+
private readonly _clientManager;
|
|
760
|
+
private readonly definitionsCacheService;
|
|
761
|
+
static readonly TOOL_NAME = "list_tools";
|
|
762
|
+
constructor(_clientManager: unknown, definitionsCacheService: DefinitionsCacheService);
|
|
763
|
+
private formatToolName;
|
|
764
|
+
getDefinition(): Promise<ToolDefinition>;
|
|
765
|
+
execute(input: SearchListToolsToolInput): Promise<CallToolResult>;
|
|
766
|
+
}
|
|
767
|
+
//#endregion
|
|
635
768
|
//#region src/tools/UseToolTool.d.ts
|
|
636
769
|
/**
|
|
637
770
|
* Input schema for UseToolTool
|
|
@@ -659,6 +792,7 @@ declare class UseToolTool implements Tool<UseToolToolInput> {
|
|
|
659
792
|
static readonly TOOL_NAME = "use_tool";
|
|
660
793
|
private clientManager;
|
|
661
794
|
private skillService;
|
|
795
|
+
private definitionsCacheService;
|
|
662
796
|
/** Unique server identifier for this one-mcp instance */
|
|
663
797
|
private serverId;
|
|
664
798
|
/**
|
|
@@ -667,7 +801,7 @@ declare class UseToolTool implements Tool<UseToolToolInput> {
|
|
|
667
801
|
* @param skillService - Optional skill service for loading and executing skills
|
|
668
802
|
* @param serverId - Unique server identifier for this one-mcp instance
|
|
669
803
|
*/
|
|
670
|
-
constructor(clientManager: McpClientManagerService, skillService?: SkillService, serverId?: string);
|
|
804
|
+
constructor(clientManager: McpClientManagerService, skillService?: SkillService, serverId?: string, definitionsCacheService?: DefinitionsCacheService);
|
|
671
805
|
/**
|
|
672
806
|
* Returns the MCP tool definition with name, description, and input schema.
|
|
673
807
|
*
|
|
@@ -792,4 +926,4 @@ declare class ConfigFetcherService {
|
|
|
792
926
|
isCacheValid(): boolean;
|
|
793
927
|
}
|
|
794
928
|
//#endregion
|
|
795
|
-
export { ConfigFetcherService, DescribeToolsTool, HttpTransportHandler, McpClientConnection, McpClientManagerService, McpHttpConfig, McpPromptInfo, McpResourceInfo, McpServerConfig, McpServerTransportConfig, McpServerTransportType, McpSseConfig, McpStdioConfig, McpToolInfo, PromptConfig, PromptSkillConfig, RemoteMcpConfiguration, type ServerOptions, Skill, SkillMetadata, SkillService, SkillsConfig, SseTransportHandler, StdioTransportHandler, TRANSPORT_MODE, Tool, ToolDefinition, TransportConfig, TransportHandler, TransportMode, UseToolTool, createServer };
|
|
929
|
+
export { CachedFileSkillInfo, CachedPromptSkillInfo, CachedServerDefinition, ConfigFetcherService, DefinitionsCacheFile, DefinitionsCacheService, DescribeToolsTool, HttpTransportHandler, McpClientConnection, McpClientManagerService, McpHttpConfig, McpPromptInfo, McpResourceInfo, McpServerConfig, McpServerTransportConfig, McpServerTransportType, McpSseConfig, McpStdioConfig, McpToolInfo, PromptConfig, PromptSkillConfig, RemoteMcpConfiguration, SearchListToolsTool, type ServerOptions, Skill, SkillMetadata, SkillService, SkillsConfig, SseTransportHandler, StdioTransportHandler, TRANSPORT_MODE, Tool, ToolDefinition, TransportConfig, TransportHandler, TransportMode, UseToolTool, createServer };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as DescribeToolsTool, d as DefinitionsCacheService, i as createServer, l as SkillService, m as ConfigFetcherService, n as SseTransportHandler, o as UseToolTool, r as StdioTransportHandler, s as SearchListToolsTool, t as HttpTransportHandler, u as McpClientManagerService } from "./http-ClRbCldm.mjs";
|
|
2
2
|
|
|
3
|
-
export { ConfigFetcherService, DescribeToolsTool, HttpTransportHandler, McpClientManagerService, SkillService, SseTransportHandler, StdioTransportHandler, UseToolTool, createServer };
|
|
3
|
+
export { ConfigFetcherService, DefinitionsCacheService, DescribeToolsTool, HttpTransportHandler, McpClientManagerService, SearchListToolsTool, SkillService, SseTransportHandler, StdioTransportHandler, UseToolTool, createServer };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agiflowai/one-mcp",
|
|
3
3
|
"description": "One MCP server package",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.12",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"mcp",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"js-yaml": "^4.1.0",
|
|
28
28
|
"liquidjs": "^10.21.0",
|
|
29
29
|
"zod": "^3.24.1",
|
|
30
|
-
"@agiflowai/aicode-utils": "1.0.
|
|
30
|
+
"@agiflowai/aicode-utils": "1.0.17"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/express": "^5.0.0",
|