@caplets/core 0.13.1 → 0.15.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 (42) hide show
  1. package/dist/auth/store.d.ts +22 -0
  2. package/dist/auth.d.ts +77 -0
  3. package/dist/capability-description.d.ts +2 -0
  4. package/dist/caplet-files.d.ts +266 -0
  5. package/dist/caplet-sets.d.ts +33 -0
  6. package/dist/cli/add.d.ts +62 -0
  7. package/dist/cli/auth.d.ts +20 -0
  8. package/dist/cli/author.d.ts +11 -0
  9. package/dist/cli/init.d.ts +5 -0
  10. package/dist/cli/inspection.d.ts +30 -0
  11. package/dist/cli/install.d.ts +15 -0
  12. package/dist/cli-tools.d.ts +23 -0
  13. package/dist/cli.d.ts +13 -0
  14. package/dist/config/paths.d.ts +14 -0
  15. package/dist/config/validation.d.ts +16 -0
  16. package/dist/config.d.ts +227 -0
  17. package/dist/downstream.d.ts +41 -0
  18. package/dist/engine-Bh55p8Lm.js +58157 -0
  19. package/dist/engine.d.ts +52 -0
  20. package/dist/errors.d.ts +24 -0
  21. package/dist/field-selection.d.ts +4 -0
  22. package/dist/generated-tool-input-schema.d.ts +47 -0
  23. package/dist/generated-tool-input-schema.js +59 -0
  24. package/dist/graphql.d.ts +30 -0
  25. package/dist/http/utils.d.ts +7 -0
  26. package/dist/http-actions.d.ts +26 -0
  27. package/dist/index.d.ts +5 -0
  28. package/dist/index.js +1623 -59267
  29. package/dist/native/process-cleanup.d.ts +2 -0
  30. package/dist/native/service.d.ts +24 -0
  31. package/dist/native/tools.d.ts +5 -0
  32. package/dist/native.d.ts +5 -0
  33. package/dist/native.js +93 -0
  34. package/dist/openapi.d.ts +29 -0
  35. package/dist/registry.d.ts +68 -0
  36. package/dist/result-content.d.ts +14 -0
  37. package/dist/runtime.d.ts +30 -0
  38. package/dist/schema-hash.d.ts +1 -0
  39. package/dist/schema-utils.d.ts +2 -0
  40. package/dist/tool-search.d.ts +2 -0
  41. package/dist/tools.d.ts +67 -0
  42. package/package.json +20 -9
