-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathmcp-servers.ts
More file actions
413 lines (344 loc) · 9.3 KB
/
mcp-servers.ts
File metadata and controls
413 lines (344 loc) · 9.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import * as ToolsAPI from './tools';
import { ToolListResponse, ToolRetrieveParams, ToolRunParams, Tools } from './tools';
import { APIPromise } from '../../core/api-promise';
import { buildHeaders } from '../../internal/headers';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
export class McpServers extends APIResource {
tools: ToolsAPI.Tools = new ToolsAPI.Tools(this._client);
/**
* Add a new MCP server to the Letta MCP server config
*/
create(body: McpServerCreateParams, options?: RequestOptions): APIPromise<McpServerCreateResponse> {
return this._client.post('/v1/mcp-servers/', { body, ...options });
}
/**
* Get a specific MCP server
*/
retrieve(mcpServerID: string, options?: RequestOptions): APIPromise<McpServerRetrieveResponse> {
return this._client.get(path`/v1/mcp-servers/${mcpServerID}`, options);
}
/**
* Update an existing MCP server configuration
*/
update(
mcpServerID: string,
body: McpServerUpdateParams,
options?: RequestOptions,
): APIPromise<McpServerUpdateResponse> {
return this._client.patch(path`/v1/mcp-servers/${mcpServerID}`, { body, ...options });
}
/**
* Get a list of all configured MCP servers
*/
list(options?: RequestOptions): APIPromise<McpServerListResponse> {
return this._client.get('/v1/mcp-servers/', options);
}
/**
* Delete an MCP server by its ID
*/
delete(mcpServerID: string, options?: RequestOptions): APIPromise<void> {
return this._client.delete(path`/v1/mcp-servers/${mcpServerID}`, {
...options,
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
});
}
/**
* Refresh tools for an MCP server by:
*
* 1. Fetching current tools from the MCP server
* 2. Deleting tools that no longer exist on the server
* 3. Updating schemas for existing tools
* 4. Adding new tools from the server
*
* Returns a summary of changes made.
*/
refresh(
mcpServerID: string,
params: McpServerRefreshParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<unknown> {
const { agent_id } = params ?? {};
return this._client.patch(path`/v1/mcp-servers/${mcpServerID}/refresh`, {
query: { agent_id },
...options,
});
}
}
/**
* Create a new SSE MCP server
*/
export interface CreateSseMcpServer {
/**
* The URL of the server
*/
server_url: string;
/**
* The name of the authentication header (e.g., 'Authorization')
*/
auth_header?: string | null;
/**
* The authentication token or API key value
*/
auth_token?: string | null;
/**
* Custom HTTP headers to include with requests
*/
custom_headers?: { [key: string]: string } | null;
mcp_server_type?: 'sse';
}
/**
* Create a new Stdio MCP server
*/
export interface CreateStdioMcpServer {
/**
* The arguments to pass to the command
*/
args: Array<string>;
/**
* The command to run (MCP 'local' client will run this command)
*/
command: string;
/**
* Environment variables to set
*/
env?: { [key: string]: string } | null;
mcp_server_type?: 'stdio';
}
/**
* Create a new Streamable HTTP MCP server
*/
export interface CreateStreamableHTTPMcpServer {
/**
* The URL of the server
*/
server_url: string;
/**
* The name of the authentication header (e.g., 'Authorization')
*/
auth_header?: string | null;
/**
* The authentication token or API key value
*/
auth_token?: string | null;
/**
* Custom HTTP headers to include with requests
*/
custom_headers?: { [key: string]: string } | null;
mcp_server_type?: 'streamable_http';
}
/**
* An SSE MCP server
*/
export interface SseMcpServer {
/**
* The name of the MCP server
*/
server_name: string;
/**
* The URL of the server
*/
server_url: string;
/**
* The human-friendly ID of the Mcp_server
*/
id?: string;
/**
* The name of the authentication header (e.g., 'Authorization')
*/
auth_header?: string | null;
/**
* The authentication token or API key value
*/
auth_token?: string | null;
/**
* Custom HTTP headers to include with requests
*/
custom_headers?: { [key: string]: string } | null;
mcp_server_type?: 'sse';
}
/**
* A Stdio MCP server
*/
export interface StdioMcpServer {
/**
* The arguments to pass to the command
*/
args: Array<string>;
/**
* The command to run (MCP 'local' client will run this command)
*/
command: string;
/**
* The name of the MCP server
*/
server_name: string;
/**
* The human-friendly ID of the Mcp_server
*/
id?: string;
/**
* Environment variables to set
*/
env?: { [key: string]: string } | null;
mcp_server_type?: 'stdio';
}
/**
* A Streamable HTTP MCP server
*/
export interface StreamableHTTPMcpServer {
/**
* The name of the MCP server
*/
server_name: string;
/**
* The URL of the server
*/
server_url: string;
/**
* The human-friendly ID of the Mcp_server
*/
id?: string;
/**
* The name of the authentication header (e.g., 'Authorization')
*/
auth_header?: string | null;
/**
* The authentication token or API key value
*/
auth_token?: string | null;
/**
* Custom HTTP headers to include with requests
*/
custom_headers?: { [key: string]: string } | null;
mcp_server_type?: 'streamable_http';
}
/**
* Update schema for SSE MCP server - all fields optional
*/
export interface UpdateSseMcpServer {
/**
* The URL of the server
*/
server_url: string | null;
/**
* The name of the authentication header (e.g., 'Authorization')
*/
auth_header?: string | null;
/**
* The authentication token or API key value
*/
auth_token?: string | null;
/**
* Custom HTTP headers to include with requests
*/
custom_headers?: { [key: string]: string } | null;
mcp_server_type?: 'sse';
}
/**
* Update schema for Stdio MCP server - all fields optional
*/
export interface UpdateStdioMcpServer {
/**
* The arguments to pass to the command
*/
args: Array<string> | null;
/**
* The command to run (MCP 'local' client will run this command)
*/
command: string | null;
/**
* Environment variables to set
*/
env?: { [key: string]: string } | null;
mcp_server_type?: 'stdio';
}
/**
* Update schema for Streamable HTTP MCP server - all fields optional
*/
export interface UpdateStreamableHTTPMcpServer {
/**
* The URL of the server
*/
server_url: string | null;
/**
* The name of the authentication header (e.g., 'Authorization')
*/
auth_header?: string | null;
/**
* The authentication token or API key value
*/
auth_token?: string | null;
/**
* Custom HTTP headers to include with requests
*/
custom_headers?: { [key: string]: string } | null;
mcp_server_type?: 'streamable_http';
}
/**
* A Stdio MCP server
*/
export type McpServerCreateResponse = StdioMcpServer | SseMcpServer | StreamableHTTPMcpServer;
/**
* A Stdio MCP server
*/
export type McpServerRetrieveResponse = StdioMcpServer | SseMcpServer | StreamableHTTPMcpServer;
/**
* A Stdio MCP server
*/
export type McpServerUpdateResponse = StdioMcpServer | SseMcpServer | StreamableHTTPMcpServer;
export type McpServerListResponse = Array<StdioMcpServer | SseMcpServer | StreamableHTTPMcpServer>;
export type McpServerRefreshResponse = unknown;
export interface McpServerCreateParams {
/**
* The MCP server configuration (Stdio, SSE, or Streamable HTTP)
*/
config: CreateStdioMcpServer | CreateSseMcpServer | CreateStreamableHTTPMcpServer;
/**
* The name of the MCP server
*/
server_name: string;
}
export interface McpServerUpdateParams {
/**
* The MCP server configuration updates (Stdio, SSE, or Streamable HTTP)
*/
config: UpdateStdioMcpServer | UpdateSseMcpServer | UpdateStreamableHTTPMcpServer;
/**
* The name of the MCP server
*/
server_name?: string | null;
}
export interface McpServerRefreshParams {
agent_id?: string | null;
}
McpServers.Tools = Tools;
export declare namespace McpServers {
export {
type CreateSseMcpServer as CreateSseMcpServer,
type CreateStdioMcpServer as CreateStdioMcpServer,
type CreateStreamableHTTPMcpServer as CreateStreamableHTTPMcpServer,
type SseMcpServer as SseMcpServer,
type StdioMcpServer as StdioMcpServer,
type StreamableHTTPMcpServer as StreamableHTTPMcpServer,
type UpdateSseMcpServer as UpdateSseMcpServer,
type UpdateStdioMcpServer as UpdateStdioMcpServer,
type UpdateStreamableHTTPMcpServer as UpdateStreamableHTTPMcpServer,
type McpServerCreateResponse as McpServerCreateResponse,
type McpServerRetrieveResponse as McpServerRetrieveResponse,
type McpServerUpdateResponse as McpServerUpdateResponse,
type McpServerListResponse as McpServerListResponse,
type McpServerRefreshResponse as McpServerRefreshResponse,
type McpServerCreateParams as McpServerCreateParams,
type McpServerUpdateParams as McpServerUpdateParams,
type McpServerRefreshParams as McpServerRefreshParams,
};
export {
Tools as Tools,
type ToolListResponse as ToolListResponse,
type ToolRetrieveParams as ToolRetrieveParams,
type ToolRunParams as ToolRunParams,
};
}