@mcp-z/client 1.0.0

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.
Files changed (211) hide show
  1. package/AGENTS.md +159 -0
  2. package/LICENSE +21 -0
  3. package/README.md +90 -0
  4. package/dist/cjs/auth/capability-discovery.d.cts +25 -0
  5. package/dist/cjs/auth/capability-discovery.d.ts +25 -0
  6. package/dist/cjs/auth/capability-discovery.js +280 -0
  7. package/dist/cjs/auth/capability-discovery.js.map +1 -0
  8. package/dist/cjs/auth/index.d.cts +9 -0
  9. package/dist/cjs/auth/index.d.ts +9 -0
  10. package/dist/cjs/auth/index.js +28 -0
  11. package/dist/cjs/auth/index.js.map +1 -0
  12. package/dist/cjs/auth/interactive-oauth-flow.d.cts +58 -0
  13. package/dist/cjs/auth/interactive-oauth-flow.d.ts +58 -0
  14. package/dist/cjs/auth/interactive-oauth-flow.js +537 -0
  15. package/dist/cjs/auth/interactive-oauth-flow.js.map +1 -0
  16. package/dist/cjs/auth/oauth-callback-listener.d.cts +56 -0
  17. package/dist/cjs/auth/oauth-callback-listener.d.ts +56 -0
  18. package/dist/cjs/auth/oauth-callback-listener.js +333 -0
  19. package/dist/cjs/auth/oauth-callback-listener.js.map +1 -0
  20. package/dist/cjs/auth/pkce.d.cts +17 -0
  21. package/dist/cjs/auth/pkce.d.ts +17 -0
  22. package/dist/cjs/auth/pkce.js +192 -0
  23. package/dist/cjs/auth/pkce.js.map +1 -0
  24. package/dist/cjs/auth/rfc9728-discovery.d.cts +34 -0
  25. package/dist/cjs/auth/rfc9728-discovery.d.ts +34 -0
  26. package/dist/cjs/auth/rfc9728-discovery.js +436 -0
  27. package/dist/cjs/auth/rfc9728-discovery.js.map +1 -0
  28. package/dist/cjs/auth/types.d.cts +137 -0
  29. package/dist/cjs/auth/types.d.ts +137 -0
  30. package/dist/cjs/auth/types.js +9 -0
  31. package/dist/cjs/auth/types.js.map +1 -0
  32. package/dist/cjs/client-helpers.d.cts +55 -0
  33. package/dist/cjs/client-helpers.d.ts +55 -0
  34. package/dist/cjs/client-helpers.js +128 -0
  35. package/dist/cjs/client-helpers.js.map +1 -0
  36. package/dist/cjs/config/server-loader.d.cts +27 -0
  37. package/dist/cjs/config/server-loader.d.ts +27 -0
  38. package/dist/cjs/config/server-loader.js +111 -0
  39. package/dist/cjs/config/server-loader.js.map +1 -0
  40. package/dist/cjs/config/validate-config.d.cts +15 -0
  41. package/dist/cjs/config/validate-config.d.ts +15 -0
  42. package/dist/cjs/config/validate-config.js +128 -0
  43. package/dist/cjs/config/validate-config.js.map +1 -0
  44. package/dist/cjs/connection/connect-client.d.cts +59 -0
  45. package/dist/cjs/connection/connect-client.d.ts +59 -0
  46. package/dist/cjs/connection/connect-client.js +536 -0
  47. package/dist/cjs/connection/connect-client.js.map +1 -0
  48. package/dist/cjs/connection/existing-process-transport.d.cts +40 -0
  49. package/dist/cjs/connection/existing-process-transport.d.ts +40 -0
  50. package/dist/cjs/connection/existing-process-transport.js +274 -0
  51. package/dist/cjs/connection/existing-process-transport.js.map +1 -0
  52. package/dist/cjs/connection/types.d.cts +61 -0
  53. package/dist/cjs/connection/types.d.ts +61 -0
  54. package/dist/cjs/connection/types.js +53 -0
  55. package/dist/cjs/connection/types.js.map +1 -0
  56. package/dist/cjs/connection/wait-for-http-ready.d.cts +15 -0
  57. package/dist/cjs/connection/wait-for-http-ready.d.ts +15 -0
  58. package/dist/cjs/connection/wait-for-http-ready.js +232 -0
  59. package/dist/cjs/connection/wait-for-http-ready.js.map +1 -0
  60. package/dist/cjs/dcr/dcr-authenticator.d.cts +73 -0
  61. package/dist/cjs/dcr/dcr-authenticator.d.ts +73 -0
  62. package/dist/cjs/dcr/dcr-authenticator.js +655 -0
  63. package/dist/cjs/dcr/dcr-authenticator.js.map +1 -0
  64. package/dist/cjs/dcr/dynamic-client-registrar.d.cts +28 -0
  65. package/dist/cjs/dcr/dynamic-client-registrar.d.ts +28 -0
  66. package/dist/cjs/dcr/dynamic-client-registrar.js +245 -0
  67. package/dist/cjs/dcr/dynamic-client-registrar.js.map +1 -0
  68. package/dist/cjs/dcr/index.d.cts +8 -0
  69. package/dist/cjs/dcr/index.d.ts +8 -0
  70. package/dist/cjs/dcr/index.js +24 -0
  71. package/dist/cjs/dcr/index.js.map +1 -0
  72. package/dist/cjs/index.d.cts +21 -0
  73. package/dist/cjs/index.d.ts +21 -0
  74. package/dist/cjs/index.js +94 -0
  75. package/dist/cjs/index.js.map +1 -0
  76. package/dist/cjs/monkey-patches.d.cts +6 -0
  77. package/dist/cjs/monkey-patches.d.ts +6 -0
  78. package/dist/cjs/monkey-patches.js +236 -0
  79. package/dist/cjs/monkey-patches.js.map +1 -0
  80. package/dist/cjs/package.json +1 -0
  81. package/dist/cjs/response-wrappers.d.cts +41 -0
  82. package/dist/cjs/response-wrappers.d.ts +41 -0
  83. package/dist/cjs/response-wrappers.js +443 -0
  84. package/dist/cjs/response-wrappers.js.map +1 -0
  85. package/dist/cjs/search/index.d.cts +6 -0
  86. package/dist/cjs/search/index.d.ts +6 -0
  87. package/dist/cjs/search/index.js +25 -0
  88. package/dist/cjs/search/index.js.map +1 -0
  89. package/dist/cjs/search/search.d.cts +22 -0
  90. package/dist/cjs/search/search.d.ts +22 -0
  91. package/dist/cjs/search/search.js +630 -0
  92. package/dist/cjs/search/search.js.map +1 -0
  93. package/dist/cjs/search/types.d.cts +122 -0
  94. package/dist/cjs/search/types.d.ts +122 -0
  95. package/dist/cjs/search/types.js +10 -0
  96. package/dist/cjs/search/types.js.map +1 -0
  97. package/dist/cjs/spawn/spawn-server.d.cts +83 -0
  98. package/dist/cjs/spawn/spawn-server.d.ts +83 -0
  99. package/dist/cjs/spawn/spawn-server.js +410 -0
  100. package/dist/cjs/spawn/spawn-server.js.map +1 -0
  101. package/dist/cjs/spawn/spawn-servers.d.cts +151 -0
  102. package/dist/cjs/spawn/spawn-servers.d.ts +151 -0
  103. package/dist/cjs/spawn/spawn-servers.js +911 -0
  104. package/dist/cjs/spawn/spawn-servers.js.map +1 -0
  105. package/dist/cjs/types.d.cts +11 -0
  106. package/dist/cjs/types.d.ts +11 -0
  107. package/dist/cjs/types.js +10 -0
  108. package/dist/cjs/types.js.map +1 -0
  109. package/dist/cjs/utils/logger.d.cts +24 -0
  110. package/dist/cjs/utils/logger.d.ts +24 -0
  111. package/dist/cjs/utils/logger.js +80 -0
  112. package/dist/cjs/utils/logger.js.map +1 -0
  113. package/dist/cjs/utils/path-utils.d.cts +45 -0
  114. package/dist/cjs/utils/path-utils.d.ts +45 -0
  115. package/dist/cjs/utils/path-utils.js +158 -0
  116. package/dist/cjs/utils/path-utils.js.map +1 -0
  117. package/dist/cjs/utils/sanitizer.d.cts +30 -0
  118. package/dist/cjs/utils/sanitizer.d.ts +30 -0
  119. package/dist/cjs/utils/sanitizer.js +124 -0
  120. package/dist/cjs/utils/sanitizer.js.map +1 -0
  121. package/dist/esm/auth/capability-discovery.d.ts +25 -0
  122. package/dist/esm/auth/capability-discovery.js +110 -0
  123. package/dist/esm/auth/capability-discovery.js.map +1 -0
  124. package/dist/esm/auth/index.d.ts +9 -0
  125. package/dist/esm/auth/index.js +6 -0
  126. package/dist/esm/auth/index.js.map +1 -0
  127. package/dist/esm/auth/interactive-oauth-flow.d.ts +58 -0
  128. package/dist/esm/auth/interactive-oauth-flow.js +217 -0
  129. package/dist/esm/auth/interactive-oauth-flow.js.map +1 -0
  130. package/dist/esm/auth/oauth-callback-listener.d.ts +56 -0
  131. package/dist/esm/auth/oauth-callback-listener.js +166 -0
  132. package/dist/esm/auth/oauth-callback-listener.js.map +1 -0
  133. package/dist/esm/auth/pkce.d.ts +17 -0
  134. package/dist/esm/auth/pkce.js +41 -0
  135. package/dist/esm/auth/pkce.js.map +1 -0
  136. package/dist/esm/auth/rfc9728-discovery.d.ts +34 -0
  137. package/dist/esm/auth/rfc9728-discovery.js +157 -0
  138. package/dist/esm/auth/rfc9728-discovery.js.map +1 -0
  139. package/dist/esm/auth/types.d.ts +137 -0
  140. package/dist/esm/auth/types.js +7 -0
  141. package/dist/esm/auth/types.js.map +1 -0
  142. package/dist/esm/client-helpers.d.ts +55 -0
  143. package/dist/esm/client-helpers.js +81 -0
  144. package/dist/esm/client-helpers.js.map +1 -0
  145. package/dist/esm/config/server-loader.d.ts +27 -0
  146. package/dist/esm/config/server-loader.js +49 -0
  147. package/dist/esm/config/server-loader.js.map +1 -0
  148. package/dist/esm/config/validate-config.d.ts +15 -0
  149. package/dist/esm/config/validate-config.js +76 -0
  150. package/dist/esm/config/validate-config.js.map +1 -0
  151. package/dist/esm/connection/connect-client.d.ts +59 -0
  152. package/dist/esm/connection/connect-client.js +272 -0
  153. package/dist/esm/connection/connect-client.js.map +1 -0
  154. package/dist/esm/connection/existing-process-transport.d.ts +40 -0
  155. package/dist/esm/connection/existing-process-transport.js +103 -0
  156. package/dist/esm/connection/existing-process-transport.js.map +1 -0
  157. package/dist/esm/connection/types.d.ts +61 -0
  158. package/dist/esm/connection/types.js +34 -0
  159. package/dist/esm/connection/types.js.map +1 -0
  160. package/dist/esm/connection/wait-for-http-ready.d.ts +15 -0
  161. package/dist/esm/connection/wait-for-http-ready.js +43 -0
  162. package/dist/esm/connection/wait-for-http-ready.js.map +1 -0
  163. package/dist/esm/dcr/dcr-authenticator.d.ts +73 -0
  164. package/dist/esm/dcr/dcr-authenticator.js +235 -0
  165. package/dist/esm/dcr/dcr-authenticator.js.map +1 -0
  166. package/dist/esm/dcr/dynamic-client-registrar.d.ts +28 -0
  167. package/dist/esm/dcr/dynamic-client-registrar.js +66 -0
  168. package/dist/esm/dcr/dynamic-client-registrar.js.map +1 -0
  169. package/dist/esm/dcr/index.d.ts +8 -0
  170. package/dist/esm/dcr/index.js +5 -0
  171. package/dist/esm/dcr/index.js.map +1 -0
  172. package/dist/esm/index.d.ts +21 -0
  173. package/dist/esm/index.js +22 -0
  174. package/dist/esm/index.js.map +1 -0
  175. package/dist/esm/monkey-patches.d.ts +6 -0
  176. package/dist/esm/monkey-patches.js +32 -0
  177. package/dist/esm/monkey-patches.js.map +1 -0
  178. package/dist/esm/package.json +1 -0
  179. package/dist/esm/response-wrappers.d.ts +41 -0
  180. package/dist/esm/response-wrappers.js +201 -0
  181. package/dist/esm/response-wrappers.js.map +1 -0
  182. package/dist/esm/search/index.d.ts +6 -0
  183. package/dist/esm/search/index.js +3 -0
  184. package/dist/esm/search/index.js.map +1 -0
  185. package/dist/esm/search/search.d.ts +22 -0
  186. package/dist/esm/search/search.js +236 -0
  187. package/dist/esm/search/search.js.map +1 -0
  188. package/dist/esm/search/types.d.ts +122 -0
  189. package/dist/esm/search/types.js +8 -0
  190. package/dist/esm/search/types.js.map +1 -0
  191. package/dist/esm/spawn/spawn-server.d.ts +83 -0
  192. package/dist/esm/spawn/spawn-server.js +145 -0
  193. package/dist/esm/spawn/spawn-server.js.map +1 -0
  194. package/dist/esm/spawn/spawn-servers.d.ts +151 -0
  195. package/dist/esm/spawn/spawn-servers.js +406 -0
  196. package/dist/esm/spawn/spawn-servers.js.map +1 -0
  197. package/dist/esm/types.d.ts +11 -0
  198. package/dist/esm/types.js +9 -0
  199. package/dist/esm/types.js.map +1 -0
  200. package/dist/esm/utils/logger.d.ts +24 -0
  201. package/dist/esm/utils/logger.js +59 -0
  202. package/dist/esm/utils/logger.js.map +1 -0
  203. package/dist/esm/utils/path-utils.d.ts +45 -0
  204. package/dist/esm/utils/path-utils.js +89 -0
  205. package/dist/esm/utils/path-utils.js.map +1 -0
  206. package/dist/esm/utils/sanitizer.d.ts +30 -0
  207. package/dist/esm/utils/sanitizer.js +43 -0
  208. package/dist/esm/utils/sanitizer.js.map +1 -0
  209. package/package.json +92 -0
  210. package/schemas/servers.d.ts +90 -0
  211. package/schemas/servers.schema.json +104 -0
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Search types for MCP capability discovery
3
+ *
4
+ * Enables agents to discover tools, prompts, and resources without
5
+ * loading full schemas into context.
6
+ */
7
+ import type { PromptArgument } from '../connection/types.js';
8
+ /**
9
+ * Types of MCP capabilities that can be searched
10
+ */
11
+ export type CapabilityType = 'tool' | 'prompt' | 'resource';
12
+ /**
13
+ * Fields that can be searched within capabilities
14
+ */
15
+ export type SearchField = 'name' | 'description' | 'schema' | 'server';
16
+ /**
17
+ * Options for configuring search behavior
18
+ */
19
+ export interface SearchOptions {
20
+ /**
21
+ * Filter to specific capability types
22
+ * @default ['tool', 'prompt', 'resource']
23
+ */
24
+ types?: CapabilityType[];
25
+ /**
26
+ * Filter to specific servers by name
27
+ * @default all servers in config
28
+ */
29
+ servers?: string[];
30
+ /**
31
+ * Which fields to search within
32
+ * @default ['name', 'description', 'schema']
33
+ */
34
+ searchFields?: SearchField[];
35
+ /**
36
+ * Maximum number of results to return
37
+ * @default 20
38
+ */
39
+ limit?: number;
40
+ /**
41
+ * Minimum relevance score (0-1) for results
42
+ * @default 0
43
+ */
44
+ threshold?: number;
45
+ }
46
+ /**
47
+ * A single search result representing a matched capability
48
+ */
49
+ export interface SearchResult {
50
+ /** The type of capability */
51
+ type: CapabilityType;
52
+ /** The server that provides this capability */
53
+ server: string;
54
+ /** The name of the capability */
55
+ name: string;
56
+ /** Human-readable description (may be truncated) */
57
+ description: string | undefined;
58
+ /** Which fields matched the search query */
59
+ matchedOn: string[];
60
+ /** Relevance score from 0 (low) to 1 (high) */
61
+ score: number;
62
+ }
63
+ /**
64
+ * Complete search response
65
+ */
66
+ export interface SearchResponse {
67
+ /** The original search query */
68
+ query: string;
69
+ /** Matching results, sorted by relevance */
70
+ results: SearchResult[];
71
+ /** Total number of matches before limit was applied */
72
+ total: number;
73
+ }
74
+ /**
75
+ * Internal representation of a tool for indexing
76
+ */
77
+ export interface IndexedTool {
78
+ type: 'tool';
79
+ server: string;
80
+ name: string;
81
+ description: string | undefined;
82
+ /** Flattened searchable text from inputSchema property descriptions */
83
+ schemaText: string;
84
+ }
85
+ /**
86
+ * Internal representation of a prompt for indexing
87
+ */
88
+ export interface IndexedPrompt {
89
+ type: 'prompt';
90
+ server: string;
91
+ name: string;
92
+ description: string | undefined;
93
+ /** Flattened searchable text from arguments */
94
+ argumentsText: string;
95
+ arguments: PromptArgument[] | undefined;
96
+ }
97
+ /**
98
+ * Internal representation of a resource for indexing
99
+ */
100
+ export interface IndexedResource {
101
+ type: 'resource';
102
+ server: string;
103
+ name: string;
104
+ description: string | undefined;
105
+ uri: string;
106
+ mimeType: string | undefined;
107
+ }
108
+ /**
109
+ * Union of all indexed capability types
110
+ */
111
+ export type IndexedCapability = IndexedTool | IndexedPrompt | IndexedResource;
112
+ /**
113
+ * Index containing all capabilities from connected servers
114
+ */
115
+ export interface CapabilityIndex {
116
+ /** All indexed capabilities */
117
+ capabilities: IndexedCapability[];
118
+ /** Servers that were indexed */
119
+ servers: string[];
120
+ /** When the index was created */
121
+ indexedAt: Date;
122
+ }
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Search types for MCP capability discovery
3
+ *
4
+ * Enables agents to discover tools, prompts, and resources without
5
+ * loading full schemas into context.
6
+ */
7
+ import type { PromptArgument } from '../connection/types.js';
8
+ /**
9
+ * Types of MCP capabilities that can be searched
10
+ */
11
+ export type CapabilityType = 'tool' | 'prompt' | 'resource';
12
+ /**
13
+ * Fields that can be searched within capabilities
14
+ */
15
+ export type SearchField = 'name' | 'description' | 'schema' | 'server';
16
+ /**
17
+ * Options for configuring search behavior
18
+ */
19
+ export interface SearchOptions {
20
+ /**
21
+ * Filter to specific capability types
22
+ * @default ['tool', 'prompt', 'resource']
23
+ */
24
+ types?: CapabilityType[];
25
+ /**
26
+ * Filter to specific servers by name
27
+ * @default all servers in config
28
+ */
29
+ servers?: string[];
30
+ /**
31
+ * Which fields to search within
32
+ * @default ['name', 'description', 'schema']
33
+ */
34
+ searchFields?: SearchField[];
35
+ /**
36
+ * Maximum number of results to return
37
+ * @default 20
38
+ */
39
+ limit?: number;
40
+ /**
41
+ * Minimum relevance score (0-1) for results
42
+ * @default 0
43
+ */
44
+ threshold?: number;
45
+ }
46
+ /**
47
+ * A single search result representing a matched capability
48
+ */
49
+ export interface SearchResult {
50
+ /** The type of capability */
51
+ type: CapabilityType;
52
+ /** The server that provides this capability */
53
+ server: string;
54
+ /** The name of the capability */
55
+ name: string;
56
+ /** Human-readable description (may be truncated) */
57
+ description: string | undefined;
58
+ /** Which fields matched the search query */
59
+ matchedOn: string[];
60
+ /** Relevance score from 0 (low) to 1 (high) */
61
+ score: number;
62
+ }
63
+ /**
64
+ * Complete search response
65
+ */
66
+ export interface SearchResponse {
67
+ /** The original search query */
68
+ query: string;
69
+ /** Matching results, sorted by relevance */
70
+ results: SearchResult[];
71
+ /** Total number of matches before limit was applied */
72
+ total: number;
73
+ }
74
+ /**
75
+ * Internal representation of a tool for indexing
76
+ */
77
+ export interface IndexedTool {
78
+ type: 'tool';
79
+ server: string;
80
+ name: string;
81
+ description: string | undefined;
82
+ /** Flattened searchable text from inputSchema property descriptions */
83
+ schemaText: string;
84
+ }
85
+ /**
86
+ * Internal representation of a prompt for indexing
87
+ */
88
+ export interface IndexedPrompt {
89
+ type: 'prompt';
90
+ server: string;
91
+ name: string;
92
+ description: string | undefined;
93
+ /** Flattened searchable text from arguments */
94
+ argumentsText: string;
95
+ arguments: PromptArgument[] | undefined;
96
+ }
97
+ /**
98
+ * Internal representation of a resource for indexing
99
+ */
100
+ export interface IndexedResource {
101
+ type: 'resource';
102
+ server: string;
103
+ name: string;
104
+ description: string | undefined;
105
+ uri: string;
106
+ mimeType: string | undefined;
107
+ }
108
+ /**
109
+ * Union of all indexed capability types
110
+ */
111
+ export type IndexedCapability = IndexedTool | IndexedPrompt | IndexedResource;
112
+ /**
113
+ * Index containing all capabilities from connected servers
114
+ */
115
+ export interface CapabilityIndex {
116
+ /** All indexed capabilities */
117
+ capabilities: IndexedCapability[];
118
+ /** Servers that were indexed */
119
+ servers: string[];
120
+ /** When the index was created */
121
+ indexedAt: Date;
122
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Search types for MCP capability discovery
3
+ *
4
+ * Enables agents to discover tools, prompts, and resources without
5
+ * loading full schemas into context.
6
+ */ "use strict";
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ /* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/kevin/Dev/Projects/ai/mcp-z/libs/client/src/search/types.ts"],"sourcesContent":["/**\n * Search types for MCP capability discovery\n *\n * Enables agents to discover tools, prompts, and resources without\n * loading full schemas into context.\n */\n\nimport type { PromptArgument } from '../connection/types.ts';\n\n/**\n * Types of MCP capabilities that can be searched\n */\nexport type CapabilityType = 'tool' | 'prompt' | 'resource';\n\n/**\n * Fields that can be searched within capabilities\n */\nexport type SearchField = 'name' | 'description' | 'schema' | 'server';\n\n/**\n * Options for configuring search behavior\n */\nexport interface SearchOptions {\n /**\n * Filter to specific capability types\n * @default ['tool', 'prompt', 'resource']\n */\n types?: CapabilityType[];\n\n /**\n * Filter to specific servers by name\n * @default all servers in config\n */\n servers?: string[];\n\n /**\n * Which fields to search within\n * @default ['name', 'description', 'schema']\n */\n searchFields?: SearchField[];\n\n /**\n * Maximum number of results to return\n * @default 20\n */\n limit?: number;\n\n /**\n * Minimum relevance score (0-1) for results\n * @default 0\n */\n threshold?: number;\n}\n\n/**\n * A single search result representing a matched capability\n */\nexport interface SearchResult {\n /** The type of capability */\n type: CapabilityType;\n\n /** The server that provides this capability */\n server: string;\n\n /** The name of the capability */\n name: string;\n\n /** Human-readable description (may be truncated) */\n description: string | undefined;\n\n /** Which fields matched the search query */\n matchedOn: string[];\n\n /** Relevance score from 0 (low) to 1 (high) */\n score: number;\n}\n\n/**\n * Complete search response\n */\nexport interface SearchResponse {\n /** The original search query */\n query: string;\n\n /** Matching results, sorted by relevance */\n results: SearchResult[];\n\n /** Total number of matches before limit was applied */\n total: number;\n}\n\n/**\n * Internal representation of a tool for indexing\n */\nexport interface IndexedTool {\n type: 'tool';\n server: string;\n name: string;\n description: string | undefined;\n /** Flattened searchable text from inputSchema property descriptions */\n schemaText: string;\n}\n\n/**\n * Internal representation of a prompt for indexing\n */\nexport interface IndexedPrompt {\n type: 'prompt';\n server: string;\n name: string;\n description: string | undefined;\n /** Flattened searchable text from arguments */\n argumentsText: string;\n arguments: PromptArgument[] | undefined;\n}\n\n/**\n * Internal representation of a resource for indexing\n */\nexport interface IndexedResource {\n type: 'resource';\n server: string;\n name: string;\n description: string | undefined;\n uri: string;\n mimeType: string | undefined;\n}\n\n/**\n * Union of all indexed capability types\n */\nexport type IndexedCapability = IndexedTool | IndexedPrompt | IndexedResource;\n\n/**\n * Index containing all capabilities from connected servers\n */\nexport interface CapabilityIndex {\n /** All indexed capabilities */\n capabilities: IndexedCapability[];\n\n /** Servers that were indexed */\n servers: string[];\n\n /** When the index was created */\n indexedAt: Date;\n}\n"],"names":[],"mappings":"AAAA;;;;;CAKC"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Low-level single server spawning utilities.
3
+ * Provides core process spawning with path resolution, environment management, and lifecycle control.
4
+ */
5
+ import { type ChildProcess, type StdioOptions } from 'child_process';
6
+ /**
7
+ * Options for spawning a single server process.
8
+ * @internal
9
+ */
10
+ export interface SpawnProcessOptions {
11
+ /** Server name for logging */
12
+ name: string;
13
+ /** Command to execute (e.g., 'node', 'npx') */
14
+ command: string;
15
+ /** Command arguments (paths will be resolved relative to cwd) */
16
+ args?: string[];
17
+ /** Working directory (must be absolute path) */
18
+ cwd?: string;
19
+ /** Additional environment variables (merged with process.env) */
20
+ env?: Record<string, string>;
21
+ /** Standard I/O configuration */
22
+ stdio?: StdioOptions;
23
+ /** Use shell for command execution (default: false, true on Windows) */
24
+ shell?: boolean;
25
+ }
26
+ /**
27
+ * Handle to a spawned server process.
28
+ * Provides access to the process, resolved config, and lifecycle control.
29
+ * @hidden
30
+ */
31
+ export interface ServerProcess {
32
+ /**
33
+ * The resolved server configuration that was actually used.
34
+ * Useful for debugging and understanding what was spawned.
35
+ */
36
+ config: {
37
+ name: string;
38
+ command: string;
39
+ args: string[];
40
+ cwd: string;
41
+ env: Record<string, string>;
42
+ stdio: StdioOptions;
43
+ shell: boolean;
44
+ };
45
+ /**
46
+ * The spawned child process.
47
+ */
48
+ process: ChildProcess;
49
+ /**
50
+ * Close the server gracefully.
51
+ * Sends the specified signal (default: SIGINT), then SIGKILL after timeout.
52
+ *
53
+ * @param signal - Signal to send (default: SIGINT)
54
+ * @param opts - Options including timeout
55
+ * @returns Promise resolving to whether the process timed out and was force-killed
56
+ */
57
+ close: (signal?: NodeJS.Signals, opts?: {
58
+ timeoutMs?: number;
59
+ }) => Promise<{
60
+ timedOut: boolean;
61
+ killed: boolean;
62
+ }>;
63
+ }
64
+ /**
65
+ * Spawn a single server process with path resolution and environment management.
66
+ *
67
+ * @internal
68
+ * @param opts - Server spawn options
69
+ * @returns ServerProcess handle with resolved config, process, and stop function
70
+ *
71
+ * @example
72
+ * const handle = spawnProcess({
73
+ * name: 'echo',
74
+ * command: 'node',
75
+ * args: ['./bin/server.js', '--port', '3000'],
76
+ * cwd: '/home/user/project/test/lib/servers/echo',
77
+ * env: { LOG_LEVEL: 'error' }
78
+ * });
79
+ *
80
+ * // Later...
81
+ * await handle.close();
82
+ */
83
+ export declare function spawnProcess(opts: SpawnProcessOptions): ServerProcess;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Low-level single server spawning utilities.
3
+ * Provides core process spawning with path resolution, environment management, and lifecycle control.
4
+ */
5
+ import { type ChildProcess, type StdioOptions } from 'child_process';
6
+ /**
7
+ * Options for spawning a single server process.
8
+ * @internal
9
+ */
10
+ export interface SpawnProcessOptions {
11
+ /** Server name for logging */
12
+ name: string;
13
+ /** Command to execute (e.g., 'node', 'npx') */
14
+ command: string;
15
+ /** Command arguments (paths will be resolved relative to cwd) */
16
+ args?: string[];
17
+ /** Working directory (must be absolute path) */
18
+ cwd?: string;
19
+ /** Additional environment variables (merged with process.env) */
20
+ env?: Record<string, string>;
21
+ /** Standard I/O configuration */
22
+ stdio?: StdioOptions;
23
+ /** Use shell for command execution (default: false, true on Windows) */
24
+ shell?: boolean;
25
+ }
26
+ /**
27
+ * Handle to a spawned server process.
28
+ * Provides access to the process, resolved config, and lifecycle control.
29
+ * @hidden
30
+ */
31
+ export interface ServerProcess {
32
+ /**
33
+ * The resolved server configuration that was actually used.
34
+ * Useful for debugging and understanding what was spawned.
35
+ */
36
+ config: {
37
+ name: string;
38
+ command: string;
39
+ args: string[];
40
+ cwd: string;
41
+ env: Record<string, string>;
42
+ stdio: StdioOptions;
43
+ shell: boolean;
44
+ };
45
+ /**
46
+ * The spawned child process.
47
+ */
48
+ process: ChildProcess;
49
+ /**
50
+ * Close the server gracefully.
51
+ * Sends the specified signal (default: SIGINT), then SIGKILL after timeout.
52
+ *
53
+ * @param signal - Signal to send (default: SIGINT)
54
+ * @param opts - Options including timeout
55
+ * @returns Promise resolving to whether the process timed out and was force-killed
56
+ */
57
+ close: (signal?: NodeJS.Signals, opts?: {
58
+ timeoutMs?: number;
59
+ }) => Promise<{
60
+ timedOut: boolean;
61
+ killed: boolean;
62
+ }>;
63
+ }
64
+ /**
65
+ * Spawn a single server process with path resolution and environment management.
66
+ *
67
+ * @internal
68
+ * @param opts - Server spawn options
69
+ * @returns ServerProcess handle with resolved config, process, and stop function
70
+ *
71
+ * @example
72
+ * const handle = spawnProcess({
73
+ * name: 'echo',
74
+ * command: 'node',
75
+ * args: ['./bin/server.js', '--port', '3000'],
76
+ * cwd: '/home/user/project/test/lib/servers/echo',
77
+ * env: { LOG_LEVEL: 'error' }
78
+ * });
79
+ *
80
+ * // Later...
81
+ * await handle.close();
82
+ */
83
+ export declare function spawnProcess(opts: SpawnProcessOptions): ServerProcess;