agent0-js 0.0.14 → 1.0.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/README.md CHANGED
@@ -91,6 +91,9 @@ interface RunOptions {
91
91
  overrides?: ModelOverrides; // Runtime model configuration overrides
92
92
  extraMessages?: Message[]; // Extra messages to append to the prompt
93
93
  extraTools?: CustomTool[]; // Additional custom tools to add at runtime
94
+ mcpOptions?: Record<string, { // Per-MCP server runtime options (keyed by MCP ID)
95
+ headers?: Record<string, string>; // Custom HTTP headers to send with MCP requests
96
+ }>;
94
97
  }
95
98
 
96
99
  interface CustomTool {
@@ -738,6 +741,54 @@ for await (const chunk of stream) {
738
741
  }
739
742
  ```
740
743
 
744
+ ### MCP Custom Headers (`mcpOptions`)
745
+
746
+ If your MCP servers require dynamic headers at runtime (e.g., authentication tokens, tenant IDs), you can pass them via `mcpOptions`. First, configure the header names on your MCP server in the Agent0 dashboard (under **Custom Headers**), then provide the values at runtime.
747
+
748
+ Headers are keyed by MCP server ID:
749
+
750
+ ```typescript
751
+ const response = await client.generate({
752
+ agentId: 'agent_123',
753
+ mcpOptions: {
754
+ 'mcp-server-id-1': {
755
+ headers: {
756
+ 'X-User-Token': 'bearer-token-here',
757
+ 'X-Tenant-Id': 'tenant-456'
758
+ }
759
+ },
760
+ 'mcp-server-id-2': {
761
+ headers: {
762
+ 'Authorization': 'Bearer another-token'
763
+ }
764
+ }
765
+ }
766
+ });
767
+ ```
768
+
769
+ **Streaming with Custom Headers:**
770
+
771
+ ```typescript
772
+ const stream = client.stream({
773
+ agentId: 'agent_123',
774
+ mcpOptions: {
775
+ 'mcp-server-id': {
776
+ headers: {
777
+ 'X-User-Token': userSession.token
778
+ }
779
+ }
780
+ }
781
+ });
782
+
783
+ for await (const chunk of stream) {
784
+ if (chunk.type === 'text-delta') {
785
+ process.stdout.write(chunk.textDelta);
786
+ }
787
+ }
788
+ ```
789
+
790
+ > ⚠️ **Note**: Only header names that are pre-configured as "Custom Headers" on the MCP server will be sent. Any extra headers not in the allowed list are ignored.
791
+
741
792
  ### Error Handling
742
793
 
743
794
  ```typescript
package/dist/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { BedrockProviderOptions } from "@ai-sdk/amazon-bedrock";
1
2
  import type { GoogleGenerativeAIProviderOptions } from "@ai-sdk/google";
2
3
  import type { OpenAIResponsesProviderOptions } from "@ai-sdk/openai";
3
4
  import type { XaiProviderOptions } from "@ai-sdk/xai";
@@ -19,6 +20,8 @@ export interface ProviderOptions {
19
20
  xai?: XaiProviderOptions;
20
21
  /** Google/Vertex thinking configuration */
21
22
  google?: GoogleGenerativeAIProviderOptions;
23
+ /** Amazon Bedrock thinking configuration */
24
+ bedrock?: BedrockProviderOptions;
22
25
  }
23
26
  /**
24
27
  * Model configuration overrides for runtime customization.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent0-js",
3
- "version": "0.0.14",
3
+ "version": "1.0.0",
4
4
  "description": "TypeScript SDK for Agent0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -17,6 +17,7 @@
17
17
  "typescript": "^5.0.0"
18
18
  },
19
19
  "dependencies": {
20
+ "@ai-sdk/amazon-bedrock": "^3.0.72",
20
21
  "@ai-sdk/google": "3.0.0",
21
22
  "@ai-sdk/openai": "3.0.0",
22
23
  "@ai-sdk/xai": "3.0.0",
package/src/index.ts CHANGED
@@ -61,6 +61,7 @@ export class Agent0 {
61
61
  overrides: options.overrides,
62
62
  extra_messages: options.extraMessages,
63
63
  extra_tools: options.extraTools,
64
+ mcp_options: options.mcpOptions,
64
65
  stream: false,
65
66
  });
66
67
 
@@ -77,6 +78,7 @@ export class Agent0 {
77
78
  overrides: options.overrides,
78
79
  extra_messages: options.extraMessages,
79
80
  extra_tools: options.extraTools,
81
+ mcp_options: options.mcpOptions,
80
82
  stream: true,
81
83
  });
82
84
 
package/src/types.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { BedrockProviderOptions } from "@ai-sdk/amazon-bedrock";
1
2
  import type { GoogleGenerativeAIProviderOptions } from "@ai-sdk/google";
2
3
  import type { OpenAIResponsesProviderOptions } from "@ai-sdk/openai";
3
4
  import type { XaiProviderOptions } from "@ai-sdk/xai";
@@ -21,6 +22,8 @@ export interface ProviderOptions {
21
22
  xai?: XaiProviderOptions;
22
23
  /** Google/Vertex thinking configuration */
23
24
  google?: GoogleGenerativeAIProviderOptions;
25
+ /** Amazon Bedrock thinking configuration */
26
+ bedrock?: BedrockProviderOptions;
24
27
  }
25
28
 
26
29
  /**
@@ -75,6 +78,11 @@ export interface RunOptions {
75
78
  extraMessages?: ModelMessage[];
76
79
  /** Additional custom tools to add at runtime. These are merged with any tools defined in the agent. */
77
80
  extraTools?: CustomTool[];
81
+ /** Per-MCP server runtime options, keyed by MCP server ID. */
82
+ mcpOptions?: Record<string, {
83
+ /** Custom headers to send to this MCP server */
84
+ headers?: Record<string, string>;
85
+ }>;
78
86
  }
79
87
 
80
88
  export interface GenerateResponse {