@agiflowai/one-mcp 0.2.4 → 0.2.5

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/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_http = require('./http-3v8zyDO3.cjs');
1
+ const require_http = require('./http-Q8LPwwwP.cjs');
2
2
 
3
3
  exports.HttpTransportHandler = require_http.HttpTransportHandler;
4
4
  exports.SseTransportHandler = require_http.SseTransportHandler;
package/dist/index.d.cts CHANGED
@@ -1,45 +1,65 @@
1
1
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
2
- import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
2
+ import { CallToolResult, GetPromptResult, ReadResourceResult } from "@modelcontextprotocol/sdk/types.js";
3
3
 
4
4
  //#region src/server/index.d.ts
5
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
+ */
6
12
  interface ServerOptions {
7
13
  configFilePath?: string;
8
14
  noCache?: boolean;
15
+ skills?: {
16
+ paths: string[];
17
+ };
9
18
  }
10
19
  declare function createServer(options?: ServerOptions): Promise<Server>;
11
20
  //#endregion
12
21
  //#region src/types/index.d.ts
13
22
  /**
14
23
  * Tool definition for MCP
24
+ * @property name - The unique name of the tool
25
+ * @property description - Human-readable description of what the tool does
26
+ * @property inputSchema - JSON Schema defining the tool's input parameters
15
27
  */
16
28
  interface ToolDefinition {
17
29
  name: string;
18
30
  description: string;
19
31
  inputSchema: {
20
32
  type: string;
21
- properties: Record<string, any>;
33
+ properties: Record<string, unknown>;
22
34
  required?: string[];
23
35
  additionalProperties?: boolean;
24
36
  };
25
37
  }
26
38
  /**
27
39
  * Base tool interface following MCP SDK patterns
40
+ * @template TInput - The type of input the tool accepts
28
41
  */