@@ -0,0 +1,22 @@
1
+ export type StoredOAuthTokenBundle = {
2
+ server: string;
3
+ authType?: "oauth2" | "oidc" | undefined;
4
+ accessToken: string;
5
+ refreshToken?: string | undefined;
6
+ tokenType?: string | undefined;
7
+ expiresAt?: string | undefined;
8
+ scope?: string | undefined;
9
+ idToken?: string | undefined;
10
+ issuer?: string | undefined;
11
+ subject?: string | undefined;
12
+ clientId?: string | undefined;
13
+ clientSecret?: string | undefined;
14
+ protectedResourceOrigin?: string | undefined;
15
+ metadata?: Record<string, unknown>;
16
+ };
17
+ export declare function authStorePath(server: string, authDir?: string): string;
18
+ export declare function readTokenBundle(server: string, authDir?: string): StoredOAuthTokenBundle | undefined;
19
+ export declare function listTokenBundles(authDir?: string): StoredOAuthTokenBundle[];
20
+ export declare function deleteTokenBundle(server: string, authDir?: string): boolean;
21
+ export declare function isTokenBundleExpired(bundle: StoredOAuthTokenBundle): boolean;
22
+ export declare function writeTokenBundle(bundle: StoredOAuthTokenBundle, authDir?: string): void;
package/dist/auth.d.ts ADDED
@@ -0,0 +1,77 @@
1
+ import { type AuthResult, type OAuthClientProvider } from "@modelcontextprotocol/sdk/client/auth.js";
2
+ import type { OAuthClientInformationMixed, OAuthClientMetadata, OAuthTokens } from "@modelcontextprotocol/sdk/shared/auth.js";
3
+ import { type StoredOAuthTokenBundle } from "./auth/store";
4
+ import type { CapletServerConfig } from "./config";
5
+ import { CapletsError } from "./errors";
6
+ export { authStorePath, deleteTokenBundle, isTokenBundleExpired, listTokenBundles, readTokenBundle, writeTokenBundle, type StoredOAuthTokenBundle, } from "./auth/store";
7
+ type OAuthLikeAuthConfig = {
8
+ type: "oauth2" | "oidc";
9
+ authorizationUrl?: string | undefined;
10
+ tokenUrl?: string | undefined;
11
+ issuer?: string | undefined;
12
+ resourceMetadataUrl?: string | undefined;
13
+ authorizationServerMetadataUrl?: string | undefined;
14
+ openidConfigurationUrl?: string | undefined;
15
+ clientMetadataUrl?: string | undefined;
16
+ clientId?: string | undefined;
17
+ clientSecret?: string | undefined;
18
+ scopes?: string[] | undefined;
19
+ redirectUri?: string | undefined;
20
+ };
21
+ export type GenericAuthTarget = {
22
+ server: string;
23
+ backend: "openapi" | "graphql" | "http";
24
+ url?: string | undefined;
25
+ baseUrl?: string | undefined;
26
+ specUrl?: string | undefined;
27
+ auth?: OAuthLikeAuthConfig | {
28
+ type: string;
29
+ } | undefined;
30
+ requestTimeoutMs?: number | undefined;
31
+ };
32
+ export declare function staticRemoteHeaders(server: CapletServerConfig): Record<string, string>;
33
+ export declare function oauthHeaders(server: CapletServerConfig, authDir?: string): Record<string, string>;
34
+ export declare function genericOAuthHeaders(target: GenericAuthTarget, authDir?: string): Record<string, string>;
35
+ export declare class FileOAuthProvider implements OAuthClientProvider {
36
+ readonly server: CapletServerConfig;
37
+ readonly redirectUrl: string;
38
+ private readonly onRedirect;
39
+ private readonly authDir?;
40
+ private verifier;
41
+ private readonly stateValue;
42
+ private clientInfo?;
43
+ readonly clientMetadataUrl?: string;
44
+ constructor(server: CapletServerConfig, redirectUrl: string, onRedirect: (url: URL) => void, authDir?: string | undefined);
45
+ get clientMetadata(): OAuthClientMetadata;
46
+ state(): string;
47
+ clientInformation(): OAuthClientInformationMixed | undefined;
48
+ saveClientInformation(clientInformation: OAuthClientInformationMixed): void;
49
+ tokens(): OAuthTokens | undefined;
50
+ saveTokens(tokens: OAuthTokens): void;
51
+ redirectToAuthorization(authorizationUrl: URL): void;
52
+ saveCodeVerifier(codeVerifier: string): void;
53
+ codeVerifier(): string;
54
+ addClientAuthentication: (headers: Headers, params: URLSearchParams) => Promise<void>;
55
+ }
56
+ export declare function runOAuthFlow(server: CapletServerConfig, options?: {
57
+ noOpen?: boolean;
58
+ authDir?: string;
59
+ manualInput?: string;
60
+ readManualInput?: () => Promise<string | undefined>;
61
+ open?: (url: string) => Promise<void>;
62
+ print?: (line: string) => void;
63
+ }): Promise<AuthResult>;
64
+ export declare function runGenericOAuthFlow(target: GenericAuthTarget, options?: {
65
+ noOpen?: boolean;
66
+ authDir?: string;
67
+ manualInput?: string;
68
+ readManualInput?: () => Promise<string | undefined>;
69
+ open?: (url: string) => Promise<void>;
70
+ print?: (line: string) => void;
71
+ }): Promise<StoredOAuthTokenBundle>;
72
+ export declare function extractCompletion(input: string): {
73
+ code: string;
74
+ state?: string;
75
+ };
76
+ export declare function classifyRemoteAuthError(server: CapletServerConfig, response: Response): CapletsError | undefined;
77
+ export declare function pkceChallenge(verifier: string): string;
@@ -0,0 +1,2 @@
1
+ import type { CapletConfig } from "./config";
2
+ export declare function capabilityDescription(server: CapletConfig): string;
@@ -0,0 +1,266 @@
1
+ import { z } from "zod";
2
+ export declare const capletFileSchema: z.ZodObject<{
3
+ $schema: z.ZodOptional<z.ZodString>;
4
+ name: z.ZodString;
5
+ description: z.ZodString;
6
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
7
+ mcpServer: z.ZodOptional<z.ZodObject<{
8
+ transport: z.ZodOptional<z.ZodEnum<{
9
+ stdio: "stdio";
10
+ http: "http";
11
+ sse: "sse";
12
+ }>>;
13
+ command: z.ZodOptional<z.ZodString>;
14
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
15
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
16
+ cwd: z.ZodOptional<z.ZodString>;
17
+ url: z.ZodOptional<z.ZodString>;
18
+ auth: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
19
+ type: z.ZodLiteral<"none">;
20
+ }, z.core.$strict>, z.ZodObject<{
21
+ type: z.ZodLiteral<"bearer">;
22
+ token: z.ZodString;
23
+ }, z.core.$strict>, z.ZodObject<{
24
+ type: z.ZodLiteral<"headers">;
25
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
26
+ }, z.core.$strict>, z.ZodObject<{
27
+ type: z.ZodLiteral<"oauth2">;
28
+ authorizationUrl: z.ZodOptional<z.ZodString>;
29
+ tokenUrl: z.ZodOptional<z.ZodString>;
30
+ issuer: z.ZodOptional<z.ZodString>;
31
+ resourceMetadataUrl: z.ZodOptional<z.ZodString>;
32
+ authorizationServerMetadataUrl: z.ZodOptional<z.ZodString>;
33
+ openidConfigurationUrl: z.ZodOptional<z.ZodString>;
34
+ clientMetadataUrl: z.ZodOptional<z.ZodString>;
35
+ clientId: z.ZodOptional<z.ZodString>;
36
+ clientSecret: z.ZodOptional<z.ZodString>;
37
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
38
+ redirectUri: z.ZodOptional<z.ZodString>;
39
+ }, z.core.$strict>, z.ZodObject<{
40
+ type: z.ZodLiteral<"oidc">;
41
+ authorizationUrl: z.ZodOptional<z.ZodString>;
42
+ tokenUrl: z.ZodOptional<z.ZodString>;
43
+ issuer: z.ZodOptional<z.ZodString>;
44
+ resourceMetadataUrl: z.ZodOptional<z.ZodString>;
45
+ authorizationServerMetadataUrl: z.ZodOptional<z.ZodString>;
46
+ openidConfigurationUrl: z.ZodOptional<z.ZodString>;
47
+ clientMetadataUrl: z.ZodOptional<z.ZodString>;
48
+ clientId: z.ZodOptional<z.ZodString>;
49
+ clientSecret: z.ZodOptional<z.ZodString>;
50
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
51
+ redirectUri: z.ZodOptional<z.ZodString>;
52
+ }, z.core.$strict>], "type">>;
53
+ startupTimeoutMs: z.ZodOptional<z.ZodNumber>;
54
+ callTimeoutMs: z.ZodOptional<z.ZodNumber>;
55
+ toolCacheTtlMs: z.ZodOptional<z.ZodNumber>;
56
+ disabled: z.ZodOptional<z.ZodBoolean>;
57
+ }, z.core.$strict>>;
58
+ openapiEndpoint: z.ZodOptional<z.ZodObject<{
59
+ specPath: z.ZodOptional<z.ZodString>;
60
+ specUrl: z.ZodOptional<z.ZodString>;
61
+ baseUrl: z.ZodOptional<z.ZodString>;
62
+ auth: z.ZodDiscriminatedUnion<[z.ZodObject<{
63
+ type: z.ZodLiteral<"none">;
64
+ }, z.core.$strict>, z.ZodObject<{
65
+ type: z.ZodLiteral<"bearer">;
66
+ token: z.ZodString;
67
+ }, z.core.$strict>, z.ZodObject<{
68
+ type: z.ZodLiteral<"headers">;
69
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
70
+ }, z.core.$strict>, z.ZodObject<{
71
+ type: z.ZodLiteral<"oauth2">;
72
+ authorizationUrl: z.ZodOptional<z.ZodString>;
73
+ tokenUrl: z.ZodOptional<z.ZodString>;
74
+ issuer: z.ZodOptional<z.ZodString>;
75
+ resourceMetadataUrl: z.ZodOptional<z.ZodString>;
76
+ authorizationServerMetadataUrl: z.ZodOptional<z.ZodString>;
77
+ openidConfigurationUrl: z.ZodOptional<z.ZodString>;
78
+ clientMetadataUrl: z.ZodOptional<z.ZodString>;
79
+ clientId: z.ZodOptional<z.ZodString>;
80
+ clientSecret: z.ZodOptional<z.ZodString>;
81
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
82
+ redirectUri: z.ZodOptional<z.ZodString>;
83
+ }, z.core.$strict>, z.ZodObject<{
84
+ type: z.ZodLiteral<"oidc">;
85
+ authorizationUrl: z.ZodOptional<z.ZodString>;
86
+ tokenUrl: z.ZodOptional<z.ZodString>;
87
+ issuer: z.ZodOptional<z.ZodString>;
88
+ resourceMetadataUrl: z.ZodOptional<z.ZodString>;
89
+ authorizationServerMetadataUrl: z.ZodOptional<z.ZodString>;
90
+ openidConfigurationUrl: z.ZodOptional<z.ZodString>;
91
+ clientMetadataUrl: z.ZodOptional<z.ZodString>;
92
+ clientId: z.ZodOptional<z.ZodString>;
93
+ clientSecret: z.ZodOptional<z.ZodString>;
94
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
95
+ redirectUri: z.ZodOptional<z.ZodString>;
96
+ }, z.core.$strict>], "type">;
97
+ requestTimeoutMs: z.ZodOptional<z.ZodNumber>;
98
+ operationCacheTtlMs: z.ZodOptional<z.ZodNumber>;
99
+ disabled: z.ZodOptional<z.ZodBoolean>;
100
+ }, z.core.$strict>>;
101
+ graphqlEndpoint: z.ZodOptional<z.ZodObject<{
102
+ endpointUrl: z.ZodString;
103
+ schemaPath: z.ZodOptional<z.ZodString>;
104
+ schemaUrl: z.ZodOptional<z.ZodString>;
105
+ introspection: z.ZodOptional<z.ZodLiteral<true>>;
106
+ operations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
107
+ document: z.ZodOptional<z.ZodString>;
108
+ documentPath: z.ZodOptional<z.ZodString>;
109
+ operationName: z.ZodOptional<z.ZodString>;
110
+ description: z.ZodOptional<z.ZodString>;
111
+ }, z.core.$strict>>>;
112
+ auth: z.ZodDiscriminatedUnion<[z.ZodObject<{
113
+ type: z.ZodLiteral<"none">;
114
+ }, z.core.$strict>, z.ZodObject<{
115
+ type: z.ZodLiteral<"bearer">;
116
+ token: z.ZodString;
117
+ }, z.core.$strict>, z.ZodObject<{
118
+ type: z.ZodLiteral<"headers">;
119
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
120
+ }, z.core.$strict>, z.ZodObject<{
121
+ type: z.ZodLiteral<"oauth2">;
122
+ authorizationUrl: z.ZodOptional<z.ZodString>;
123
+ tokenUrl: z.ZodOptional<z.ZodString>;
124
+ issuer: z.ZodOptional<z.ZodString>;
125
+ resourceMetadataUrl: z.ZodOptional<z.ZodString>;
126
+ authorizationServerMetadataUrl: z.ZodOptional<z.ZodString>;
127
+ openidConfigurationUrl: z.ZodOptional<z.ZodString>;
128
+ clientMetadataUrl: z.ZodOptional<z.ZodString>;
129
+ clientId: z.ZodOptional<z.ZodString>;
130
+ clientSecret: z.ZodOptional<z.ZodString>;
131
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
132
+ redirectUri: z.ZodOptional<z.ZodString>;
133
+ }, z.core.$strict>, z.ZodObject<{
134
+ type: z.ZodLiteral<"oidc">;
135
+ authorizationUrl: z.ZodOptional<z.ZodString>;
136
+ tokenUrl: z.ZodOptional<z.ZodString>;
137
+ issuer: z.ZodOptional<z.ZodString>;
138
+ resourceMetadataUrl: z.ZodOptional<z.ZodString>;
139
+ authorizationServerMetadataUrl: z.ZodOptional<z.ZodString>;
140
+ openidConfigurationUrl: z.ZodOptional<z.ZodString>;
141
+ clientMetadataUrl: z.ZodOptional<z.ZodString>;
142
+ clientId: z.ZodOptional<z.ZodString>;
143
+ clientSecret: z.ZodOptional<z.ZodString>;
144
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
145
+ redirectUri: z.ZodOptional<z.ZodString>;
146
+ }, z.core.$strict>], "type">;
147
+ requestTimeoutMs: z.ZodOptional<z.ZodNumber>;
148
+ operationCacheTtlMs: z.ZodOptional<z.ZodNumber>;
149
+ selectionDepth: z.ZodOptional<z.ZodNumber>;
150
+ disabled: z.ZodOptional<z.ZodBoolean>;
151
+ }, z.core.$strict>>;
152
+ httpApi: z.ZodOptional<z.ZodObject<{
153
+ baseUrl: z.ZodString;
154
+ auth: z.ZodDiscriminatedUnion<[z.ZodObject<{
155
+ type: z.ZodLiteral<"none">;
156
+ }, z.core.$strict>, z.ZodObject<{
157
+ type: z.ZodLiteral<"bearer">;
158
+ token: z.ZodString;
159
+ }, z.core.$strict>, z.ZodObject<{
160
+ type: z.ZodLiteral<"headers">;
161
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
162
+ }, z.core.$strict>, z.ZodObject<{
163
+ type: z.ZodLiteral<"oauth2">;
164
+ authorizationUrl: z.ZodOptional<z.ZodString>;
165
+ tokenUrl: z.ZodOptional<z.ZodString>;
166
+ issuer: z.ZodOptional<z.ZodString>;
167
+ resourceMetadataUrl: z.ZodOptional<z.ZodString>;
168
+ authorizationServerMetadataUrl: z.ZodOptional<z.ZodString>;
169
+ openidConfigurationUrl: z.ZodOptional<z.ZodString>;
170
+ clientMetadataUrl: z.ZodOptional<z.ZodString>;
171
+ clientId: z.ZodOptional<z.ZodString>;
172
+ clientSecret: z.ZodOptional<z.ZodString>;
173
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
174
+ redirectUri: z.ZodOptional<z.ZodString>;
175
+ }, z.core.$strict>, z.ZodObject<{
176
+ type: z.ZodLiteral<"oidc">;
177
+ authorizationUrl: z.ZodOptional<z.ZodString>;
178
+ tokenUrl: z.ZodOptional<z.ZodString>;
179
+ issuer: z.ZodOptional<z.ZodString>;
180
+ resourceMetadataUrl: z.ZodOptional<z.ZodString>;
181
+ authorizationServerMetadataUrl: z.ZodOptional<z.ZodString>;
182
+ openidConfigurationUrl: z.ZodOptional<z.ZodString>;
183
+ clientMetadataUrl: z.ZodOptional<z.ZodString>;
184
+ clientId: z.ZodOptional<z.ZodString>;
185
+ clientSecret: z.ZodOptional<z.ZodString>;
186
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
187
+ redirectUri: z.ZodOptional<z.ZodString>;
188
+ }, z.core.$strict>], "type">;
189
+ actions: z.ZodRecord<z.ZodString, z.ZodObject<{
190
+ method: z.ZodEnum<{
191
+ GET: "GET";
192
+ POST: "POST";
193
+ PUT: "PUT";
194
+ PATCH: "PATCH";
195
+ DELETE: "DELETE";
196
+ }>;
197
+ path: z.ZodString;
198
+ description: z.ZodOptional<z.ZodString>;
199
+ inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
200
+ query: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
201
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
202
+ jsonBody: z.ZodOptional<z.ZodUnknown>;
203
+ }, z.core.$strict>>;
204
+ requestTimeoutMs: z.ZodOptional<z.ZodNumber>;
205
+ maxResponseBytes: z.ZodOptional<z.ZodNumber>;
206
+ disabled: z.ZodOptional<z.ZodBoolean>;
207
+ }, z.core.$strict>>;
208
+ cliTools: z.ZodOptional<z.ZodObject<{
209
+ actions: z.ZodRecord<z.ZodString, z.ZodObject<{
210
+ description: z.ZodOptional<z.ZodString>;
211
+ inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
212
+ outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
213
+ command: z.ZodString;
214
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
215
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
216
+ cwd: z.ZodOptional<z.ZodString>;
217
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
218
+ maxOutputBytes: z.ZodOptional<z.ZodNumber>;
219
+ output: z.ZodOptional<z.ZodObject<{
220
+ type: z.ZodOptional<z.ZodEnum<{
221
+ text: "text";
222
+ json: "json";
223
+ }>>;
224
+ }, z.core.$strict>>;
225
+ annotations: z.ZodOptional<z.ZodObject<{
226
+ readOnlyHint: z.ZodOptional<z.ZodBoolean>;
227
+ destructiveHint: z.ZodOptional<z.ZodBoolean>;
228
+ idempotentHint: z.ZodOptional<z.ZodBoolean>;
229
+ openWorldHint: z.ZodOptional<z.ZodBoolean>;
230
+ }, z.core.$strict>>;
231
+ }, z.core.$strict>>;
232
+ cwd: z.ZodOptional<z.ZodString>;
233
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
234
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
235
+ maxOutputBytes: z.ZodOptional<z.ZodNumber>;
236
+ disabled: z.ZodOptional<z.ZodBoolean>;
237
+ }, z.core.$strict>>;
238
+ capletSet: z.ZodOptional<z.ZodObject<{
239
+ configPath: z.ZodOptional<z.ZodString>;
240
+ capletsRoot: z.ZodOptional<z.ZodString>;
241
+ defaultSearchLimit: z.ZodOptional<z.ZodNumber>;
242
+ maxSearchLimit: z.ZodOptional<z.ZodNumber>;
243
+ toolCacheTtlMs: z.ZodOptional<z.ZodNumber>;
244
+ disabled: z.ZodOptional<z.ZodBoolean>;
245
+ }, z.core.$strict>>;
246
+ }, z.core.$strict>;
247
+ export declare function capletJsonSchema(): unknown;
248
+ export type CapletFileConfig = {
249
+ mcpServers?: Record<string, unknown>;
250
+ openapiEndpoints?: Record<string, unknown>;
251
+ graphqlEndpoints?: Record<string, unknown>;
252
+ httpApis?: Record<string, unknown>;
253
+ cliTools?: Record<string, unknown>;
254
+ capletSets?: Record<string, unknown>;
255
+ };
256
+ export type CapletFileLoadResult = {
257
+ config: CapletFileConfig;
258
+ paths: Record<string, string>;
259
+ };
260
+ export declare function loadCapletFiles(root: string): CapletFileConfig | undefined;
261
+ export declare function loadCapletFilesWithPaths(root: string): CapletFileLoadResult | undefined;
262
+ export declare function discoverCapletFiles(root: string): Array<{
263
+ id: string;
264
+ path: string;
265
+ }>;
266
+ export declare function validateCapletFile(path: string): void;
@@ -0,0 +1,33 @@
1
+ import type { CompatibilityCallToolResult, Tool } from "@modelcontextprotocol/sdk/types.js";
2
+ import { type CapletSetConfig } from "./config";
3
+ import { type CompactTool } from "./downstream";
4
+ import { ServerRegistry } from "./registry";
5
+ export declare class CapletSetManager {
6
+ private registry;
7
+ private readonly options;
8
+ private readonly children;
9
+ private readonly childRefreshLocks;
10
+ constructor(registry: ServerRegistry, options?: {
11
+ authDir?: string;
12
+ ancestry?: Set<string>;
13
+ });
14
+ updateRegistry(registry: ServerRegistry): void;
15
+ invalidate(serverId: string): void;
16
+ close(): Promise<void>;
17
+ checkSet(config: CapletSetConfig): Promise<{
18
+ id: string;
19
+ status: string;
20
+ toolCount?: number;
21
+ elapsedMs: number;
22
+ error?: unknown;
23
+ }>;
24
+ listTools(config: CapletSetConfig): Promise<Tool[]>;
25
+ getTool(config: CapletSetConfig, toolName: string): Promise<Tool>;
26
+ callTool(config: CapletSetConfig, toolName: string, args: Record<string, unknown>): Promise<CompatibilityCallToolResult>;
27
+ compact(config: CapletSetConfig, tool: Tool): CompactTool;
28
+ search(config: CapletSetConfig, tools: Tool[], query: string, limit: number): CompactTool[];
29
+ private childRuntime;
30
+ private loadChildRuntime;
31
+ private closeChild;
32
+ private toTool;
33
+ }
@@ -0,0 +1,62 @@
1
+ type AddCliOptions = {
2
+ repo?: string;
3
+ include?: string;
4
+ command?: string;
5
+ output?: string;
6
+ print?: boolean;
7
+ force?: boolean;
8
+ destinationRoot: string;
9
+ };
10
+ type AddDestinationOptions = {
11
+ output?: string;
12
+ print?: boolean;
13
+ force?: boolean;
14
+ destinationRoot: string;
15
+ };
16
+ type AddMcpOptions = AddDestinationOptions & {
17
+ command?: string;
18
+ arg?: string[];
19
+ cwd?: string;
20
+ env?: string[];
21
+ url?: string;
22
+ transport?: string;
23
+ tokenEnv?: string;
24
+ };
25
+ type AddOpenApiOptions = AddDestinationOptions & {
26
+ spec?: string;
27
+ baseUrl?: string;
28
+ tokenEnv?: string;
29
+ };
30
+ type AddGraphqlOptions = AddDestinationOptions & {
31
+ endpointUrl?: string;
32
+ schema?: string;
33
+ introspection?: boolean;
34
+ tokenEnv?: string;
35
+ };
36
+ type AddHttpOptions = AddDestinationOptions & {
37
+ baseUrl?: string;
38
+ action?: string[];
39
+ tokenEnv?: string;
40
+ };
41
+ export declare function addCliCaplet(id: string, options: AddCliOptions): {
42
+ path?: string;
43
+ text: string;
44
+ };
45
+ export declare function addMcpCaplet(id: string, options: AddMcpOptions): {
46
+ path?: string;
47
+ text: string;
48
+ };
49
+ export declare function addOpenApiCaplet(id: string, options: AddOpenApiOptions): {
50
+ path?: string;
51
+ text: string;
52
+ };
53
+ export declare function addGraphqlCaplet(id: string, options: AddGraphqlOptions): {
54
+ path?: string;
55
+ text: string;
56
+ };
57
+ export declare function addHttpCaplet(id: string, options: AddHttpOptions): {
58
+ path?: string;
59
+ text: string;
60
+ };
61
+ export declare function assertValidCapletId(id: string): void;
62
+ export {};
@@ -0,0 +1,20 @@
1
+ type AuthListFormat = "plain" | "markdown" | "json";
2
+ export declare function loginAuth(serverId: string, options: {
3
+ configPath?: string;
4
+ noOpen: boolean;
5
+ writeOut: (value: string) => void;
6
+ writeErr: (value: string) => void;
7
+ authDir?: string;
8
+ }): Promise<void>;
9
+ export declare function logoutAuth(serverId: string, options: {
10
+ authDir?: string;
11
+ configPath?: string;
12
+ writeOut: (value: string) => void;
13
+ }): void;
14
+ export declare function listAuth(options: {
15
+ authDir?: string;
16
+ configPath?: string;
17
+ writeOut: (value: string) => void;
18
+ format?: AuthListFormat;
19
+ }): void;
20
+ export {};
@@ -0,0 +1,11 @@
1
+ type AuthorCliOptions = {
2
+ repo?: string;
3
+ include?: string;
4
+ command?: string;
5
+ output?: string;
6
+ };
7
+ export declare function authorCliCaplet(id: string, options?: AuthorCliOptions): {
8
+ path?: string;
9
+ text: string;
10
+ };
11
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare function initConfig(options?: {
2
+ path?: string;
3
+ force?: boolean;
4
+ }): string;
5
+ export declare function starterConfig(): string;
@@ -0,0 +1,30 @@
1
+ import { type CapletConfig, type ConfigSource, type ConfigWithSources } from "../config";
2
+ import type { ServerStatus } from "../registry";
3
+ type CapletListRow = {
4
+ server: string;
5
+ backend: CapletConfig["backend"];
6
+ name: string;
7
+ description: string;
8
+ disabled: boolean;
9
+ status: ServerStatus;
10
+ source: ConfigSource["kind"] | "unknown";
11
+ path: string | null;
12
+ shadows: ConfigSource[];
13
+ };
14
+ type ConfigPaths = {
15
+ userConfig: string;
16
+ projectConfig: string;
17
+ userRoot: string;
18
+ stateRoot: string;
19
+ projectRoot: string;
20
+ authDir: string;
21
+ envConfig: string | null;
22
+ };
23
+ export declare function listCaplets(configWithSources: ConfigWithSources, options: {
24
+ includeDisabled: boolean;
25
+ }): CapletListRow[];
26
+ type CliOutputFormat = "markdown" | "plain" | "json";
27
+ export declare function formatCapletList(rows: CapletListRow[], format?: Exclude<CliOutputFormat, "json">): string;
28
+ export declare function resolveCliConfigPaths(envConfigPath: string | undefined, authDir?: string): ConfigPaths;
29
+ export declare function formatConfigPaths(paths: ConfigPaths, format?: Exclude<CliOutputFormat, "json">): string;
30
+ export {};
@@ -0,0 +1,15 @@
1
+ type InstallableCaplet = {
2
+ id: string;
3
+ source: string;
4
+ destination: string;
5
+ kind: "file" | "directory";
6
+ };
7
+ export declare function installCaplets(repo: string, options?: {
8
+ capletIds?: string[];
9
+ destinationRoot?: string;
10
+ force?: boolean;
11
+ }): {
12
+ installed: InstallableCaplet[];
13
+ };
14
+ export declare function normalizeGitRepo(repo: string): string;
15
+ export {};
@@ -0,0 +1,23 @@
1
+ import type { CompatibilityCallToolResult, Tool } from "@modelcontextprotocol/sdk/types.js";
2
+ import type { CliToolsConfig } from "./config";
3
+ import type { CompactTool } from "./downstream";
4
+ import type { ServerRegistry } from "./registry";
5
+ export declare class CliToolsManager {
6
+ private registry;
7
+ constructor(registry: ServerRegistry);
8
+ updateRegistry(registry: ServerRegistry): void;
9
+ invalidate(_serverId: string): void;
10
+ checkTools(config: CliToolsConfig): Promise<{
11
+ id: string;
12
+ status: string;
13
+ toolCount?: number;
14
+ elapsedMs: number;
15
+ error?: unknown;
16
+ }>;
17
+ listTools(config: CliToolsConfig): Promise<Tool[]>;
18
+ getTool(config: CliToolsConfig, toolName: string): Promise<Tool>;
19
+ callTool(config: CliToolsConfig, toolName: string, args: Record<string, unknown>): Promise<CompatibilityCallToolResult>;
20
+ compact(config: CliToolsConfig, tool: Tool): CompactTool;
21
+ search(config: CliToolsConfig, tools: Tool[], query: string, limit: number): CompactTool[];
22
+ private toTool;
23
+ }
package/dist/cli.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import { Command } from "commander";
2
+ export { initConfig, starterConfig } from "./cli/init";
3
+ export { installCaplets, normalizeGitRepo } from "./cli/install";
4
+ export { addCliCaplet, addGraphqlCaplet, addHttpCaplet, addMcpCaplet, addOpenApiCaplet, } from "./cli/add";
5
+ type CliIO = {
6
+ writeOut?: (value: string) => void;
7
+ writeErr?: (value: string) => void;
8
+ authDir?: string;
9
+ version?: string;
10
+ setExitCode?: (code: number) => void;
11
+ };
12
+ export declare function runCli(args: string[], io?: CliIO): Promise<void>;
13
+ export declare function createProgram(io?: CliIO): Command;
@@ -0,0 +1,14 @@
1
+ type Platform = NodeJS.Platform;
2
+ type PathEnv = NodeJS.ProcessEnv;
3
+ export declare function defaultConfigBaseDir(env?: PathEnv, home?: string, platform?: Platform): string;
4
+ export declare function defaultStateBaseDir(env?: PathEnv, home?: string, platform?: Platform): string;
5
+ export declare function defaultConfigPath(env?: PathEnv, home?: string, platform?: Platform): string;
6
+ export declare function defaultAuthDir(env?: PathEnv, home?: string, platform?: Platform): string;
7
+ export declare const DEFAULT_CONFIG_PATH: string;
8
+ export declare const DEFAULT_AUTH_DIR: string;
9
+ export declare const PROJECT_CONFIG_FILE: string;
10
+ export declare function resolveConfigPath(path?: string): string;
11
+ export declare function resolveProjectConfigPath(cwd?: string): string;
12
+ export declare function resolveCapletsRoot(configPath?: string): string;
13
+ export declare function resolveProjectCapletsRoot(cwd?: string): string;
14
+ export {};
@@ -0,0 +1,16 @@
1
+ export declare const SERVER_ID_PATTERN: RegExp;
2
+ export declare const HEADER_NAME_PATTERN: RegExp;
3
+ export declare const HTTP_BASE_URL_PATTERN: RegExp;
4
+ export declare const FORBIDDEN_HEADERS: Set<string>;
5
+ type ValidationIssueSink = {
6
+ addIssue(issue: {
7
+ code: "custom";
8
+ path: Array<string>;
9
+ message: string;
10
+ }): void;
11
+ };
12
+ export declare function validateHttpActionHeaders(headers: Record<string, unknown>, ctx: ValidationIssueSink, path: Array<string>): void;
13
+ export declare function isAllowedRemoteUrl(value: string): boolean;
14
+ export declare function isAllowedHttpBaseUrl(value: string): boolean;
15
+ export declare function isUrl(value: string): boolean;
16
+ export {};