@sourcegraph/amp-sdk 0.1.0-20260123161216-g2f422d1 → 0.1.0-20260124003735-gfa566b5

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/README.md CHANGED
@@ -843,20 +843,26 @@ interface UserInputMessage {
843
843
 
844
844
  ### MCPConfig
845
845
 
846
- Configuration for MCP (Model Context Protocol) servers.
846
+ Configuration for MCP (Model Context Protocol) servers. Supports both stdio-based and HTTP-based servers.
847
847
 
848
848
  ```typescript
849
849
  type MCPConfig = Record<string, MCPServer>
850
850
 
851
- interface MCPServer {
852
- command: string
853
- args?: string[]
854
- env?: Record<string, string>
855
- disabled?: boolean
851
+ // MCPServer is a union of stdio and HTTP server configurations
852
+ ```
853
+
854
+ `MCPServer` accepts either a stdio server config (with `command`) or an HTTP server config (with `url`):
855
+
856
+ ```typescript
857
+ const mcpConfig: MCPConfig = {
858
+ playwright: { command: 'npx', args: ['-y', '@playwright/mcp'] },
859
+ remote: { url: 'https://api.example.com/mcp' },
856
860
  }
857
861
  ```
858
862
 
859
- #### Properties
863
+ #### MCPServer Properties
864
+
865
+ **Stdio server:**
860
866
 
861
867
  | Property | Type | Required | Description |
862
868
  | ---------- | ------------------------ | -------- | ------------------------------------ |
@@ -865,6 +871,27 @@ interface MCPServer {
865
871
  | `env` | `Record<string, string>` | No | Environment variables for the server |
866
872
  | `disabled` | `boolean` | No | Whether this server is disabled |
867
873
 
874
+ **HTTP server:**
875
+
876
+ | Property | Type | Required | Description |
877
+ | ----------- | ------------------------ | -------- | -------------------------------------- |
878
+ | `url` | `string` | Yes | URL of the HTTP MCP server |
879
+ | `headers` | `Record<string, string>` | No | HTTP headers to send with requests |
880
+ | `transport` | `string` | No | Transport type (e.g., "sse") |
881
+ | `oauth` | `object` | No | OAuth configuration for authentication |
882
+ | `disabled` | `boolean` | No | Whether this server is disabled |
883
+
884
+ **OAuth config (for HTTP servers):**
885
+
886
+ | Property | Type | Required | Description |
887
+ | -------------- | ---------- | -------- | ----------------------- |
888
+ | `clientId` | `string` | Yes | OAuth client ID |
889
+ | `clientSecret` | `string` | No | OAuth client secret |
890
+ | `authUrl` | `string` | Yes | OAuth authorization URL |
891
+ | `tokenUrl` | `string` | Yes | OAuth token URL |
892
+ | `scopes` | `string[]` | No | OAuth scopes |
893
+ | `redirectUrl` | `string` | No | OAuth redirect URL |
894
+
868
895
  ### Permission
869
896
 
870
897
  Individual permission rule for controlling tool usage.
package/dist/index.js CHANGED
@@ -4032,12 +4032,28 @@ var PermissionSchema = exports_external.object({
4032
4032
  });
4033
4033
  }
4034
4034
  });
