@inkeep/agents-manage-mcp 0.0.0-dev-20251217021908 → 0.0.0-dev-20251217042024
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.d.cts.map +1 -0
- package/dist/index.d.ts +261 -248
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21926 -23460
- package/dist/index.js.map +1 -0
- package/package.json +3 -3
- package/tsdown.config.ts +18 -0
- package/tsup.config.ts +0 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/lib/http.ts","../src/lib/logger.ts","../src/lib/retries.ts","../src/lib/config.ts","../src/lib/security.ts","../src/hooks/types.ts","../src/hooks/hooks.ts","../src/models/errors/httpclienterrors.ts","../src/lib/result.ts","../src/lib/sdks.ts","../src/core.ts","../src/hooks/header-forwarding-hook.ts","../src/mcp-server/console-logger.ts","../src/mcp-server/scopes.ts","../src/mcp-server/server.ts"],"sourcesContent":[],"mappings":";;;KAIY,OAAA,WAAkB,cAAc,YAAY,gBAAgB,QAAQ;KAEpE,iBAAe,IAAI,QAAQ;KAa3B,YAAA;EAfA;;;EAA4C,GAAA,EAmBjD,GAnBiD;EAAwB;;;EAEpE,OAAA,CAAA,EAqBA,WArBS,GAAA,SAAA;CAAM;AAAY,UAwBtB,iBAAA,CAxBsB;EAAR,OAAA,CAAA,EAyBnB,OAzBmB;;AAanB,KAeA,mBAAA,GAXL,CAAA,GAIK,EAO0B,OAP1B,EAAA,GAOsC,WAP3B,CAOqC,OAPrC,GAAA,IAAA,CAAA;AAGN,KAKL,gBAAA,GALsB,CAAA,GAAA,EACtB,OAAO,EAAA,GAAA,EAIgC,OAJhC,EAAA,GAI4C,WAJ5C,CAAA,IAAA,CAAA;AAGP,KAEA,YAAA,GAFiB,CAAA,GAAA,EAEI,QAFJ,EAAA,GAAA,EAEmB,OAFnB,EAAA,GAE+B,WAF/B,CAAA,IAAA,CAAA;AAAS,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D,QdzH6D,EAAA,GAAA,SAAA;EAAO,MAAA,CAAA,EAAA,GAAA,Gc0H9D,gBd1H8D;EAEnE,SAAA,CAAA,EAAA,MAAS,GAAA,SAAA;EAAM,SAAA,CAAA,Ec0Hb,Ud1Ha,CAAA,WAAA,CAAA,GAAA,SAAA;CAAY,CAAA,Ec2HtC,Sd3HsC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,128 +1,134 @@
|
|
|
1
|
-
import { McpServer } from
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
|
|
3
|
+
//#region src/lib/http.d.ts
|
|
3
4
|
type Fetcher = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
4
5
|
type Awaitable$1<T> = T | Promise<T>;
|
|
5
6
|
type RequestInput = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The URL the request will use.
|
|
9
|
+
*/
|
|
10
|
+
url: URL;
|
|
11
|
+
/**
|
|
12
|
+
* Options used to create a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request).
|
|
13
|
+
*/
|
|
14
|
+
options?: RequestInit | undefined;
|
|
14
15
|
};
|
|
15
16
|
interface HTTPClientOptions {
|
|
16
|
-
|
|
17
|
+
fetcher?: Fetcher;
|
|
17
18
|
}
|
|
18
19
|
type BeforeRequestHook$1 = (req: Request) => Awaitable$1<Request | void>;
|
|
19
20
|
type RequestErrorHook = (err: unknown, req: Request) => Awaitable$1<void>;
|
|
20
21
|
type ResponseHook = (res: Response, req: Request) => Awaitable$1<void>;
|
|
21
22
|
declare class HTTPClient {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
23
|
+
private options;
|
|
24
|
+
private fetcher;
|
|
25
|
+
private requestHooks;
|
|
26
|
+
private requestErrorHooks;
|
|
27
|
+
private responseHooks;
|
|
28
|
+
constructor(options?: HTTPClientOptions);
|
|
29
|
+
request(request: Request): Promise<Response>;
|
|
30
|
+
/**
|
|
31
|
+
* Registers a hook that is called before a request is made. The hook function
|
|
32
|
+
* can mutate the request or return a new request. This may be useful to add
|
|
33
|
+
* additional information to request such as request IDs and tracing headers.
|
|
34
|
+
*/
|
|
35
|
+
addHook(hook: 'beforeRequest', fn: BeforeRequestHook$1): this;
|
|
36
|
+
/**
|
|
37
|
+
* Registers a hook that is called when a request cannot be made due to a
|
|
38
|
+
* network error.
|
|
39
|
+
*/
|
|
40
|
+
addHook(hook: 'requestError', fn: RequestErrorHook): this;
|
|
41
|
+
/**
|
|
42
|
+
* Registers a hook that is called when a response has been received from the
|
|
43
|
+
* server.
|
|
44
|
+
*/
|
|
45
|
+
addHook(hook: 'response', fn: ResponseHook): this;
|
|
46
|
+
/** Removes a hook that was previously registered with `addHook`. */
|
|
47
|
+
removeHook(hook: 'beforeRequest', fn: BeforeRequestHook$1): this;
|
|
48
|
+
/** Removes a hook that was previously registered with `addHook`. */
|
|
49
|
+
removeHook(hook: 'requestError', fn: RequestErrorHook): this;
|
|
50
|
+
/** Removes a hook that was previously registered with `addHook`. */
|
|
51
|
+
removeHook(hook: 'response', fn: ResponseHook): this;
|
|
52
|
+
clone(): HTTPClient;
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/lib/logger.d.ts
|
|
54
56
|
interface Logger {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
group(label?: string): void;
|
|
58
|
+
groupEnd(): void;
|
|
59
|
+
log(message: any, ...args: any[]): void;
|
|
58
60
|
}
|
|
59
|
-
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/lib/retries.d.ts
|
|
60
63
|
type BackoffStrategy = {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
initialInterval: number;
|
|
65
|
+
maxInterval: number;
|
|
66
|
+
exponent: number;
|
|
67
|
+
maxElapsedTime: number;
|
|
65
68
|
};
|
|
66
69
|
type RetryConfig = {
|
|
67
|
-
|
|
70
|
+
strategy: 'none';
|
|
68
71
|
} | {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
strategy: 'backoff';
|
|
73
|
+
backoff?: BackoffStrategy;
|
|
74
|
+
retryConnectionErrors?: boolean;
|
|
72
75
|
};
|
|
73
|
-
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/lib/config.d.ts
|
|
74
78
|
type SDKOptions = {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
79
|
+
httpClient?: HTTPClient;
|
|
80
|
+
/**
|
|
81
|
+
* Allows overriding the default server used by the SDK
|
|
82
|
+
*/
|
|
83
|
+
serverIdx?: number | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Allows overriding the default server URL used by the SDK
|
|
86
|
+
*/
|
|
87
|
+
serverURL?: string | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Allows overriding the default user agent used by the SDK
|
|
90
|
+
*/
|
|
91
|
+
userAgent?: string | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Allows overriding the default retry config used by the SDK
|
|
94
|
+
*/
|
|
95
|
+
retryConfig?: RetryConfig;
|
|
96
|
+
timeoutMs?: number;
|
|
97
|
+
debugLogger?: Logger | undefined;
|
|
94
98
|
};
|
|
95
|
-
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/lib/security.d.ts
|
|
96
101
|
type OAuth2PasswordFlow = {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
username: string;
|
|
103
|
+
password: string;
|
|
104
|
+
clientID?: string | undefined;
|
|
105
|
+
clientSecret?: string | undefined;
|
|
106
|
+
tokenURL: string;
|
|
102
107
|
};
|
|
103
108
|
type SecurityState = {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
basic: {
|
|
110
|
+
username?: string | undefined;
|
|
111
|
+
password?: string | undefined;
|
|
112
|
+
};
|
|
113
|
+
headers: Record<string, string>;
|
|
114
|
+
queryParams: Record<string, string>;
|
|
115
|
+
cookies: Record<string, string>;
|
|
116
|
+
oauth2: ({
|
|
117
|
+
type: 'password';
|
|
118
|
+
} & OAuth2PasswordFlow) | {
|
|
119
|
+
type: 'none';
|
|
120
|
+
};
|
|
116
121
|
};
|
|
117
|
-
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/hooks/types.d.ts
|
|
118
124
|
type HookContext = {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
baseURL: string | URL;
|
|
126
|
+
operationID: string;
|
|
127
|
+
oAuth2Scopes: string[] | null;
|
|
128
|
+
securitySource?: any | (() => Promise<any>);
|
|
129
|
+
retryConfig: RetryConfig;
|
|
130
|
+
resolvedSecurity: SecurityState | null;
|
|
131
|
+
options: SDKOptions;
|
|
126
132
|
};
|
|
127
133
|
type Awaitable<T> = T | Promise<T>;
|
|
128
134
|
type BeforeCreateRequestContext = HookContext & {};
|
|
@@ -134,124 +140,127 @@ type AfterErrorContext = HookContext & {};
|
|
|
134
140
|
* hook can return a new baseURL and HTTP client to be used by the SDK.
|
|
135
141
|
*/
|
|
136
142
|
interface SDKInitHook {
|
|
137
|
-
|
|
143
|
+
sdkInit: (opts: SDKOptions) => SDKOptions;
|
|
138
144
|
}
|
|
139
145
|
interface BeforeCreateRequestHook {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
+
/**
|
|
147
|
+
* A hook that is called before the SDK creates a `Request` object. The hook
|
|
148
|
+
* can modify how a request is constructed since certain modifications, like
|
|
149
|
+
* changing the request URL, cannot be done on a request object directly.
|
|
150
|
+
*/
|
|
151
|
+
beforeCreateRequest: (hookCtx: BeforeCreateRequestContext, input: RequestInput) => RequestInput;
|
|
146
152
|
}
|
|
147
153
|
interface BeforeRequestHook {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
/**
|
|
155
|
+
* A hook that is called before the SDK sends a request. The hook can
|
|
156
|
+
* introduce instrumentation code such as logging, tracing and metrics or
|
|
157
|
+
* replace the request before it is sent or throw an error to stop the
|
|
158
|
+
* request from being sent.
|
|
159
|
+
*/
|
|
160
|
+
beforeRequest: (hookCtx: BeforeRequestContext, request: Request) => Awaitable<Request>;
|
|
155
161
|
}
|
|
156
162
|
interface AfterSuccessHook {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
163
|
+
/**
|
|
164
|
+
* A hook that is called after the SDK receives a response. The hook can
|
|
165
|
+
* introduce instrumentation code such as logging, tracing and metrics or
|
|
166
|
+
* modify the response before it is handled or throw an error to stop the
|
|
167
|
+
* response from being handled.
|
|
168
|
+
*/
|
|
169
|
+
afterSuccess: (hookCtx: AfterSuccessContext, response: Response) => Awaitable<Response>;
|
|
164
170
|
}
|
|
165
171
|
interface AfterErrorHook {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
/**
|
|
173
|
+
* A hook that is called after the SDK encounters an error, or a
|
|
174
|
+
* non-successful response. The hook can introduce instrumentation code such
|
|
175
|
+
* as logging, tracing and metrics or modify the response or error values.
|
|
176
|
+
*/
|
|
177
|
+
afterError: (hookCtx: AfterErrorContext, response: Response | null, error: unknown) => Awaitable<{
|
|
178
|
+
response: Response | null;
|
|
179
|
+
error: unknown;
|
|
180
|
+
}>;
|
|
175
181
|
}
|
|
176
182
|
interface Hooks {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
/** Registers a hook to be used by the SDK for initialization event. */
|
|
184
|
+
registerSDKInitHook(hook: SDKInitHook): void;
|
|
185
|
+
/** Registers a hook to be used by the SDK for to modify `Request` construction. */
|
|
186
|
+
registerBeforeCreateRequestHook(hook: BeforeCreateRequestHook): void;
|
|
187
|
+
/** Registers a hook to be used by the SDK for the before request event. */
|
|
188
|
+
registerBeforeRequestHook(hook: BeforeRequestHook): void;
|
|
189
|
+
/** Registers a hook to be used by the SDK for the after success event. */
|
|
190
|
+
registerAfterSuccessHook(hook: AfterSuccessHook): void;
|
|
191
|
+
/** Registers a hook to be used by the SDK for the after error event. */
|
|
192
|
+
registerAfterErrorHook(hook: AfterErrorHook): void;
|
|
187
193
|
}
|
|
188
|
-
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/hooks/hooks.d.ts
|
|
189
196
|
declare class SDKHooks implements Hooks {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
197
|
+
sdkInitHooks: SDKInitHook[];
|
|
198
|
+
beforeCreateRequestHooks: BeforeCreateRequestHook[];
|
|
199
|
+
beforeRequestHooks: BeforeRequestHook[];
|
|
200
|
+
afterSuccessHooks: AfterSuccessHook[];
|
|
201
|
+
afterErrorHooks: AfterErrorHook[];
|
|
202
|
+
constructor();
|
|
203
|
+
registerSDKInitHook(hook: SDKInitHook): void;
|
|
204
|
+
registerBeforeCreateRequestHook(hook: BeforeCreateRequestHook): void;
|
|
205
|
+
registerBeforeRequestHook(hook: BeforeRequestHook): void;
|
|
206
|
+
registerAfterSuccessHook(hook: AfterSuccessHook): void;
|
|
207
|
+
registerAfterErrorHook(hook: AfterErrorHook): void;
|
|
208
|
+
sdkInit(opts: SDKOptions): SDKOptions;
|
|
209
|
+
beforeCreateRequest(hookCtx: BeforeCreateRequestContext, input: RequestInput): RequestInput;
|
|
210
|
+
beforeRequest(hookCtx: BeforeRequestContext, request: Request): Promise<Request>;
|
|
211
|
+
afterSuccess(hookCtx: AfterSuccessContext, response: Response): Promise<Response>;
|
|
212
|
+
afterError(hookCtx: AfterErrorContext, response: Response | null, error: unknown): Promise<{
|
|
213
|
+
response: Response | null;
|
|
214
|
+
error: unknown;
|
|
215
|
+
}>;
|
|
209
216
|
}
|
|
210
|
-
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region src/models/errors/httpclienterrors.d.ts
|
|
211
219
|
/**
|
|
212
220
|
* Base class for all HTTP errors.
|
|
213
221
|
*/
|
|
214
222
|
declare class HTTPClientError extends Error {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
223
|
+
/** The underlying cause of the error. */
|
|
224
|
+
readonly cause: unknown;
|
|
225
|
+
name: string;
|
|
226
|
+
constructor(message: string, opts?: {
|
|
227
|
+
cause?: unknown;
|
|
228
|
+
});
|
|
221
229
|
}
|
|
222
230
|
/**
|
|
223
231
|
* An error to capture unrecognised or unexpected errors when making HTTP calls.
|
|
224
232
|
*/
|
|
225
233
|
declare class UnexpectedClientError extends HTTPClientError {
|
|
226
|
-
|
|
234
|
+
name: string;
|
|
227
235
|
}
|
|
228
236
|
/**
|
|
229
237
|
* An error that is raised when any inputs used to create a request are invalid.
|
|
230
238
|
*/
|
|
231
239
|
declare class InvalidRequestError extends HTTPClientError {
|
|
232
|
-
|
|
240
|
+
name: string;
|
|
233
241
|
}
|
|
234
242
|
/**
|
|
235
243
|
* An error that is raised when a HTTP request was aborted by the client error.
|
|
236
244
|
*/
|
|
237
245
|
declare class RequestAbortedError extends HTTPClientError {
|
|
238
|
-
|
|
246
|
+
readonly name = "RequestAbortedError";
|
|
239
247
|
}
|
|
240
248
|
/**
|
|
241
249
|
* An error that is raised when a HTTP request timed out due to an AbortSignal
|
|
242
250
|
* signal timeout.
|
|
243
251
|
*/
|
|
244
252
|
declare class RequestTimeoutError extends HTTPClientError {
|
|
245
|
-
|
|
253
|
+
readonly name = "RequestTimeoutError";
|
|
246
254
|
}
|
|
247
255
|
/**
|
|
248
256
|
* An error that is raised when a HTTP client is unable to make a request to
|
|
249
257
|
* a server.
|
|
250
258
|
*/
|
|
251
259
|
declare class ConnectionError extends HTTPClientError {
|
|
252
|
-
|
|
260
|
+
readonly name = "ConnectionError";
|
|
253
261
|
}
|
|
254
|
-
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region src/lib/result.d.ts
|
|
255
264
|
/**
|
|
256
265
|
* A monad that captures the result of a function call or an error if it was not
|
|
257
266
|
* successful. Railway programming, enabled by this type, can be a nicer
|
|
@@ -262,108 +271,112 @@ declare class ConnectionError extends HTTPClientError {
|
|
|
262
271
|
* inspect and more verbose work with due to try-catch blocks.
|
|
263
272
|
*/
|
|
264
273
|
type Result<T, E = unknown> = {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
274
|
+
ok: true;
|
|
275
|
+
value: T;
|
|
276
|
+
error?: never;
|
|
268
277
|
} | {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
278
|
+
ok: false;
|
|
279
|
+
value?: never;
|
|
280
|
+
error: E;
|
|
272
281
|
};
|
|
273
|
-
|
|
282
|
+
//#endregion
|
|
283
|
+
//#region src/lib/sdks.d.ts
|
|
274
284
|
type RequestOptions = {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
285
|
+
/**
|
|
286
|
+
* Sets a timeout, in milliseconds, on HTTP requests made by an SDK method. If
|
|
287
|
+
* `fetchOptions.signal` is set then it will take precedence over this option.
|
|
288
|
+
*/
|
|
289
|
+
timeoutMs?: number;
|
|
290
|
+
/**
|
|
291
|
+
* Set or override a retry policy on HTTP calls.
|
|
292
|
+
*/
|
|
293
|
+
retries?: RetryConfig;
|
|
294
|
+
/**
|
|
295
|
+
* Specifies the status codes which should be retried using the given retry policy.
|
|
296
|
+
*/
|
|
297
|
+
retryCodes?: string[];
|
|
298
|
+
/**
|
|
299
|
+
* Overrides the base server URL that will be used by an operation.
|
|
300
|
+
*/
|
|
301
|
+
serverURL?: string | URL;
|
|
302
|
+
/**
|
|
303
|
+
* @deprecated `fetchOptions` has been flattened into `RequestOptions`.
|
|
304
|
+
*
|
|
305
|
+
* Sets various request options on the `fetch` call made by an SDK method.
|
|
306
|
+
*
|
|
307
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options|Request}
|
|
308
|
+
*/
|
|
309
|
+
fetchOptions?: Omit<RequestInit, 'method' | 'body'>;
|
|
300
310
|
} & Omit<RequestInit, 'method' | 'body'>;
|
|
301
311
|
type RequestConfig = {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
+
method: string;
|
|
313
|
+
path: string;
|
|
314
|
+
baseURL?: string | URL | undefined;
|
|
315
|
+
query?: string;
|
|
316
|
+
body?: RequestInit['body'];
|
|
317
|
+
headers?: HeadersInit;
|
|
318
|
+
security?: SecurityState | null;
|
|
319
|
+
uaHeader?: string;
|
|
320
|
+
userAgent?: string | undefined;
|
|
321
|
+
timeoutMs?: number;
|
|
312
322
|
};
|
|
313
323
|
declare class ClientSDK {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
324
|
+
#private;
|
|
325
|
+
readonly _baseURL: URL | null;
|
|
326
|
+
readonly _options: SDKOptions & {
|
|
327
|
+
hooks?: SDKHooks;
|
|
328
|
+
};
|
|
329
|
+
constructor(options?: SDKOptions);
|
|
330
|
+
_createRequest(context: HookContext, conf: RequestConfig, options?: RequestOptions): Result<Request, InvalidRequestError | UnexpectedClientError>;
|
|
331
|
+
_do(request: Request, options: {
|
|
332
|
+
context: HookContext;
|
|
333
|
+
errorCodes: number | string | (number | string)[];
|
|
334
|
+
retryConfig: RetryConfig;
|
|
335
|
+
retryCodes: string[];
|
|
336
|
+
}): Promise<Result<Response, RequestAbortedError | RequestTimeoutError | ConnectionError | UnexpectedClientError>>;
|
|
327
337
|
}
|
|
328
|
-
|
|
338
|
+
//#endregion
|
|
339
|
+
//#region src/core.d.ts
|
|
329
340
|
/**
|
|
330
341
|
* A minimal client to use when calling standalone SDK functions. Typically, an
|
|
331
342
|
* instance of this class would be instantiated once at the start of an
|
|
332
343
|
* application and passed around through some dependency injection mechanism to
|
|
333
344
|
* parts of an application that need to make SDK calls.
|
|
334
345
|
*/
|
|
335
|
-
declare class InkeepAgentsCore extends ClientSDK {
|
|
336
|
-
|
|
337
|
-
|
|
346
|
+
declare class InkeepAgentsCore extends ClientSDK {}
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region src/hooks/header-forwarding-hook.d.ts
|
|
338
349
|
/**
|
|
339
350
|
* HeaderForwardingHook forwards specified headers from incoming requests to outgoing SDK requests.
|
|
340
351
|
* Used to propagate authentication headers (like cookies) through the MCP server to the downstream API.
|
|
341
352
|
*/
|
|
342
353
|
declare class HeaderForwardingHook implements BeforeRequestHook {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
354
|
+
private headersToForward;
|
|
355
|
+
constructor(headersToForward: Record<string, string>);
|
|
356
|
+
beforeRequest(_hookCtx: BeforeRequestContext, request: Request): Promise<Request>;
|
|
346
357
|
}
|
|
347
|
-
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region src/mcp-server/console-logger.d.ts
|
|
348
360
|
declare const consoleLoggerLevels: readonly ["debug", "warning", "info", "error"];
|
|
349
361
|
type ConsoleLoggerLevel = (typeof consoleLoggerLevels)[number];
|
|
350
|
-
type ConsoleLogger = {
|
|
351
|
-
|
|
352
|
-
} & {
|
|
353
|
-
level: ConsoleLoggerLevel;
|
|
362
|
+
type ConsoleLogger = { [key in ConsoleLoggerLevel]: (message: string, data?: Record<string, unknown>) => void } & {
|
|
363
|
+
level: ConsoleLoggerLevel;
|
|
354
364
|
};
|
|
355
365
|
declare function createConsoleLogger(level: ConsoleLoggerLevel): ConsoleLogger;
|
|
356
|
-
|
|
366
|
+
//#endregion
|
|
367
|
+
//#region src/mcp-server/scopes.d.ts
|
|
357
368
|
declare const mcpScopes: readonly [];
|
|
358
369
|
type MCPScope = (typeof mcpScopes)[number];
|
|
359
|
-
|
|
370
|
+
//#endregion
|
|
371
|
+
//#region src/mcp-server/server.d.ts
|
|
360
372
|
declare function createMCPServer(deps: {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
373
|
+
logger: ConsoleLogger;
|
|
374
|
+
allowedTools?: string[] | undefined;
|
|
375
|
+
scopes?: MCPScope[] | undefined;
|
|
376
|
+
getSDK?: () => InkeepAgentsCore;
|
|
377
|
+
serverURL?: string | undefined;
|
|
378
|
+
serverIdx?: SDKOptions['serverIdx'] | undefined;
|
|
367
379
|
}): McpServer;
|
|
368
|
-
|
|
380
|
+
//#endregion
|
|
369
381
|
export { type BeforeCreateRequestContext, type BeforeCreateRequestHook, type BeforeRequestContext, type BeforeRequestHook, type ConsoleLogger, type ConsoleLoggerLevel, HeaderForwardingHook, InkeepAgentsCore, SDKHooks, type SDKOptions, createConsoleLogger, createMCPServer };
|
|
382
|
+
//# sourceMappingURL=index.d.ts.map
|