29
- interface Tool<TInput = any> {
42
+ interface Tool<TInput = unknown> {
30
43
  getDefinition(): ToolDefinition | Promise<ToolDefinition>;
31
44
  execute(input: TInput): Promise<CallToolResult>;
32
45
  }
33
46
  /**
34
- * Transport mode types
47
+ * Transport mode constants
35
48
  */
36
- declare enum TransportMode {
37
- STDIO = "stdio",
38
- HTTP = "http",
39
- SSE = "sse",
40
- }
49
+ declare const TRANSPORT_MODE: {
50
+ readonly STDIO: "stdio";
51
+ readonly HTTP: "http";
52
+ readonly SSE: "sse";
53
+ };
54
+ /**
55
+ * Transport mode type derived from TRANSPORT_MODE constants
56
+ */
57
+ type TransportMode = (typeof TRANSPORT_MODE)[keyof typeof TRANSPORT_MODE];
41
58
  /**
42
59
  * Transport configuration options
60
+ * @property mode - The transport mode to use (stdio, http, or sse)
61
+ * @property port - Port number for HTTP/SSE modes (not used for STDIO)
62
+ * @property host - Host address for HTTP/SSE modes (not used for STDIO)
43
63
  */
44
64
  interface TransportConfig {
45
65
  mode: TransportMode;
@@ -64,20 +84,55 @@ interface HttpTransportHandler$1 extends TransportHandler {
64
84
  * Remote MCP server configuration types
65
85
  */
66
86
  type McpServerTransportType = 'stdio' | 'http' | 'sse';
87
+ /**
88
+ * Configuration for stdio-based MCP server connections
89
+ * @property command - The command to execute to start the server
90
+ * @property args - Optional arguments to pass to the command
91
+ * @property env - Optional environment variables for the subprocess
92
+ */
67
93
  interface McpStdioConfig {
68
94
  command: string;
69
95
  args?: string[];
70
96
  env?: Record<string, string>;
71
97
  }
98
+ /**
99
+ * Configuration for HTTP-based MCP server connections
100
+ * @property url - The URL of the HTTP endpoint
101
+ * @property headers - Optional HTTP headers to include in requests
102
+ */
72
103
  interface McpHttpConfig {
73
104
  url: string;
74
105
  headers?: Record<string, string>;
75
106
  }
107
+ /**
108
+ * Configuration for SSE-based MCP server connections
109
+ * @property url - The URL of the SSE endpoint
110
+ * @property headers - Optional HTTP headers to include in requests
111
+ */
76
112
  interface McpSseConfig {
77
113
  url: string;
78
114
  headers?: Record<string, string>;
79
115
  }
116
+ /**
117
+ * Union type for MCP server transport configurations
118
+ * - McpStdioConfig: Used for local subprocess communication via stdio (has 'command' property)
119
+ * - McpHttpConfig: Used for HTTP-based remote connections (has 'url' property)
120
+ * - McpSseConfig: Used for Server-Sent Events streaming connections (has 'url' property)
121
+ *
122
+ * Note: McpHttpConfig and McpSseConfig have identical structure. Discrimination between
123
+ * them should be done using the transport type field in McpServerConfig, not by
124
+ * structural inspection of the config object.
125
+ */
80
126
  type McpServerTransportConfig = McpStdioConfig | McpHttpConfig | McpSseConfig;
127
+ /**
128
+ * Configuration for an MCP server connection
129
+ * @property name - Unique identifier for the server
130
+ * @property instruction - Optional instruction text describing the server's purpose
131
+ * @property toolBlacklist - Optional list of tool names to exclude from this server
132
+ * @property omitToolDescription - Whether to omit tool descriptions in listings
133
+ * @property transport - The transport type (stdio, http, or sse)
134
+ * @property config - Transport-specific configuration options
135
+ */
81
136
  interface McpServerConfig {
82
137
  name: string;
83
138
  instruction?: string;
@@ -87,13 +142,67 @@ interface McpServerConfig {
87
142
  config: McpServerTransportConfig;
88
143
  }
89
144
  /**
90
- * Remote configuration response
145
+ * Skills configuration
146
+ * @property paths - Array of paths to skills directories
147
+ */
148
+ interface SkillsConfig {
149
+ paths: string[];
150
+ }
151
+ /**
152
+ * Remote configuration response containing MCP server definitions
153
+ * @property mcpServers - Map of server names to their configurations
154
+ * @property skills - Optional skills configuration with paths
91
155
  */
92
156
  interface RemoteMcpConfiguration {
93
157
  mcpServers: Record<string, McpServerConfig>;
158
+ skills?: SkillsConfig;
159
+ }
160
+ /**
161
+ * MCP tool information returned from listTools
162
+ * @property name - The tool name
163
+ * @property description - Human-readable description
164
+ * @property inputSchema - JSON Schema for tool inputs
165
+ */
166
+ interface McpToolInfo {
167
+ name: string;
168
+ description?: string;
169
+ inputSchema: Record<string, unknown>;
170
+ }
171
+ /**
172
+ * MCP resource information returned from listResources
173
+ * @property uri - Resource URI
174
+ * @property name - Display name
175
+ * @property description - Human-readable description
176
+ * @property mimeType - Optional MIME type
177
+ */
178
+ interface McpResourceInfo {
179
+ uri: string;
180
+ name?: string;
181
+ description?: string;
182
+ mimeType?: string;
183
+ }
184
+ /**
185
+ * MCP prompt information returned from listPrompts
186
+ * @property name - Prompt name
187
+ * @property description - Human-readable description
188
+ * @property arguments - Optional argument definitions
189
+ */
190
+ interface McpPromptInfo {
191
+ name: string;
192
+ description?: string;
193
+ arguments?: Array<{
194
+ name: string;
195
+ description?: string;
196
+ required?: boolean;
197
+ }>;
94
198
  }
95
199
  /**
96
- * MCP client connection interface
200
+ * MCP client connection interface for communicating with remote MCP servers
201
+ * @property serverName - The name identifier for this server connection
202
+ * @property serverInstruction - Optional instruction text for the server
203
+ * @property toolBlacklist - Optional list of tool names to exclude
204
+ * @property omitToolDescription - Whether to omit tool descriptions
205
+ * @property transport - The transport type used for this connection
97
206
  */
98
207
  interface McpClientConnection {
99
208
  serverName: string;
@@ -101,14 +210,47 @@ interface McpClientConnection {
101
210
  toolBlacklist?: string[];
102
211
  omitToolDescription?: boolean;
103
212
  transport: McpServerTransportType;
104
- listTools(): Promise<any[]>;
105
- listResources(): Promise<any[]>;
106
- listPrompts(): Promise<any[]>;
107
- callTool(name: string, args: any): Promise<any>;
108
- readResource(uri: string): Promise<any>;
109
- getPrompt(name: string, args?: any): Promise<any>;
213
+ /** List available tools from the server */
214
+ listTools(): Promise<McpToolInfo[]>;
215
+ /** List available resources from the server */
216
+ listResources(): Promise<McpResourceInfo[]>;
217
+ /** List available prompts from the server */
218
+ listPrompts(): Promise<McpPromptInfo[]>;
219
+ /** Call a tool with the given name and arguments */
220
+ callTool(name: string, args: Record<string, unknown>): Promise<CallToolResult>;
221
+ /** Read a resource by URI */
222
+ readResource(uri: string): Promise<ReadResourceResult>;
223
+ /** Get a prompt by name with optional arguments */
224
+ getPrompt(name: string, args?: Record<string, unknown>): Promise<GetPromptResult>;
225
+ /** Close the connection */
110
226
  close(): Promise<void>;
111
227
  }
228
+ /**
229
+ * Skill metadata from YAML frontmatter in SKILL.md files
230
+ * @property name - Skill identifier used with skill__ prefix
231
+ * @property description - Short description shown in describe_tools
232
+ * @property license - Optional license information
233
+ */
234
+ interface SkillMetadata {
235
+ name: string;
236
+ description: string;
237
+ license?: string;
238
+ }
239
+ /**
240
+ * Skill definition loaded from skill files
241
+ * @property name - Skill identifier used with skill__ prefix
242
+ * @property description - Short description shown in describe_tools
243
+ * @property location - Where the skill was loaded from ('project' or 'user')
244
+ * @property content - The markdown content of the skill (without frontmatter)
245
+ * @property basePath - The directory path where the skill is located
246
+ */
247
+ interface Skill {
248
+ name: string;
249
+ description: string;
250
+ location: 'project' | 'user';
251
+ content: string;
252
+ basePath: string;
253
+ }
112
254
  //#endregion
113
255
  //#region src/transports/stdio.d.ts
114
256
  /**
@@ -169,4 +311,4 @@ declare class HttpTransportHandler implements HttpTransportHandler$1 {
169
311
  getHost(): string;
170
312
  }
171
313
  //#endregion
172
- export { HttpTransportHandler, McpClientConnection, McpHttpConfig, McpServerConfig, McpServerTransportConfig, McpServerTransportType, McpSseConfig, McpStdioConfig, RemoteMcpConfiguration, type ServerOptions, SseTransportHandler, StdioTransportHandler, Tool, ToolDefinition, TransportConfig, TransportHandler, TransportMode, createServer };
314
+ export { HttpTransportHandler, McpClientConnection, McpHttpConfig, McpPromptInfo, McpResourceInfo, McpServerConfig, McpServerTransportConfig, McpServerTransportType, McpSseConfig, McpStdioConfig, McpToolInfo, RemoteMcpConfiguration, type ServerOptions, Skill, SkillMetadata, SkillsConfig, SseTransportHandler, StdioTransportHandler, TRANSPORT_MODE, Tool, ToolDefinition, TransportConfig, TransportHandler, TransportMode, createServer };
package/dist/index.d.mts CHANGED
@@ -1,45 +1,65 @@
1
1
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
2
- import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
2
+ import { CallToolResult, GetPromptResult, ReadResourceResult } from "@modelcontextprotocol/sdk/types.js";
3
3
 
4
4
  //#region src/server/index.d.ts
5
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
+ */
6
12
  interface ServerOptions {
7
13
  configFilePath?: string;
8
14
  noCache?: boolean;
15
+ skills?: {
16
+ paths: string[];
17
+ };
9
18
  }
10
19
  declare function createServer(options?: ServerOptions): Promise<Server>;
11
20
  //#endregion
12
21
  //#region src/types/index.d.ts
13
22
  /**
14
23
  * Tool definition for MCP
24
+ * @property name - The unique name of the tool
25
+ * @property description - Human-readable description of what the tool does
26
+ * @property inputSchema - JSON Schema defining the tool's input parameters
15
27
  */
16
28
  interface ToolDefinition {
17
29
  name: string;
18
30
  description: string;
19
31
  inputSchema: {
20
32
  type: string;
21
- properties: Record<string, any>;
33
+ properties: Record<string, unknown>;
22
34
  required?: string[];
23
35
  additionalProperties?: boolean;
24
36
  };
25
37
  }
26
38
  /**
27
39
  * Base tool interface following MCP SDK patterns
40
+ * @template TInput - The type of input the tool accepts
28
41
  */
29
- interface Tool<TInput = any> {
42
+ interface Tool<TInput = unknown> {
30
43
  getDefinition(): ToolDefinition | Promise<ToolDefinition>;
31
44
  execute(input: TInput): Promise<CallToolResult>;
32
45
  }
33
46
  /**
34
- * Transport mode types
47
+ * Transport mode constants
35
48
  */
36
- declare enum TransportMode {
37
- STDIO = "stdio",
38
- HTTP = "http",
39
- SSE = "sse",
40
- }
49
+ declare const TRANSPORT_MODE: {
50
+ readonly STDIO: "stdio";
51
+ readonly HTTP: "http";
52
+ readonly SSE: "sse";
53
+ };
54
+ /**
55
+ * Transport mode type derived from TRANSPORT_MODE constants
56
+ */
57
+ type TransportMode = (typeof TRANSPORT_MODE)[keyof typeof TRANSPORT_MODE];
41
58
  /**
42
59
  * Transport configuration options
60
+ * @property mode - The transport mode to use (stdio, http, or sse)
61
+ * @property port - Port number for HTTP/SSE modes (not used for STDIO)
62
+ * @property host - Host address for HTTP/SSE modes (not used for STDIO)
43
63
  */
44
64
  interface TransportConfig {
45
65
  mode: TransportMode;
@@ -64,20 +84,55 @@ interface HttpTransportHandler$1 extends TransportHandler {
64
84
  * Remote MCP server configuration types
65
85
  */
66
86
  type McpServerTransportType = 'stdio' | 'http' | 'sse';
87
+ /**
88
+ * Configuration for stdio-based MCP server connections
89
+ * @property command - The command to execute to start the server
90
+ * @property args - Optional arguments to pass to the command
91
+ * @property env - Optional environment variables for the subprocess
92
+ */
67
93
  interface McpStdioConfig {
68
94
  command: string;
69
95
  args?: string[];
70
96
  env?: Record<string, string>;
71
97
  }
98
+ /**
99
+ * Configuration for HTTP-based MCP server connections
100
+ * @property url - The URL of the HTTP endpoint
101
+ * @property headers - Optional HTTP headers to include in requests
102
+ */
72
103
  interface McpHttpConfig {
73
104
  url: string;
74
105
  headers?: Record<string, string>;
75
106
  }
107
+ /**
108
+ * Configuration for SSE-based MCP server connections
109
+ * @property url - The URL of the SSE endpoint
110
+ * @property headers - Optional HTTP headers to include in requests
111
+ */
76
112
  interface McpSseConfig {
77
113
  url: string;
78
114
  headers?: Record<string, string>;
79
115
  }
116
+ /**
117
+ * Union type for MCP server transport configurations
118
+ * - McpStdioConfig: Used for local subprocess communication via stdio (has 'command' property)
119
+ * - McpHttpConfig: Used for HTTP-based remote connections (has 'url' property)
120
+ * - McpSseConfig: Used for Server-Sent Events streaming connections (has 'url' property)
121
+ *
122
+ * Note: McpHttpConfig and McpSseConfig have identical structure. Discrimination between
123
+ * them should be done using the transport type field in McpServerConfig, not by
124
+ * structural inspection of the config object.
125
+ */
80
126
  type McpServerTransportConfig = McpStdioConfig | McpHttpConfig | McpSseConfig;
127
+ /**
128
+ * Configuration for an MCP server connection
129
+ * @property name - Unique identifier for the server
130
+ * @property instruction - Optional instruction text describing the server's purpose
131
+ * @property toolBlacklist - Optional list of tool names to exclude from this server
132
+ * @property omitToolDescription - Whether to omit tool descriptions in listings
133
+ * @property transport - The transport type (stdio, http, or sse)
134
+ * @property config - Transport-specific configuration options
135
+ */
81
136
  interface McpServerConfig {
82
137
  name: string;
83
138
  instruction?: string;
@@ -87,13 +142,67 @@ interface McpServerConfig {
87
142
  config: McpServerTransportConfig;
88
143
  }
89
144
  /**
90
- * Remote configuration response
145
+ * Skills configuration
146
+ * @property paths - Array of paths to skills directories
147
+ */
148
+ interface SkillsConfig {
149
+ paths: string[];
150
+ }
151
+ /**
152
+ * Remote configuration response containing MCP server definitions
153
+ * @property mcpServers - Map of server names to their configurations
154
+ * @property skills - Optional skills configuration with paths
91
155
  */
92
156
  interface RemoteMcpConfiguration {
93
157
  mcpServers: Record<string, McpServerConfig>;
158
+ skills?: SkillsConfig;
159
+ }
160
+ /**
161
+ * MCP tool information returned from listTools
162
+ * @property name - The tool name
163
+ * @property description - Human-readable description
164
+ * @property inputSchema - JSON Schema for tool inputs
165
+ */
166
+ interface McpToolInfo {
167
+ name: string;
168
+ description?: string;
169
+ inputSchema: Record<string, unknown>;
170
+ }
171
+ /**
172
+ * MCP resource information returned from listResources
173
+ * @property uri - Resource URI
174
+ * @property name - Display name
175
+ * @property description - Human-readable description
176
+ * @property mimeType - Optional MIME type
177
+ */
178
+ interface McpResourceInfo {
179
+ uri: string;
180
+ name?: string;
181
+ description?: string;
182
+ mimeType?: string;
183
+ }
184
+ /**
185
+ * MCP prompt information returned from listPrompts
186
+ * @property name - Prompt name
187
+ * @property description - Human-readable description
188
+ * @property arguments - Optional argument definitions
189
+ */
190
+ interface McpPromptInfo {
191
+ name: string;
192
+ description?: string;
193
+ arguments?: Array<{
194
+ name: string;
195
+ description?: string;
196
+ required?: boolean;
197
+ }>;
94
198
  }
95
199
  /**
96
- * MCP client connection interface
200
+ * MCP client connection interface for communicating with remote MCP servers
201
+ * @property serverName - The name identifier for this server connection
202
+ * @property serverInstruction - Optional instruction text for the server
203
+ * @property toolBlacklist - Optional list of tool names to exclude
204
+ * @property omitToolDescription - Whether to omit tool descriptions
205
+ * @property transport - The transport type used for this connection
97
206
  */
98
207
  interface McpClientConnection {
99
208
  serverName: string;
@@ -101,14 +210,47 @@ interface McpClientConnection {
101
210
  toolBlacklist?: string[];
102
211
  omitToolDescription?: boolean;
103
212
  transport: McpServerTransportType;
104
- listTools(): Promise<any[]>;
105
- listResources(): Promise<any[]>;
106
- listPrompts(): Promise<any[]>;
107
- callTool(name: string, args: any): Promise<any>;
108
- readResource(uri: string): Promise<any>;
109
- getPrompt(name: string, args?: any): Promise<any>;
213
+ /** List available tools from the server */
214
+ listTools(): Promise<McpToolInfo[]>;
215
+ /** List available resources from the server */
216
+ listResources(): Promise<McpResourceInfo[]>;
217
+ /** List available prompts from the server */
218
+ listPrompts(): Promise<McpPromptInfo[]>;
219
+ /** Call a tool with the given name and arguments */
220
+ callTool(name: string, args: Record<string, unknown>): Promise<CallToolResult>;
221
+ /** Read a resource by URI */
222
+ readResource(uri: string): Promise<ReadResourceResult>;
223
+ /** Get a prompt by name with optional arguments */
224
+ getPrompt(name: string, args?: Record<string, unknown>): Promise<GetPromptResult>;
225
+ /** Close the connection */
110
226
  close(): Promise<void>;
111
227
  }
228
+ /**
229
+ * Skill metadata from YAML frontmatter in SKILL.md files
230
+ * @property name - Skill identifier used with skill__ prefix
231
+ * @property description - Short description shown in describe_tools
232
+ * @property license - Optional license information
233
+ */
234
+ interface SkillMetadata {
235
+ name: string;
236
+ description: string;
237
+ license?: string;
238
+ }
239
+ /**
240
+ * Skill definition loaded from skill files
241
+ * @property name - Skill identifier used with skill__ prefix
242
+ * @property description - Short description shown in describe_tools
243
+ * @property location - Where the skill was loaded from ('project' or 'user')
244
+ * @property content - The markdown content of the skill (without frontmatter)
245
+ * @property basePath - The directory path where the skill is located
246
+ */
247
+ interface Skill {
248
+ name: string;
249
+ description: string;
250
+ location: 'project' | 'user';
251
+ content: string;
252
+ basePath: string;
253
+ }
112
254
  //#endregion
113
255
  //#region src/transports/stdio.d.ts
114
256
  /**
@@ -169,4 +311,4 @@ declare class HttpTransportHandler implements HttpTransportHandler$1 {
169
311
  getHost(): string;
170
312
  }
171
313
  //#endregion
172
- export { HttpTransportHandler, McpClientConnection, McpHttpConfig, McpServerConfig, McpServerTransportConfig, McpServerTransportType, McpSseConfig, McpStdioConfig, RemoteMcpConfiguration, type ServerOptions, SseTransportHandler, StdioTransportHandler, Tool, ToolDefinition, TransportConfig, TransportHandler, TransportMode, createServer };
314
+ export { HttpTransportHandler, McpClientConnection, McpHttpConfig, McpPromptInfo, McpResourceInfo, McpServerConfig, McpServerTransportConfig, McpServerTransportType, McpSseConfig, McpStdioConfig, McpToolInfo, RemoteMcpConfiguration, type ServerOptions, Skill, SkillMetadata, SkillsConfig, SseTransportHandler, StdioTransportHandler, TRANSPORT_MODE, Tool, ToolDefinition, TransportConfig, TransportHandler, TransportMode, createServer };
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { i as createServer, n as SseTransportHandler, r as StdioTransportHandler, t as HttpTransportHandler } from "./http-CzQfsUEI.mjs";
1
+ import { i as createServer, n as SseTransportHandler, r as StdioTransportHandler, t as HttpTransportHandler } from "./http-BKDyW8YB.mjs";
2
2
 
3
3
  export { HttpTransportHandler, SseTransportHandler, StdioTransportHandler, 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.2.4",
4
+ "version": "0.2.5",
5
5
  "license": "AGPL-3.0",
6
6
  "keywords": [
7
7
  "mcp",
@@ -23,10 +23,11 @@
23
23
  "chalk": "5.6.2",
24
24
  "commander": "14.0.1",
25
25
  "express": "^4.21.2",
26
+ "gray-matter": "^4.0.3",
26
27
  "js-yaml": "^4.1.0",
27
28
  "liquidjs": "^10.21.0",
28
29
  "zod": "^3.24.1",
29
- "@agiflowai/aicode-utils": "1.0.7"
30
+ "@agiflowai/aicode-utils": "1.0.8"
30
31
  },
31
32
  "devDependencies": {
32
33
  "@types/express": "^5.0.0",