4035
- var MCPServerSchema = exports_external.object({
4035
+ var MCPOAuthConfigSchema = exports_external.object({
4036
+ clientId: exports_external.string().describe("OAuth client ID"),
4037
+ clientSecret: exports_external.string().describe("OAuth client secret").optional(),
4038
+ authUrl: exports_external.string().describe("OAuth authorization URL"),
4039
+ tokenUrl: exports_external.string().describe("OAuth token URL"),
4040
+ scopes: exports_external.array(exports_external.string()).describe("OAuth scopes").optional(),
4041
+ redirectUrl: exports_external.string().describe("OAuth redirect URL").optional()
4042
+ }).describe("OAuth configuration for HTTP MCP servers");
4043
+ var MCPStdioServerSchema = exports_external.object({
4036
4044
  command: exports_external.string().describe("Command to run the MCP server"),
4037
4045
  args: exports_external.array(exports_external.string()).describe("Arguments for the MCP server command").optional(),
4038
4046
  env: exports_external.record(exports_external.string(), exports_external.string()).describe("Environment variables for the server").optional(),
4039
4047
  disabled: exports_external.boolean().describe("Whether the server is disabled").optional()
4040
4048
  });
4049
+ var MCPHttpServerSchema = exports_external.object({
4050
+ url: exports_external.string().describe("URL of the HTTP MCP server"),
4051
+ headers: exports_external.record(exports_external.string(), exports_external.string()).describe("HTTP headers to send with requests").optional(),
4052
+ transport: exports_external.string().describe('Transport type (e.g., "sse")').optional(),
4053
+ oauth: MCPOAuthConfigSchema.describe("OAuth configuration for authentication").optional(),
4054
+ disabled: exports_external.boolean().describe("Whether the server is disabled").optional()
4055
+ });
4056
+ var MCPServerSchema = exports_external.union([MCPStdioServerSchema, MCPHttpServerSchema]);
4041
4057
  var MCPConfigSchema = exports_external.record(exports_external.string(), MCPServerSchema).describe("MCP server configurations keyed by server name");
4042
4058
  var AmpOptionsSchema = exports_external.object({
4043
4059
  cwd: exports_external.string().describe("Current working directory").optional(),
@@ -4180,7 +4196,7 @@ function buildEnvironmentVariables(options) {
4180
4196
  if (options.env) {
4181
4197
  Object.assign(env, options.env);
4182
4198
  }
4183
- env.AMP_SDK_VERSION = "0.1.0-20260123161216-g2f422d1";
4199
+ env.AMP_SDK_VERSION = "0.1.0-20260124003735-gfa566b5";
4184
4200
  return env;
4185
4201
  }
4186
4202
  function spawnAmpCli(args, options) {
@@ -4384,4 +4400,4 @@ export {
4384
4400
  AmpOptionsSchema
4385
4401
  };
4386
4402
 
4387
- //# debugId=EF5EB93EB4F4BB2064756E2164756E21
4403
+ //# debugId=0A3D5327B9004F5564756E2164756E21
package/dist/types.d.ts CHANGED
@@ -36,6 +36,8 @@ interface BaseMessage {
36
36
  type: 'system' | 'assistant' | 'user' | 'result';
37
37
  session_id: string;
38
38
  }
39
+ /** MCP server connection status */
40
+ export type MCPConnectionStatus = 'awaiting-approval' | 'authenticating' | 'connecting' | 'reconnecting' | 'connected' | 'denied' | 'failed' | 'blocked-by-registry';
39
41
  /** System initialization message containing session info and available tools */
40
42
  export interface SystemMessage extends BaseMessage {
41
43
  type: 'system';
@@ -44,7 +46,7 @@ export interface SystemMessage extends BaseMessage {
44
46
  tools: string[];
45
47
  mcp_servers: {
46
48
  name: string;
47
- status: 'connected' | 'connecting' | 'connection-failed' | 'disabled';
49
+ status: MCPConnectionStatus;
48
50
  }[];
49
51
  }
50
52
  /** AI assistant response message with text and tool usage */
@@ -184,41 +186,147 @@ export declare const PermissionSchema: z.ZodEffects<z.ZodObject<{
184
186
  export type Permission = z.infer<typeof PermissionSchema>;
185
187
  /** Permissions list */
186
188
  export type PermissionsList = Permission[];
187
- /** MCP server configuration schema */
188
- export declare const MCPServerSchema: z.ZodObject<{
189
+ /** MCP server configuration schema (stdio or HTTP) */
190
+ export declare const MCPServerSchema: z.ZodUnion<[z.ZodObject<{
189
191
  command: z.ZodString;
190
192
  args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
191
193
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
192
194
  disabled: z.ZodOptional<z.ZodBoolean>;
193
195
  }, "strip", z.ZodTypeAny, {
194
196
  command: string;
195
- disabled?: boolean | undefined;
196
197
  args?: string[] | undefined;
197
198
  env?: Record<string, string> | undefined;
199
+ disabled?: boolean | undefined;
198
200
  }, {
199
201
  command: string;
200
- disabled?: boolean | undefined;
201
202
  args?: string[] | undefined;
202
203
  env?: Record<string, string> | undefined;
203
- }>;
204
+ disabled?: boolean | undefined;
205
+ }>, z.ZodObject<{
206
+ url: z.ZodString;
207
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
208
+ transport: z.ZodOptional<z.ZodString>;
209
+ oauth: z.ZodOptional<z.ZodObject<{
210
+ clientId: z.ZodString;
211
+ clientSecret: z.ZodOptional<z.ZodString>;
212
+ authUrl: z.ZodString;
213
+ tokenUrl: z.ZodString;
214
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
215
+ redirectUrl: z.ZodOptional<z.ZodString>;
216
+ }, "strip", z.ZodTypeAny, {
217
+ clientId: string;
218
+ authUrl: string;
219
+ tokenUrl: string;
220
+ clientSecret?: string | undefined;
221
+ scopes?: string[] | undefined;
222
+ redirectUrl?: string | undefined;
223
+ }, {
224
+ clientId: string;
225
+ authUrl: string;
226
+ tokenUrl: string;
227
+ clientSecret?: string | undefined;
228
+ scopes?: string[] | undefined;
229
+ redirectUrl?: string | undefined;
230
+ }>>;
231
+ disabled: z.ZodOptional<z.ZodBoolean>;
232
+ }, "strip", z.ZodTypeAny, {
233
+ url: string;
234
+ disabled?: boolean | undefined;
235
+ headers?: Record<string, string> | undefined;
236
+ transport?: string | undefined;
237
+ oauth?: {
238
+ clientId: string;
239
+ authUrl: string;
240
+ tokenUrl: string;
241
+ clientSecret?: string | undefined;
242
+ scopes?: string[] | undefined;
243
+ redirectUrl?: string | undefined;
244
+ } | undefined;
245
+ }, {
246
+ url: string;
247
+ disabled?: boolean | undefined;
248
+ headers?: Record<string, string> | undefined;
249
+ transport?: string | undefined;
250
+ oauth?: {
251
+ clientId: string;
252
+ authUrl: string;
253
+ tokenUrl: string;
254
+ clientSecret?: string | undefined;
255
+ scopes?: string[] | undefined;
256
+ redirectUrl?: string | undefined;
257
+ } | undefined;
258
+ }>]>;
204
259
  /** MCP configuration schema */
205
- export declare const MCPConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
260
+ export declare const MCPConfigSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
206
261
  command: z.ZodString;
207
262
  args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
208
263
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
209
264
  disabled: z.ZodOptional<z.ZodBoolean>;
210
265
  }, "strip", z.ZodTypeAny, {
211
266
  command: string;
212
- disabled?: boolean | undefined;
213
267
  args?: string[] | undefined;
214
268
  env?: Record<string, string> | undefined;
269
+ disabled?: boolean | undefined;
215
270
  }, {
216
271
  command: string;
217
- disabled?: boolean | undefined;
218
272
  args?: string[] | undefined;
219
273
  env?: Record<string, string> | undefined;
220
- }>>;
221
- /** MCP server configuration */
274
+ disabled?: boolean | undefined;
275
+ }>, z.ZodObject<{
276
+ url: z.ZodString;
277
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
278
+ transport: z.ZodOptional<z.ZodString>;
279
+ oauth: z.ZodOptional<z.ZodObject<{
280
+ clientId: z.ZodString;
281
+ clientSecret: z.ZodOptional<z.ZodString>;
282
+ authUrl: z.ZodString;
283
+ tokenUrl: z.ZodString;
284
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
285
+ redirectUrl: z.ZodOptional<z.ZodString>;
286
+ }, "strip", z.ZodTypeAny, {
287
+ clientId: string;
288
+ authUrl: string;
289
+ tokenUrl: string;
290
+ clientSecret?: string | undefined;
291
+ scopes?: string[] | undefined;
292
+ redirectUrl?: string | undefined;
293
+ }, {
294
+ clientId: string;
295
+ authUrl: string;
296
+ tokenUrl: string;
297
+ clientSecret?: string | undefined;
298
+ scopes?: string[] | undefined;
299
+ redirectUrl?: string | undefined;
300
+ }>>;
301
+ disabled: z.ZodOptional<z.ZodBoolean>;
302
+ }, "strip", z.ZodTypeAny, {
303
+ url: string;
304
+ disabled?: boolean | undefined;
305
+ headers?: Record<string, string> | undefined;
306
+ transport?: string | undefined;
307
+ oauth?: {
308
+ clientId: string;
309
+ authUrl: string;
310
+ tokenUrl: string;
311
+ clientSecret?: string | undefined;
312
+ scopes?: string[] | undefined;
313
+ redirectUrl?: string | undefined;
314
+ } | undefined;
315
+ }, {
316
+ url: string;
317
+ disabled?: boolean | undefined;
318
+ headers?: Record<string, string> | undefined;
319
+ transport?: string | undefined;
320
+ oauth?: {
321
+ clientId: string;
322
+ authUrl: string;
323
+ tokenUrl: string;
324
+ clientSecret?: string | undefined;
325
+ scopes?: string[] | undefined;
326
+ redirectUrl?: string | undefined;
327
+ } | undefined;
328
+ }>]>>;
329
+ /** MCP server configuration (stdio or HTTP) */
222
330
  export type MCPServer = z.infer<typeof MCPServerSchema>;
223
331
  /** MCP configuration object */
224
332
  export type MCPConfig = z.infer<typeof MCPConfigSchema>;
@@ -231,22 +339,75 @@ export declare const AmpOptionsSchema: z.ZodObject<{
231
339
  settingsFile: z.ZodOptional<z.ZodString>;
232
340
  logLevel: z.ZodOptional<z.ZodEnum<["debug", "info", "warn", "error", "audit"]>>;
233
341
  logFile: z.ZodOptional<z.ZodString>;
234
- mcpConfig: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
342
+ mcpConfig: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
235
343
  command: z.ZodString;
236
344
  args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
237
345
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
238
346
  disabled: z.ZodOptional<z.ZodBoolean>;
239
347
  }, "strip", z.ZodTypeAny, {
240
348
  command: string;
241
- disabled?: boolean | undefined;
242
349
  args?: string[] | undefined;
243
350
  env?: Record<string, string> | undefined;
351
+ disabled?: boolean | undefined;
244
352
  }, {
245
353
  command: string;
246
- disabled?: boolean | undefined;
247
354
  args?: string[] | undefined;
248
355
  env?: Record<string, string> | undefined;
249
- }>>]>>;
356
+ disabled?: boolean | undefined;
357
+ }>, z.ZodObject<{
358
+ url: z.ZodString;
359
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
360
+ transport: z.ZodOptional<z.ZodString>;
361
+ oauth: z.ZodOptional<z.ZodObject<{
362
+ clientId: z.ZodString;
363
+ clientSecret: z.ZodOptional<z.ZodString>;
364
+ authUrl: z.ZodString;
365
+ tokenUrl: z.ZodString;
366
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
367
+ redirectUrl: z.ZodOptional<z.ZodString>;
368
+ }, "strip", z.ZodTypeAny, {
369
+ clientId: string;
370
+ authUrl: string;
371
+ tokenUrl: string;
372
+ clientSecret?: string | undefined;
373
+ scopes?: string[] | undefined;
374
+ redirectUrl?: string | undefined;
375
+ }, {
376
+ clientId: string;
377
+ authUrl: string;
378
+ tokenUrl: string;
379
+ clientSecret?: string | undefined;
380
+ scopes?: string[] | undefined;
381
+ redirectUrl?: string | undefined;
382
+ }>>;
383
+ disabled: z.ZodOptional<z.ZodBoolean>;
384
+ }, "strip", z.ZodTypeAny, {
385
+ url: string;
386
+ disabled?: boolean | undefined;
387
+ headers?: Record<string, string> | undefined;
388
+ transport?: string | undefined;
389
+ oauth?: {
390
+ clientId: string;
391
+ authUrl: string;
392
+ tokenUrl: string;
393
+ clientSecret?: string | undefined;
394
+ scopes?: string[] | undefined;
395
+ redirectUrl?: string | undefined;
396
+ } | undefined;
397
+ }, {
398
+ url: string;
399
+ disabled?: boolean | undefined;
400
+ headers?: Record<string, string> | undefined;
401
+ transport?: string | undefined;
402
+ oauth?: {
403
+ clientId: string;
404
+ authUrl: string;
405
+ tokenUrl: string;
406
+ clientSecret?: string | undefined;
407
+ scopes?: string[] | undefined;
408
+ redirectUrl?: string | undefined;
409
+ } | undefined;
410
+ }>]>>]>>;
250
411
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
251
412
  continue: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString]>>;
