@caplets/core 0.14.0 → 0.16.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.
- package/dist/auth/store.d.ts +22 -0
- package/dist/auth.d.ts +77 -0
- package/dist/capability-description.d.ts +2 -0
- package/dist/caplet-files.d.ts +266 -0
- package/dist/caplet-sets.d.ts +33 -0
- package/dist/cli/add.d.ts +62 -0
- package/dist/cli/auth.d.ts +20 -0
- package/dist/cli/author.d.ts +11 -0
- package/dist/cli/init.d.ts +5 -0
- package/dist/cli/inspection.d.ts +30 -0
- package/dist/cli/install.d.ts +15 -0
- package/dist/cli-tools.d.ts +23 -0
- package/dist/cli.d.ts +15 -0
- package/dist/config/paths.d.ts +14 -0
- package/dist/config/validation.d.ts +16 -0
- package/dist/config.d.ts +227 -0
- package/dist/downstream.d.ts +41 -0
- package/dist/engine-Brwid_mq.js +58159 -0
- package/dist/engine.d.ts +52 -0
- package/dist/errors.d.ts +24 -0
- package/dist/field-selection.d.ts +4 -0
- package/dist/generated-tool-input-schema.d.ts +47 -0
- package/dist/generated-tool-input-schema.js +59 -0
- package/dist/graphql.d.ts +30 -0
- package/dist/http/utils.d.ts +7 -0
- package/dist/http-actions.d.ts +26 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +6390 -61147
- package/dist/native/options.d.ts +34 -0
- package/dist/native/process-cleanup.d.ts +2 -0
- package/dist/native/remote.d.ts +46 -0
- package/dist/native/service.d.ts +30 -0
- package/dist/native/tools.d.ts +5 -0
- package/dist/native.d.ts +7 -0
- package/dist/native.js +367 -0
- package/dist/openapi.d.ts +29 -0
- package/dist/registry.d.ts +68 -0
- package/dist/result-content.d.ts +14 -0
- package/dist/runtime.d.ts +25 -0
- package/dist/schema-hash.d.ts +1 -0
- package/dist/schema-utils.d.ts +2 -0
- package/dist/serve/http.d.ts +12 -0
- package/dist/serve/index.d.ts +14 -0
- package/dist/serve/options.d.ts +34 -0
- package/dist/serve/session.d.ts +21 -0
- package/dist/serve/stdio.d.ts +5 -0
- package/dist/tool-search.d.ts +2 -0
- package/dist/tools.d.ts +67 -0
- package/package.json +22 -9
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export { DEFAULT_AUTH_DIR, DEFAULT_CONFIG_PATH, PROJECT_CONFIG_FILE, resolveCapletsRoot, resolveConfigPath, resolveProjectCapletsRoot, resolveProjectConfigPath, } from "./config/paths";
|
|
3
|
+
export type RemoteAuthConfig = {
|
|
4
|
+
type: "none";
|
|
5
|
+
} | {
|
|
6
|
+
type: "bearer";
|
|
7
|
+
token: string;
|
|
8
|
+
} | {
|
|
9
|
+
type: "headers";
|
|
10
|
+
headers: Record<string, string>;
|
|
11
|
+
} | {
|
|
12
|
+
type: "oauth2";
|
|
13
|
+
authorizationUrl?: string | undefined;
|
|
14
|
+
tokenUrl?: string | undefined;
|
|
15
|
+
issuer?: string | undefined;
|
|
16
|
+
resourceMetadataUrl?: string | undefined;
|
|
17
|
+
authorizationServerMetadataUrl?: string | undefined;
|
|
18
|
+
openidConfigurationUrl?: string | undefined;
|
|
19
|
+
clientMetadataUrl?: string | undefined;
|
|
20
|
+
clientId?: string | undefined;
|
|
21
|
+
clientSecret?: string | undefined;
|
|
22
|
+
scopes?: string[] | undefined;
|
|
23
|
+
redirectUri?: string | undefined;
|
|
24
|
+
} | {
|
|
25
|
+
type: "oidc";
|
|
26
|
+
authorizationUrl?: string | undefined;
|
|
27
|
+
tokenUrl?: string | undefined;
|
|
28
|
+
issuer?: string | undefined;
|
|
29
|
+
resourceMetadataUrl?: string | undefined;
|
|
30
|
+
authorizationServerMetadataUrl?: string | undefined;
|
|
31
|
+
openidConfigurationUrl?: string | undefined;
|
|
32
|
+
clientMetadataUrl?: string | undefined;
|
|
33
|
+
clientId?: string | undefined;
|
|
34
|
+
clientSecret?: string | undefined;
|
|
35
|
+
scopes?: string[] | undefined;
|
|
36
|
+
redirectUri?: string | undefined;
|
|
37
|
+
};
|
|
38
|
+
export type CapletServerConfig = {
|
|
39
|
+
server: string;
|
|
40
|
+
backend: "mcp";
|
|
41
|
+
name: string;
|
|
42
|
+
description: string;
|
|
43
|
+
tags?: string[] | undefined;
|
|
44
|
+
body?: string | undefined;
|
|
45
|
+
transport: "stdio" | "http" | "sse";
|
|
46
|
+
command?: string | undefined;
|
|
47
|
+
args?: string[] | undefined;
|
|
48
|
+
env?: Record<string, string> | undefined;
|
|
49
|
+
cwd?: string | undefined;
|
|
50
|
+
url?: string | undefined;
|
|
51
|
+
auth?: RemoteAuthConfig | undefined;
|
|
52
|
+
startupTimeoutMs: number;
|
|
53
|
+
callTimeoutMs: number;
|
|
54
|
+
toolCacheTtlMs: number;
|
|
55
|
+
disabled: boolean;
|
|
56
|
+
};
|
|
57
|
+
export type OpenApiAuthConfig = {
|
|
58
|
+
type: "none";
|
|
59
|
+
} | {
|
|
60
|
+
type: "bearer";
|
|
61
|
+
token: string;
|
|
62
|
+
} | {
|
|
63
|
+
type: "headers";
|
|
64
|
+
headers: Record<string, string>;
|
|
65
|
+
} | Extract<RemoteAuthConfig, {
|
|
66
|
+
type: "oauth2" | "oidc";
|
|
67
|
+
}>;
|
|
68
|
+
export type OpenApiEndpointConfig = {
|
|
69
|
+
server: string;
|
|
70
|
+
backend: "openapi";
|
|
71
|
+
name: string;
|
|
72
|
+
description: string;
|
|
73
|
+
tags?: string[] | undefined;
|
|
74
|
+
body?: string | undefined;
|
|
75
|
+
specPath?: string | undefined;
|
|
76
|
+
specUrl?: string | undefined;
|
|
77
|
+
baseUrl?: string | undefined;
|
|
78
|
+
auth: OpenApiAuthConfig;
|
|
79
|
+
requestTimeoutMs: number;
|
|
80
|
+
operationCacheTtlMs: number;
|
|
81
|
+
disabled: boolean;
|
|
82
|
+
};
|
|
83
|
+
export type GraphQlOperationConfig = {
|
|
84
|
+
document?: string | undefined;
|
|
85
|
+
documentPath?: string | undefined;
|
|
86
|
+
operationName?: string | undefined;
|
|
87
|
+
description?: string | undefined;
|
|
88
|
+
};
|
|
89
|
+
export type GraphQlEndpointConfig = {
|
|
90
|
+
server: string;
|
|
91
|
+
backend: "graphql";
|
|
92
|
+
name: string;
|
|
93
|
+
description: string;
|
|
94
|
+
tags?: string[] | undefined;
|
|
95
|
+
body?: string | undefined;
|
|
96
|
+
endpointUrl: string;
|
|
97
|
+
schemaPath?: string | undefined;
|
|
98
|
+
schemaUrl?: string | undefined;
|
|
99
|
+
introspection?: true | undefined;
|
|
100
|
+
operations?: Record<string, GraphQlOperationConfig> | undefined;
|
|
101
|
+
auth: OpenApiAuthConfig;
|
|
102
|
+
requestTimeoutMs: number;
|
|
103
|
+
operationCacheTtlMs: number;
|
|
104
|
+
selectionDepth: number;
|
|
105
|
+
disabled: boolean;
|
|
106
|
+
};
|
|
107
|
+
export type HttpActionConfig = {
|
|
108
|
+
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
109
|
+
path: string;
|
|
110
|
+
description?: string | undefined;
|
|
111
|
+
inputSchema?: Record<string, unknown> | undefined;
|
|
112
|
+
outputSchema?: Record<string, unknown> | undefined;
|
|
113
|
+
query?: Record<string, string | number | boolean> | undefined;
|
|
114
|
+
headers?: Record<string, string | number | boolean> | undefined;
|
|
115
|
+
jsonBody?: unknown;
|
|
116
|
+
};
|
|
117
|
+
export type HttpApiConfig = {
|
|
118
|
+
server: string;
|
|
119
|
+
backend: "http";
|
|
120
|
+
name: string;
|
|
121
|
+
description: string;
|
|
122
|
+
tags?: string[] | undefined;
|
|
123
|
+
body?: string | undefined;
|
|
124
|
+
baseUrl: string;
|
|
125
|
+
auth: OpenApiAuthConfig;
|
|
126
|
+
actions: Record<string, HttpActionConfig>;
|
|
127
|
+
requestTimeoutMs: number;
|
|
128
|
+
maxResponseBytes: number;
|
|
129
|
+
disabled: boolean;
|
|
130
|
+
};
|
|
131
|
+
export type CliToolOutputConfig = {
|
|
132
|
+
type: "text" | "json";
|
|
133
|
+
};
|
|
134
|
+
export type CliToolActionConfig = {
|
|
135
|
+
description?: string | undefined;
|
|
136
|
+
inputSchema?: Record<string, unknown> | undefined;
|
|
137
|
+
outputSchema?: Record<string, unknown> | undefined;
|
|
138
|
+
command: string;
|
|
139
|
+
args?: string[] | undefined;
|
|
140
|
+
env?: Record<string, string> | undefined;
|
|
141
|
+
cwd?: string | undefined;
|
|
142
|
+
timeoutMs?: number | undefined;
|
|
143
|
+
maxOutputBytes?: number | undefined;
|
|
144
|
+
output?: CliToolOutputConfig | undefined;
|
|
145
|
+
annotations?: {
|
|
146
|
+
readOnlyHint?: boolean | undefined;
|
|
147
|
+
destructiveHint?: boolean | undefined;
|
|
148
|
+
idempotentHint?: boolean | undefined;
|
|
149
|
+
openWorldHint?: boolean | undefined;
|
|
150
|
+
} | undefined;
|
|
151
|
+
};
|
|
152
|
+
export type CliToolsConfig = {
|
|
153
|
+
server: string;
|
|
154
|
+
backend: "cli";
|
|
155
|
+
name: string;
|
|
156
|
+
description: string;
|
|
157
|
+
tags?: string[] | undefined;
|
|
158
|
+
body?: string | undefined;
|
|
159
|
+
actions: Record<string, CliToolActionConfig>;
|
|
160
|
+
cwd?: string | undefined;
|
|
161
|
+
env?: Record<string, string> | undefined;
|
|
162
|
+
timeoutMs: number;
|
|
163
|
+
maxOutputBytes: number;
|
|
164
|
+
disabled: boolean;
|
|
165
|
+
};
|
|
166
|
+
export type CapletSetConfig = {
|
|
167
|
+
server: string;
|
|
168
|
+
backend: "caplets";
|
|
169
|
+
name: string;
|
|
170
|
+
description: string;
|
|
171
|
+
tags?: string[] | undefined;
|
|
172
|
+
body?: string | undefined;
|
|
173
|
+
configPath?: string | undefined;
|
|
174
|
+
capletsRoot?: string | undefined;
|
|
175
|
+
defaultSearchLimit: number;
|
|
176
|
+
maxSearchLimit: number;
|
|
177
|
+
toolCacheTtlMs: number;
|
|
178
|
+
disabled: boolean;
|
|
179
|
+
};
|
|
180
|
+
export type CapletConfig = CapletServerConfig | OpenApiEndpointConfig | GraphQlEndpointConfig | HttpApiConfig | CliToolsConfig | CapletSetConfig;
|
|
181
|
+
export type CapletsOptions = {
|
|
182
|
+
defaultSearchLimit: number;
|
|
183
|
+
maxSearchLimit: number;
|
|
184
|
+
};
|
|
185
|
+
export type CapletsConfig = {
|
|
186
|
+
version: 1;
|
|
187
|
+
options: CapletsOptions;
|
|
188
|
+
mcpServers: Record<string, CapletServerConfig>;
|
|
189
|
+
openapiEndpoints: Record<string, OpenApiEndpointConfig>;
|
|
190
|
+
graphqlEndpoints: Record<string, GraphQlEndpointConfig>;
|
|
191
|
+
httpApis: Record<string, HttpApiConfig>;
|
|
192
|
+
cliTools: Record<string, CliToolsConfig>;
|
|
193
|
+
capletSets: Record<string, CapletSetConfig>;
|
|
194
|
+
};
|
|
195
|
+
export type ConfigSourceKind = "global-config" | "global-file" | "project-config" | "project-file";
|
|
196
|
+
export type ConfigSource = {
|
|
197
|
+
kind: ConfigSourceKind;
|
|
198
|
+
path: string;
|
|
199
|
+
};
|
|
200
|
+
export type ConfigWithSources = {
|
|
201
|
+
config: CapletsConfig;
|
|
202
|
+
sources: Record<string, ConfigSource>;
|
|
203
|
+
shadows: Record<string, ConfigSource[]>;
|
|
204
|
+
};
|
|
205
|
+
export declare const configFileSchema: z.ZodObject<{
|
|
206
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
207
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
208
|
+
defaultSearchLimit: z.ZodDefault<z.ZodNumber>;
|
|
209
|
+
maxSearchLimit: z.ZodDefault<z.ZodNumber>;
|
|
210
|
+
mcpServers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
211
|
+
openapiEndpoints: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
212
|
+
graphqlEndpoints: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
213
|
+
httpApis: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
214
|
+
cliTools: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
215
|
+
capletSets: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
216
|
+
}, z.core.$strict>;
|
|
217
|
+
export declare function configJsonSchema(): unknown;
|
|
218
|
+
export declare function loadConfig(path?: string, projectPath?: string): CapletsConfig;
|
|
219
|
+
export declare function loadConfigWithSources(path?: string, projectPath?: string): ConfigWithSources;
|
|
220
|
+
export declare function loadIsolatedConfig(options: {
|
|
221
|
+
configPath?: string;
|
|
222
|
+
capletsRoot?: string;
|
|
223
|
+
defaultSearchLimit: number;
|
|
224
|
+
maxSearchLimit: number;
|
|
225
|
+
}): CapletsConfig;
|
|
226
|
+
export declare function parseConfig(input: unknown): CapletsConfig;
|
|
227
|
+
export declare function interpolateEnv(value: string): string;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type CompatibilityCallToolResult, type Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
import type { CapletServerConfig } from "./config";
|
|
3
|
+
import type { ServerRegistry } from "./registry";
|
|
4
|
+
export type CompactTool = {
|
|
5
|
+
id: string;
|
|
6
|
+
tool: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
hasInputSchema: boolean;
|
|
9
|
+
hasOutputSchema: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare class DownstreamManager {
|
|
12
|
+
private registry;
|
|
13
|
+
private readonly options;
|
|
14
|
+
private readonly connections;
|
|
15
|
+
private readonly connecting;
|
|
16
|
+
private readonly restartState;
|
|
17
|
+
constructor(registry: ServerRegistry, options?: {
|
|
18
|
+
authDir?: string;
|
|
19
|
+
});
|
|
20
|
+
updateRegistry(registry: ServerRegistry): void;
|
|
21
|
+
close(): Promise<void>;
|
|
22
|
+
closeServer(serverId: string): Promise<void>;
|
|
23
|
+
checkServer(server: CapletServerConfig): Promise<{
|
|
24
|
+
id: string;
|
|
25
|
+
status: string;
|
|
26
|
+
toolCount?: number;
|
|
27
|
+
elapsedMs: number;
|
|
28
|
+
error?: unknown;
|
|
29
|
+
}>;
|
|
30
|
+
listTools(server: CapletServerConfig): Promise<Tool[]>;
|
|
31
|
+
getTool(server: CapletServerConfig, toolName: string): Promise<Tool>;
|
|
32
|
+
callTool(server: CapletServerConfig, toolName: string, args: Record<string, unknown>): Promise<CompatibilityCallToolResult>;
|
|
33
|
+
compact(server: CapletServerConfig, tool: Tool): CompactTool;
|
|
34
|
+
search(server: CapletServerConfig, tools: Tool[], query: string, limit: number): CompactTool[];
|
|
35
|
+
private refreshTools;
|
|
36
|
+
private connect;
|
|
37
|
+
private createTransport;
|
|
38
|
+
private oauthProvider;
|
|
39
|
+
private currentServer;
|
|
40
|
+
private currentServerFingerprint;
|
|
41
|
+
}
|