252
413
  toolbox: z.ZodOptional<z.ZodString>;
@@ -295,9 +456,22 @@ export declare const AmpOptionsSchema: z.ZodObject<{
295
456
  logFile?: string | undefined;
296
457
  mcpConfig?: string | Record<string, {
297
458
  command: string;
298
- disabled?: boolean | undefined;
299
459
  args?: string[] | undefined;
300
460
  env?: Record<string, string> | undefined;
461
+ disabled?: boolean | undefined;
462
+ } | {
463
+ url: string;
464
+ disabled?: boolean | undefined;
465
+ headers?: Record<string, string> | undefined;
466
+ transport?: string | undefined;
467
+ oauth?: {
468
+ clientId: string;
469
+ authUrl: string;
470
+ tokenUrl: string;
471
+ clientSecret?: string | undefined;
472
+ scopes?: string[] | undefined;
473
+ redirectUrl?: string | undefined;
474
+ } | undefined;
301
475
  }> | undefined;
302
476
  continue?: string | boolean | undefined;
303
477
  toolbox?: string | undefined;
@@ -322,9 +496,22 @@ export declare const AmpOptionsSchema: z.ZodObject<{
322
496
  logFile?: string | undefined;
323
497
  mcpConfig?: string | Record<string, {
324
498
  command: string;
325
- disabled?: boolean | undefined;
326
499
  args?: string[] | undefined;
327
500
  env?: Record<string, string> | undefined;
501
+ disabled?: boolean | undefined;
502
+ } | {
503
+ url: string;
504
+ disabled?: boolean | undefined;
505
+ headers?: Record<string, string> | undefined;
506
+ transport?: string | undefined;
507
+ oauth?: {
508
+ clientId: string;
509
+ authUrl: string;
510
+ tokenUrl: string;
511
+ clientSecret?: string | undefined;
512
+ scopes?: string[] | undefined;
513
+ redirectUrl?: string | undefined;
514
+ } | undefined;
328
515
  }> | undefined;
329
516
  continue?: string | boolean | undefined;
330
517
  toolbox?: string | undefined;
package/package.json CHANGED
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "type": "module",
46
46
  "types": "dist/index.d.ts",
47
- "version": "0.1.0-20260123161216-g2f422d1",
47
+ "version": "0.1.0-20260124003735-gfa566b5",
48
48
  "scripts": {
49
49
  "build": "bun run scripts/build.ts",
50
50
  "dev": "pnpm exec tsc -b --watch",