@composio/core 0.1.24 → 0.1.25

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.cjs CHANGED
@@ -73,8 +73,34 @@ __export(index_exports, {
73
73
  CreateComposioManagedAuthConfigParamsSchema: () => CreateComposioManagedAuthConfigParamsSchema,
74
74
  CreateCustomAuthConfigParamsSchema: () => CreateCustomAuthConfigParamsSchema,
75
75
  CustomAuthParamsSchema: () => CustomAuthParamsSchema,
76
+ CustomCreateResponseCamelCaseSchema: () => CustomCreateResponseCamelCaseSchema,
77
+ CustomCreateResponseSchema: () => CustomCreateResponseSchema,
78
+ GenerateURLParamsSchema: () => GenerateURLParamsSchema,
79
+ GenerateURLParamsSnakeCaseSchema: () => GenerateURLParamsSnakeCaseSchema,
80
+ GenerateURLResponseCamelCaseSchema: () => GenerateURLResponseCamelCaseSchema,
81
+ GenerateURLResponseSchema: () => GenerateURLResponseSchema,
76
82
  IncomingTriggerPayloadSchema: () => IncomingTriggerPayloadSchema,
77
83
  JsonSchemaToZodError: () => JsonSchemaToZodError,
84
+ MCP: () => MCP,
85
+ MCPAuthOptionsSchema: () => MCPAuthOptionsSchema,
86
+ MCPGenerateURLParamsSchema: () => MCPGenerateURLParamsSchema,
87
+ MCPGetServerParamsSchema: () => MCPGetServerParamsSchema,
88
+ MCPMultiAppServerSchema: () => MCPMultiAppServerSchema,
89
+ MCPServerCreateResponseSchema: () => MCPServerCreateResponseSchema,
90
+ MCPServerListResponseSchema: () => MCPServerListResponseSchema,
91
+ MCPServerSchema: () => MCPServerSchema,
92
+ MCPServerUpdateParamsSchema: () => MCPServerUpdateParamsSchema,
93
+ MCPSingleAppServerSchema: () => MCPSingleAppServerSchema,
94
+ MCPToolkitConfigSchema: () => MCPToolkitConfigSchema,
95
+ MCPToolkitConfigsArraySchema: () => MCPToolkitConfigsArraySchema,
96
+ McpDeleteResponseCamelCaseSchema: () => McpDeleteResponseCamelCaseSchema,
97
+ McpDeleteResponseSchema: () => McpDeleteResponseSchema,
98
+ McpListResponseCamelCaseSchema: () => McpListResponseCamelCaseSchema,
99
+ McpListResponseSchema: () => McpListResponseSchema,
100
+ McpRetrieveResponseCamelCaseSchema: () => McpRetrieveResponseCamelCaseSchema,
101
+ McpRetrieveResponseSchema: () => McpRetrieveResponseSchema,
102
+ McpUpdateResponseCamelCaseSchema: () => McpUpdateResponseCamelCaseSchema,
103
+ McpUpdateResponseSchema: () => McpUpdateResponseSchema,
78
104
  Oauth1ActiveConnectionDataSchema: () => Oauth1ActiveConnectionDataSchema,
79
105
  Oauth1ConnectionDataSchema: () => Oauth1ConnectionDataSchema,
80
106
  Oauth1ExpiredConnectionDataSchema: () => Oauth1ExpiredConnectionDataSchema,
@@ -127,6 +153,7 @@ __export(index_exports, {
127
153
  TriggerSubscribeParamSchema: () => TriggerSubscribeParamSchema,
128
154
  ValidationError: () => ValidationError,
129
155
  ValidationErrorCodes: () => ValidationErrorCodes,
156
+ constants: () => constants_exports,
130
157
  jsonSchemaToZodSchema: () => jsonSchemaToZodSchema,
131
158
  logger: () => logger_default,
132
159
  removeNonRequiredProperties: () => removeNonRequiredProperties
@@ -849,7 +876,8 @@ var TelemetryTransport = class {
849
876
  service: this.telemetryServiceName,
850
877
  language: this.telemetryLanguage,
851
878
  version: this.telemetryMetadata?.version,
852
- platform: this.telemetryMetadata?.isBrowser ? "browser" : "node"
879
+ platform: this.telemetryMetadata?.isBrowser ? "browser" : "node",
880
+ environment: getEnvVariable("NODE_ENV", "production")
853
881
  };
854
882
  this.sendMetric([
855
883
  {
@@ -2164,7 +2192,7 @@ var Tools = class {
2164
2192
  * @returns {Promise<string | null>} The connected account id or null if the toolkit is a no auth app
2165
2193
  */
2166
2194
  async getConnectedAccountIdForTool(userId, toolSlug) {
2167
- const tool = await this.getRawComposioToolBySlug(userId, toolSlug);
2195
+ const tool = await this.getRawComposioToolBySlug(toolSlug);
2168
2196
  if (!tool.toolkit) {
2169
2197
  throw new Error(`Unable to find toolkit for tool ${toolSlug}`);
2170
2198
  }
@@ -2196,7 +2224,6 @@ var Tools = class {
2196
2224
  * This method fetches tools from the Composio API in raw format and combines them with
2197
2225
  * any registered custom tools. The response can be filtered and modified as needed.
2198
2226
  *
2199
- * @param {string} userId - The user ID for whom to fetch the tools
2200
2227
  * @param {ToolListParams} [query={}] - Optional query parameters to filter the tools
2201
2228
  * @param {TransformToolSchemaModifier} [modifier] - Optional function to transform tool schemas
2202
2229
  * @returns {Promise<ToolList>} List of tools matching the query criteria
@@ -2204,16 +2231,16 @@ var Tools = class {
2204
2231
  * @example
2205
2232
  * ```typescript
2206
2233
  * // Get all tools
2207
- * const tools = await composio.tools.getRawComposioTools('default');
2234
+ * const tools = await composio.tools.getRawComposioTools();
2208
2235
  *
2209
2236
  * // Get tools with filters
2210
- * const githubTools = await composio.tools.getRawComposioTools('default', {
2237
+ * const githubTools = await composio.tools.getRawComposioTools({
2211
2238
  * toolkits: ['github'],
2212
2239
  * important: true
2213
2240
  * });
2214
2241
  *
2215
2242
  * // Get tools with schema transformation
2216
- * const tools = await composio.tools.getRawComposioTools('default', {},
2243
+ * const tools = await composio.tools.getRawComposioTools({},
2217
2244
  * (toolSlug, toolkitSlug, tool) => {
2218
2245
  * // Add custom properties to tool schema
2219
2246
  * return {...tool, customProperty: 'value'};
@@ -2221,7 +2248,7 @@ var Tools = class {
2221
2248
  * );
2222
2249
  * ```
2223
2250
  */
2224
- async getRawComposioTools(userId, query, modifier) {
2251
+ async getRawComposioTools(query, modifier) {
2225
2252
  if ("tools" in query && "toolkits" in query) {
2226
2253
  throw new ValidationError(
2227
2254
  "Invalid tool list parameters. You should not use tools and toolkits filter together."
@@ -2278,10 +2305,10 @@ var Tools = class {
2278
2305
  *
2279
2306
  * @example
2280
2307
  * ```ts
2281
- * const tool = await composio.tools.getRawComposioToolBySlug('default', 'github');
2308
+ * const tool = await composio.tools.getRawComposioToolBySlug('github');
2282
2309
  * ```
2283
2310
  */
2284
- async getRawComposioToolBySlug(userId, slug, modifier) {
2311
+ async getRawComposioToolBySlug(slug, modifier) {
2285
2312
  const customTool = await this.customTools.getCustomToolBySlug(slug);
2286
2313
  if (customTool) {
2287
2314
  logger_default.debug(`Found ${slug} to be a custom tool`, JSON.stringify(customTool, null, 2));
@@ -2319,10 +2346,10 @@ var Tools = class {
2319
2346
  async get(userId, arg2, options) {
2320
2347
  const executeToolFn = this.createExecuteToolFn(userId, options);
2321
2348
  if (typeof arg2 === "string") {
2322
- const tool = await this.getRawComposioToolBySlug(userId, arg2, options?.modifySchema);
2349
+ const tool = await this.getRawComposioToolBySlug(arg2, options?.modifySchema);
2323
2350
  return this.provider.wrapTools([tool], executeToolFn);
2324
2351
  } else {
2325
- const tools = await this.getRawComposioTools(userId, arg2, options?.modifySchema);
2352
+ const tools = await this.getRawComposioTools(arg2, options?.modifySchema);
2326
2353
  return this.provider.wrapTools(tools, executeToolFn);
2327
2354
  }
2328
2355
  }
@@ -2464,7 +2491,7 @@ var Tools = class {
2464
2491
  if (customTool) {
2465
2492
  return this.handleCustomToolExecution(customTool, body, modifiers);
2466
2493
  } else {
2467
- const composioTool = await this.getRawComposioToolBySlug(body.userId, slug);
2494
+ const composioTool = await this.getRawComposioToolBySlug(slug);
2468
2495
  if (!composioTool) {
2469
2496
  throw new ComposioToolNotFoundError(`Tool with slug ${slug} not found`);
2470
2497
  }
@@ -4485,10 +4512,686 @@ var Triggers = class {
4485
4512
  }
4486
4513
  };
4487
4514
 
4515
+ // src/types/mcp.types.ts
4516
+ var import_zod10 = require("zod");
4517
+ var MCPToolkitConfigSchema = import_zod10.z.object({
4518
+ toolkit: import_zod10.z.string().min(1, "Toolkit name cannot be empty"),
4519
+ authConfigId: import_zod10.z.string().min(1, "Auth config ID cannot be empty"),
4520
+ allowedTools: import_zod10.z.array(import_zod10.z.string().min(1, "Tool name cannot be empty")).min(1, "At least one tool must be specified")
4521
+ });
4522
+ var MCPToolkitConfigsArraySchema = import_zod10.z.array(MCPToolkitConfigSchema).min(1, "At least one toolkit configuration is required").refine((configs) => {
4523
+ const toolkits = configs.map((config) => config.toolkit);
4524
+ const uniqueToolkits = new Set(toolkits);
4525
+ return uniqueToolkits.size === toolkits.length;
4526
+ }, "Duplicate toolkits are not allowed. Each toolkit must be unique.");
4527
+ var MCPAuthOptionsSchema = import_zod10.z.object({
4528
+ useComposioManagedAuth: import_zod10.z.boolean().optional()
4529
+ });
4530
+ var MCPGetServerParamsSchema = import_zod10.z.object({
4531
+ userId: import_zod10.z.string().min(1, "User ID cannot be empty").optional(),
4532
+ connectedAccountIds: import_zod10.z.record(import_zod10.z.string(), import_zod10.z.string().min(1, "Account ID cannot be empty")).optional()
4533
+ }).refine(
4534
+ (data) => {
4535
+ const hasUserId = !!data.userId;
4536
+ const hasConnectedAccountIds = !!data.connectedAccountIds && Object.keys(data.connectedAccountIds).length > 0;
4537
+ return hasUserId !== hasConnectedAccountIds;
4538
+ },
4539
+ {
4540
+ message: "Must provide either userId or connectedAccountIds, but not both"
4541
+ }
4542
+ );
4543
+ var MCPGenerateURLParamsSchema = import_zod10.z.object({
4544
+ userIds: import_zod10.z.array(import_zod10.z.string()).optional(),
4545
+ connectedAccountIds: import_zod10.z.array(import_zod10.z.string()).optional(),
4546
+ useComposioManagedAuth: import_zod10.z.boolean().optional()
4547
+ });
4548
+ var GenerateURLParamsSnakeCaseSchema = import_zod10.z.object({
4549
+ user_ids: import_zod10.z.array(import_zod10.z.string()).optional(),
4550
+ connected_account_ids: import_zod10.z.array(import_zod10.z.string()).optional(),
4551
+ mcp_server_id: import_zod10.z.string(),
4552
+ managed_auth_by_composio: import_zod10.z.boolean().optional()
4553
+ });
4554
+ var GenerateURLParamsSchema = import_zod10.z.object({
4555
+ userIds: import_zod10.z.array(import_zod10.z.string()).optional(),
4556
+ connectedAccountIds: import_zod10.z.array(import_zod10.z.string()).optional(),
4557
+ mcpServerId: import_zod10.z.string(),
4558
+ managedAuthByComposio: import_zod10.z.boolean().optional()
4559
+ });
4560
+ var GenerateURLResponseCamelCaseSchema = import_zod10.z.object({
4561
+ connectedAccountUrls: import_zod10.z.array(import_zod10.z.string()).optional(),
4562
+ userIdsUrl: import_zod10.z.array(import_zod10.z.string()).optional(),
4563
+ mcpUrl: import_zod10.z.string().min(1, "MCP URL cannot be empty")
4564
+ });
4565
+ var GenerateURLResponseSchema = import_zod10.z.object({
4566
+ connected_account_urls: import_zod10.z.array(import_zod10.z.string()).optional(),
4567
+ user_ids_url: import_zod10.z.array(import_zod10.z.string()).optional(),
4568
+ mcp_url: import_zod10.z.string().min(1, "MCP URL cannot be empty")
4569
+ });
4570
+ var MCPSingleAppServerSchema = import_zod10.z.object({
4571
+ name: import_zod10.z.string().describe("Name of the MCP server"),
4572
+ tools: import_zod10.z.array(import_zod10.z.string()).describe("List of allowed tools"),
4573
+ authConfigId: import_zod10.z.string().optional().describe("Auth config ID for the server")
4574
+ });
4575
+ var MCPMultiAppServerSchema = import_zod10.z.object({
4576
+ name: import_zod10.z.string().describe("Name of the MCP server"),
4577
+ tools: import_zod10.z.array(import_zod10.z.string()).describe("List of allowed tools across toolkits"),
4578
+ toolkits: import_zod10.z.array(import_zod10.z.string()).describe("List of allowed toolkits")
4579
+ });
4580
+ var MCPServerSchema = import_zod10.z.object({
4581
+ id: import_zod10.z.string().describe("Unique identifier for the MCP server"),
4582
+ type: import_zod10.z.enum(["single", "multi"]).describe("Type of MCP server"),
4583
+ createdAt: import_zod10.z.string().describe("Creation timestamp"),
4584
+ updatedAt: import_zod10.z.string().describe("Last update timestamp"),
4585
+ status: import_zod10.z.enum(["active", "inactive", "error"]).default("active"),
4586
+ config: import_zod10.z.union([MCPSingleAppServerSchema, MCPMultiAppServerSchema])
4587
+ });
4588
+ var MCPServerListResponseSchema = import_zod10.z.object({
4589
+ items: import_zod10.z.array(MCPServerSchema),
4590
+ total: import_zod10.z.number(),
4591
+ page: import_zod10.z.number(),
4592
+ pageSize: import_zod10.z.number()
4593
+ });
4594
+ var MCPServerUpdateParamsSchema = import_zod10.z.object({
4595
+ name: import_zod10.z.string().optional().describe("New name for the server"),
4596
+ toolkits: import_zod10.z.array(import_zod10.z.string()).optional().describe("Updated list of toolkits"),
4597
+ allowedTools: import_zod10.z.array(import_zod10.z.string()).optional().describe("Updated list of allowed tools")
4598
+ });
4599
+ var MCPServerCreateResponseSchema = MCPServerSchema;
4600
+ var CustomCreateResponseCamelCaseSchema = import_zod10.z.object({
4601
+ id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
4602
+ name: import_zod10.z.string().min(1, "Server name cannot be empty"),
4603
+ createdAt: import_zod10.z.string().nullish(),
4604
+ updatedAt: import_zod10.z.string().nullish(),
4605
+ status: import_zod10.z.string().nullish()
4606
+ });
4607
+ var CustomCreateResponseSchema = import_zod10.z.object({
4608
+ id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
4609
+ name: import_zod10.z.string().min(1, "Server name cannot be empty"),
4610
+ created_at: import_zod10.z.string().nullish(),
4611
+ updated_at: import_zod10.z.string().nullish(),
4612
+ status: import_zod10.z.string().nullish()
4613
+ });
4614
+ var McpListResponseCamelCaseSchema = import_zod10.z.object({
4615
+ items: import_zod10.z.array(
4616
+ import_zod10.z.object({
4617
+ id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
4618
+ name: import_zod10.z.string().min(1, "Server name cannot be empty"),
4619
+ createdAt: import_zod10.z.string().optional(),
4620
+ updatedAt: import_zod10.z.string().optional(),
4621
+ status: import_zod10.z.string().optional()
4622
+ })
4623
+ ).optional()
4624
+ });
4625
+ var McpListResponseSchema = import_zod10.z.object({
4626
+ items: import_zod10.z.array(
4627
+ import_zod10.z.object({
4628
+ id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
4629
+ name: import_zod10.z.string().min(1, "Server name cannot be empty"),
4630
+ created_at: import_zod10.z.string().optional(),
4631
+ updated_at: import_zod10.z.string().optional(),
4632
+ status: import_zod10.z.string().optional()
4633
+ })
4634
+ ).optional()
4635
+ });
4636
+ var McpRetrieveResponseCamelCaseSchema = import_zod10.z.object({
4637
+ id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
4638
+ name: import_zod10.z.string().min(1, "Server name cannot be empty"),
4639
+ createdAt: import_zod10.z.string().optional(),
4640
+ updatedAt: import_zod10.z.string().optional(),
4641
+ status: import_zod10.z.string().optional(),
4642
+ toolkits: import_zod10.z.array(import_zod10.z.string()).optional(),
4643
+ tools: import_zod10.z.array(import_zod10.z.string()).optional(),
4644
+ managedAuthViaComposio: import_zod10.z.boolean().optional()
4645
+ });
4646
+ var McpRetrieveResponseSchema = import_zod10.z.object({
4647
+ id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
4648
+ name: import_zod10.z.string().min(1, "Server name cannot be empty"),
4649
+ created_at: import_zod10.z.string().optional(),
4650
+ updated_at: import_zod10.z.string().optional(),
4651
+ status: import_zod10.z.string().optional(),
4652
+ toolkits: import_zod10.z.array(import_zod10.z.string()).optional(),
4653
+ tools: import_zod10.z.array(import_zod10.z.string()).optional(),
4654
+ managed_auth_via_composio: import_zod10.z.boolean().optional()
4655
+ });
4656
+ var McpDeleteResponseCamelCaseSchema = import_zod10.z.object({
4657
+ id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
4658
+ deleted: import_zod10.z.boolean().optional(),
4659
+ message: import_zod10.z.string().optional()
4660
+ });
4661
+ var McpDeleteResponseSchema = import_zod10.z.object({
4662
+ id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
4663
+ deleted: import_zod10.z.boolean().optional(),
4664
+ message: import_zod10.z.string().optional()
4665
+ });
4666
+ var McpUpdateResponseCamelCaseSchema = import_zod10.z.object({
4667
+ id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
4668
+ name: import_zod10.z.string().min(1, "Server name cannot be empty"),
4669
+ createdAt: import_zod10.z.string().optional(),
4670
+ updatedAt: import_zod10.z.string().optional(),
4671
+ status: import_zod10.z.string().optional(),
4672
+ toolkits: import_zod10.z.array(import_zod10.z.string()).optional(),
4673
+ tools: import_zod10.z.array(import_zod10.z.string()).optional()
4674
+ });
4675
+ var McpUpdateResponseSchema = import_zod10.z.object({
4676
+ id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
4677
+ name: import_zod10.z.string().min(1, "Server name cannot be empty"),
4678
+ created_at: import_zod10.z.string().optional(),
4679
+ updated_at: import_zod10.z.string().optional(),
4680
+ status: import_zod10.z.string().optional(),
4681
+ toolkits: import_zod10.z.array(import_zod10.z.string()).optional(),
4682
+ tools: import_zod10.z.array(import_zod10.z.string()).optional()
4683
+ });
4684
+
4685
+ // src/utils/transformers/mcp.ts
4686
+ function transformMcpCreateResponse(response) {
4687
+ const result = CustomCreateResponseCamelCaseSchema.safeParse({
4688
+ id: response.id,
4689
+ name: response.name,
4690
+ createdAt: response.created_at,
4691
+ updatedAt: response.updated_at,
4692
+ status: response.status
4693
+ });
4694
+ if (!result.success) {
4695
+ throw new ValidationError("Failed to parse MCP create response", {
4696
+ cause: result.error
4697
+ });
4698
+ }
4699
+ return result.data;
4700
+ }
4701
+ function transformMcpListResponse(response) {
4702
+ const transformedItems = response.items?.map((item) => ({
4703
+ id: item.id,
4704
+ name: item.name,
4705
+ createdAt: item.created_at,
4706
+ updatedAt: item.updated_at,
4707
+ status: item.status
4708
+ }));
4709
+ const result = McpListResponseCamelCaseSchema.safeParse({
4710
+ items: transformedItems
4711
+ });
4712
+ if (!result.success) {
4713
+ throw new ValidationError("Failed to parse MCP list response", {
4714
+ cause: result.error
4715
+ });
4716
+ }
4717
+ return result.data;
4718
+ }
4719
+ function transformMcpRetrieveResponse(response) {
4720
+ const result = McpRetrieveResponseCamelCaseSchema.safeParse({
4721
+ id: response.id,
4722
+ name: response.name,
4723
+ createdAt: response.created_at,
4724
+ updatedAt: response.updated_at,
4725
+ status: response.status,
4726
+ toolkits: response.toolkits,
4727
+ tools: response.tools,
4728
+ managedAuthViaComposio: response.managed_auth_via_composio
4729
+ });
4730
+ if (!result.success) {
4731
+ throw new ValidationError("Failed to parse MCP retrieve response", {
4732
+ cause: result.error
4733
+ });
4734
+ }
4735
+ return result.data;
4736
+ }
4737
+ function transformMcpDeleteResponse(response) {
4738
+ const result = McpDeleteResponseCamelCaseSchema.safeParse({
4739
+ id: response.id,
4740
+ deleted: response.deleted,
4741
+ message: response.message
4742
+ });
4743
+ if (!result.success) {
4744
+ throw new ValidationError("Failed to parse MCP delete response", {
4745
+ cause: result.error
4746
+ });
4747
+ }
4748
+ return result.data;
4749
+ }
4750
+ function transformMcpUpdateResponse(response) {
4751
+ const result = McpUpdateResponseCamelCaseSchema.safeParse({
4752
+ id: response.id,
4753
+ name: response.name,
4754
+ createdAt: response.created_at,
4755
+ updatedAt: response.updated_at,
4756
+ status: response.status,
4757
+ toolkits: response.toolkits,
4758
+ tools: response.tools
4759
+ });
4760
+ if (!result.success) {
4761
+ throw new ValidationError("Failed to parse MCP update response", {
4762
+ cause: result.error
4763
+ });
4764
+ }
4765
+ return result.data;
4766
+ }
4767
+ function transformMcpGenerateUrlResponse(response) {
4768
+ const result = GenerateURLResponseCamelCaseSchema.safeParse({
4769
+ connectedAccountUrls: response.connected_account_urls,
4770
+ userIdsUrl: response.user_ids_url,
4771
+ mcpUrl: response.mcp_url
4772
+ });
4773
+ if (!result.success) {
4774
+ throw new ValidationError("Failed to parse MCP generate URL response", {
4775
+ cause: result.error
4776
+ });
4777
+ }
4778
+ return result.data;
4779
+ }
4780
+
4781
+ // src/models/MCP.ts
4782
+ var MCP = class {
4783
+ client;
4784
+ provider;
4785
+ constructor(client, provider) {
4786
+ this.client = client;
4787
+ this.provider = provider;
4788
+ telemetry.instrument(this);
4789
+ }
4790
+ /**
4791
+ * Validates toolkit configurations using Zod schema
4792
+ * @private
4793
+ * @param {MCPToolkitConfig[]} toolkitConfigs - Array of toolkit configurations to validate
4794
+ * @param {MCPAuthOptions} [authOptions] - Authentication options to validate
4795
+ * @throws {ValidationError} If validation fails
4796
+ */
4797
+ validateInputs(toolkitConfigs, authOptions) {
4798
+ const toolkitConfigsResult = MCPToolkitConfigsArraySchema.safeParse(toolkitConfigs);
4799
+ if (toolkitConfigsResult.error) {
4800
+ throw new ValidationError("Failed to parse toolkit configurations", {
4801
+ cause: toolkitConfigsResult.error
4802
+ });
4803
+ }
4804
+ if (authOptions !== void 0) {
4805
+ const authOptionsResult = MCPAuthOptionsSchema.safeParse(authOptions);
4806
+ if (authOptionsResult.error) {
4807
+ throw new ValidationError("Failed to parse auth options", {
4808
+ cause: authOptionsResult.error
4809
+ });
4810
+ }
4811
+ }
4812
+ }
4813
+ /**
4814
+ * Create a new MCP server
4815
+ * @param {string} name - Unique name for the MCP server
4816
+ * @param {MCPToolkitConfig[]} toolkitConfigs - Array of toolkit configurations
4817
+ * @param {MCPAuthOptions} [authOptions] - Authentication configuration options
4818
+ * @returns {Promise<McpServerCreateResponse<T>>} Created server details with instance getter
4819
+ *
4820
+ * @example
4821
+ * ```typescript
4822
+ * const server = await composio.mcp.create(
4823
+ * "personal-mcp-server",
4824
+ * [
4825
+ * {
4826
+ * toolkit: "GMAIL",
4827
+ * authConfigId: "ac_sdhkjfhjksdk",
4828
+ * allowedTools: ["GMAIL_FETCH_EMAILS"],
4829
+ * },
4830
+ * ],
4831
+ * { useComposioManagedAuth: true },
4832
+ * );
4833
+ *
4834
+ * // Option 1: Use convenience method on response
4835
+ * const urls = await server.getServer({
4836
+ * connectedAccountIds: { gmail: "account_id" }
4837
+ * });
4838
+ *
4839
+ * // Option 2: Use standalone method later
4840
+ * const urlsLater = await composio.mcp.getServer(server.id, {
4841
+ * connectedAccountIds: { gmail: "account_id" }
4842
+ * });
4843
+ * ```
4844
+ */
4845
+ async create(name, toolkitConfigs, authOptions) {
4846
+ this.validateInputs(toolkitConfigs, authOptions);
4847
+ const toolkits = toolkitConfigs.map((config) => config.toolkit);
4848
+ let mcpServerCreatedResponse;
4849
+ try {
4850
+ mcpServerCreatedResponse = await this.client.mcp.custom.create({
4851
+ name,
4852
+ toolkits,
4853
+ custom_tools: toolkitConfigs.flatMap((config) => config.allowedTools),
4854
+ managed_auth_via_composio: authOptions?.useComposioManagedAuth || false,
4855
+ auth_config_ids: toolkitConfigs.map((config) => config.authConfigId)
4856
+ });
4857
+ } catch (error) {
4858
+ throw new ValidationError("Failed to create MCP server", {
4859
+ cause: error
4860
+ });
4861
+ }
4862
+ const serverResponseResult = CustomCreateResponseSchema.safeParse(mcpServerCreatedResponse);
4863
+ if (serverResponseResult.error) {
4864
+ throw new ValidationError("Failed to parse MCP server creation response", {
4865
+ cause: serverResponseResult.error
4866
+ });
4867
+ }
4868
+ const camelCaseResponse = transformMcpCreateResponse(mcpServerCreatedResponse);
4869
+ return {
4870
+ ...camelCaseResponse,
4871
+ toolkits,
4872
+ getServer: async (params) => {
4873
+ return this.getServer(camelCaseResponse.id, params, authOptions);
4874
+ }
4875
+ };
4876
+ }
4877
+ /**
4878
+ * Get server URLs for an existing MCP server
4879
+ * @param {string} id - Server UUID
4880
+ * @param {MCPGetServerParams} params - Parameters for getting server URLs
4881
+ * @param {MCPAuthOptions} [authOptions] - Authentication options (optional, will use server's default if not provided)
4882
+ * @returns {Promise<T>} Transformed server URLs in provider-specific format
4883
+ *
4884
+ * @example
4885
+ * ```typescript
4886
+ * // Get URLs for an existing server
4887
+ * const urls = await composio.mcp.getServer("server-id", {
4888
+ * connectedAccountIds: {
4889
+ * gmail: "connected_account_id"
4890
+ * }
4891
+ * });
4892
+ * ```
4893
+ */
4894
+ async getServer(id, params, authOptions) {
4895
+ const serverDetails = await this.get(id);
4896
+ const paramsResult = MCPGetServerParamsSchema.safeParse(params);
4897
+ if (paramsResult.error) {
4898
+ throw new ValidationError("Failed to parse get server parameters", {
4899
+ cause: paramsResult.error
4900
+ });
4901
+ }
4902
+ const toolkits = serverDetails.toolkits || [];
4903
+ if (paramsResult.data.connectedAccountIds) {
4904
+ const providedToolkits = Object.keys(paramsResult.data.connectedAccountIds);
4905
+ const invalidToolkits = providedToolkits.filter((toolkit) => !toolkits.includes(toolkit));
4906
+ if (invalidToolkits.length > 0) {
4907
+ throw new ValidationError(
4908
+ `Invalid toolkits provided: ${invalidToolkits.join(", ")}. Available toolkits are: ${toolkits.join(", ")}`,
4909
+ {}
4910
+ );
4911
+ }
4912
+ }
4913
+ let data;
4914
+ try {
4915
+ data = await this.client.mcp.generate.url({
4916
+ user_ids: paramsResult.data.userId ? [paramsResult.data.userId] : [],
4917
+ connected_account_ids: paramsResult.data.connectedAccountIds ? Object.values(paramsResult.data.connectedAccountIds) : [],
4918
+ mcp_server_id: id,
4919
+ managed_auth_by_composio: authOptions?.useComposioManagedAuth ?? serverDetails.managedAuthViaComposio ?? false
4920
+ });
4921
+ } catch (error) {
4922
+ throw new ValidationError("Failed to generate MCP server URL", {
4923
+ cause: error
4924
+ });
4925
+ }
4926
+ const urlResponseResult = GenerateURLResponseSchema.safeParse(data);
4927
+ if (urlResponseResult.error) {
4928
+ throw new ValidationError("Failed to parse MCP URL generation response", {
4929
+ cause: urlResponseResult.error
4930
+ });
4931
+ }
4932
+ const camelCaseData = transformMcpGenerateUrlResponse(data);
4933
+ return this.wrapMcpServerResponse(
4934
+ camelCaseData,
4935
+ serverDetails.name,
4936
+ paramsResult.data.connectedAccountIds ? Object.values(paramsResult.data.connectedAccountIds) : void 0,
4937
+ paramsResult.data.userId ? [paramsResult.data.userId] : void 0,
4938
+ paramsResult.data.connectedAccountIds ? Object.keys(paramsResult.data.connectedAccountIds) : void 0
4939
+ );
4940
+ }
4941
+ /**
4942
+ * List MCP server configurations with filtering options
4943
+ * @param {Object} options - Filtering and pagination options
4944
+ * @param {number} [options.page] - Page number for pagination
4945
+ * @param {number} [options.limit] - Number of items per page
4946
+ * @param {string[]} [options.toolkits] - Filter servers by toolkit names
4947
+ * @param {string[]} [options.authConfigs] - Filter servers by auth config IDs
4948
+ * @param {string} [options.name] - Filter servers by name
4949
+ * @param {string} [options.user] - Filter servers by user ID
4950
+ * @returns {Promise<McpListResponse>} List of MCP servers matching the filters
4951
+ *
4952
+ * @example
4953
+ * ```typescript
4954
+ * // List all servers with pagination
4955
+ * const servers = await composio.mcp.list({
4956
+ * page: 1,
4957
+ * limit: 10
4958
+ * });
4959
+ *
4960
+ * // List Gmail and Supabase servers
4961
+ * const filteredServers = await composio.mcp.list({
4962
+ * toolkits: ['GMAIL', 'SUPABASE'],
4963
+ * authConfigIds: ['auth_123', 'auth_456']
4964
+ * });
4965
+ * ```
4966
+ */
4967
+ async list(options) {
4968
+ let listResponse;
4969
+ try {
4970
+ listResponse = await this.client.mcp.list({
4971
+ page_no: options.page || 1,
4972
+ limit: options.limit || 10,
4973
+ toolkits: options?.toolkits?.join(",") || "",
4974
+ auth_config_ids: options?.authConfigs?.join(",") || "",
4975
+ name: options?.name
4976
+ });
4977
+ } catch (error) {
4978
+ throw new ValidationError("Failed to list MCP servers", {
4979
+ cause: error
4980
+ });
4981
+ }
4982
+ const listResponseResult = McpListResponseSchema.safeParse(listResponse);
4983
+ if (listResponseResult.error) {
4984
+ throw new ValidationError("Failed to parse MCP server list response", {
4985
+ cause: listResponseResult.error
4986
+ });
4987
+ }
4988
+ return transformMcpListResponse(listResponse);
4989
+ }
4990
+ /**
4991
+ * Get details of a specific MCP server
4992
+ * @param {string} id - Server UUID
4993
+ * @returns {Promise<ReturnType<typeof transformMcpRetrieveResponse>>} Server details
4994
+ *
4995
+ * @example
4996
+ * ```typescript
4997
+ * const serverDetails = await composio.mcp.get('server-uuid');
4998
+ * ```
4999
+ */
5000
+ async get(id) {
5001
+ let retrieveResponse;
5002
+ try {
5003
+ retrieveResponse = await this.client.mcp.retrieve(id);
5004
+ } catch (error) {
5005
+ throw new ValidationError("Failed to retrieve MCP server", {
5006
+ cause: error
5007
+ });
5008
+ }
5009
+ const retrieveResponseResult = McpRetrieveResponseSchema.safeParse(retrieveResponse);
5010
+ if (retrieveResponseResult.error) {
5011
+ throw new ValidationError("Failed to parse MCP server retrieve response", {
5012
+ cause: retrieveResponseResult.error
5013
+ });
5014
+ }
5015
+ return transformMcpRetrieveResponse(retrieveResponse);
5016
+ }
5017
+ /**
5018
+ * Delete an MCP server
5019
+ * @param {string} id - Server UUID
5020
+ * @returns {Promise<ReturnType<typeof transformMcpDeleteResponse>>} Deletion response
5021
+ *
5022
+ * @example
5023
+ * ```typescript
5024
+ * const result = await composio.mcp.delete('server-uuid');
5025
+ * ```
5026
+ */
5027
+ async delete(id) {
5028
+ let deleteResponse;
5029
+ try {
5030
+ deleteResponse = await this.client.mcp.delete(id);
5031
+ } catch (error) {
5032
+ throw new ValidationError("Failed to delete MCP server", {
5033
+ cause: error
5034
+ });
5035
+ }
5036
+ const deleteResponseResult = McpDeleteResponseSchema.safeParse(deleteResponse);
5037
+ if (deleteResponseResult.error) {
5038
+ throw new ValidationError("Failed to parse MCP server delete response", {
5039
+ cause: deleteResponseResult.error
5040
+ });
5041
+ }
5042
+ return transformMcpDeleteResponse(deleteResponse);
5043
+ }
5044
+ /**
5045
+ * Update an MCP server configuration
5046
+ * @param {string} id - Server UUID
5047
+ * @param {string} name - New unique name for the server
5048
+ * @param {MCPToolkitConfig[]} toolkitConfigs - Array of toolkit configurations
5049
+ * @param {MCPAuthOptions} [authOptions] - Updated authentication options
5050
+ * @returns {Promise<ReturnType<typeof transformMcpUpdateResponse>>} Updated server details
5051
+ *
5052
+ * @example
5053
+ * ```typescript
5054
+ * const updatedServer = await composio.mcp.update(
5055
+ * "server-uuid",
5056
+ * "my-updated-server",
5057
+ * [
5058
+ * {
5059
+ * toolkit: "GMAIL",
5060
+ * authConfigId: "ac_sdhkjfhjksdk",
5061
+ * allowedTools: ["GMAIL_FETCH_EMAILS"],
5062
+ * },
5063
+ * ],
5064
+ * {
5065
+ * useComposioManagedAuth: true,
5066
+ * }
5067
+ * );
5068
+ * ```
5069
+ */
5070
+ async update(id, name, toolkitConfigs, authOptions) {
5071
+ this.validateInputs(toolkitConfigs, authOptions);
5072
+ const toolkits = toolkitConfigs.map((config) => config.toolkit);
5073
+ let updateResponse;
5074
+ try {
5075
+ updateResponse = await this.client.mcp.update(id, {
5076
+ name,
5077
+ toolkits,
5078
+ allowed_tools: toolkitConfigs.flatMap((config) => config.allowedTools),
5079
+ managed_auth_via_composio: authOptions?.useComposioManagedAuth || false
5080
+ });
5081
+ } catch (error) {
5082
+ throw new ValidationError("Failed to update MCP server", {
5083
+ cause: error
5084
+ });
5085
+ }
5086
+ const updateResponseResult = McpUpdateResponseSchema.safeParse(updateResponse);
5087
+ if (updateResponseResult.error) {
5088
+ throw new ValidationError("Failed to parse MCP server update response", {
5089
+ cause: updateResponseResult.error
5090
+ });
5091
+ }
5092
+ return transformMcpUpdateResponse(updateResponse);
5093
+ }
5094
+ /**
5095
+ * Generate URL for an MCP server
5096
+ * @param {GenerateURLParams} params - Parameters for URL generation
5097
+ * @returns {Promise<ReturnType<typeof transformMcpGenerateUrlResponse>>} Generated URL response
5098
+ *
5099
+ * @example
5100
+ * ```typescript
5101
+ * const urlResponse = await composio.mcp.generateUrl({
5102
+ * user_ids: ['user123'],
5103
+ * connected_account_ids: ['account456'],
5104
+ * mcp_server_id: 'server-uuid',
5105
+ * managed_auth_by_composio: true
5106
+ * });
5107
+ * ```
5108
+ */
5109
+ async generateUrl(params) {
5110
+ const paramsResult = GenerateURLParamsSnakeCaseSchema.safeParse(params);
5111
+ if (paramsResult.error) {
5112
+ throw new ValidationError("Failed to parse generateUrl parameters", {
5113
+ cause: paramsResult.error
5114
+ });
5115
+ }
5116
+ let urlResponse;
5117
+ try {
5118
+ urlResponse = await this.client.mcp.generate.url(params);
5119
+ } catch (error) {
5120
+ throw new ValidationError("Failed to generate MCP URL", {
5121
+ cause: error
5122
+ });
5123
+ }
5124
+ const responseResult = GenerateURLResponseSchema.safeParse(urlResponse);
5125
+ if (responseResult.error) {
5126
+ throw new ValidationError("Failed to parse MCP URL generation response", {
5127
+ cause: responseResult.error
5128
+ });
5129
+ }
5130
+ return transformMcpGenerateUrlResponse(urlResponse);
5131
+ }
5132
+ /**
5133
+ * Transform MCP URL response into the appropriate format.
5134
+ * If the provider has a custom transform method, use it.
5135
+ * Otherwise, use the default transformation.
5136
+ *
5137
+ * @param data - The MCP URL response data (in camelCase)
5138
+ * @param serverName - Name of the MCP server
5139
+ * @param connectedAccountIds - Optional array of connected account IDs
5140
+ * @param userIds - Optional array of user IDs
5141
+ * @param toolkits - Optional array of toolkit names
5142
+ * @returns Transformed response in appropriate format
5143
+ */
5144
+ wrapMcpServerResponse(data, serverName, connectedAccountIds, userIds, toolkits) {
5145
+ if (this.provider && typeof this.provider.wrapMcpServerResponse === "function") {
5146
+ const snakeCaseData = {
5147
+ mcp_url: data.mcpUrl,
5148
+ ...data.connectedAccountUrls && { connected_account_urls: data.connectedAccountUrls },
5149
+ ...data.userIdsUrl && { user_ids_url: data.userIdsUrl }
5150
+ };
5151
+ const transformed = this.provider.wrapMcpServerResponse(
5152
+ snakeCaseData,
5153
+ serverName,
5154
+ connectedAccountIds,
5155
+ userIds,
5156
+ toolkits
5157
+ );
5158
+ return transformed;
5159
+ }
5160
+ if (connectedAccountIds?.length && data.connectedAccountUrls) {
5161
+ return data.connectedAccountUrls.map((url, index) => ({
5162
+ url: new URL(url),
5163
+ name: `${serverName}-${connectedAccountIds[index]}`,
5164
+ toolkit: toolkits?.[index]
5165
+ }));
5166
+ } else if (userIds?.length && data.userIdsUrl) {
5167
+ return data.userIdsUrl.map((url, index) => ({
5168
+ url: new URL(url),
5169
+ name: `${serverName}-${userIds[index]}`,
5170
+ toolkit: toolkits?.[index]
5171
+ }));
5172
+ }
5173
+ return {
5174
+ url: new URL(data.mcpUrl),
5175
+ name: serverName
5176
+ };
5177
+ }
5178
+ };
5179
+
4488
5180
  // src/utils/constants.ts
5181
+ var constants_exports = {};
5182
+ __export(constants_exports, {
5183
+ COMPOSIO_DIR: () => COMPOSIO_DIR,
5184
+ DEFAULT_BASE_URL: () => DEFAULT_BASE_URL,
5185
+ IS_DEVELOPMENT_OR_CI: () => IS_DEVELOPMENT_OR_CI,
5186
+ TELEMETRY_URL: () => TELEMETRY_URL2,
5187
+ TEMP_FILES_DIRECTORY_NAME: () => TEMP_FILES_DIRECTORY_NAME,
5188
+ USER_DATA_FILE_NAME: () => USER_DATA_FILE_NAME
5189
+ });
4489
5190
  var COMPOSIO_DIR = ".composio";
4490
5191
  var USER_DATA_FILE_NAME = "user_data.json";
5192
+ var TEMP_FILES_DIRECTORY_NAME = "files";
4491
5193
  var DEFAULT_BASE_URL = "https://backend.composio.dev";
5194
+ var TELEMETRY_URL2 = "https://app.composio.dev";
4492
5195
  var IS_DEVELOPMENT_OR_CI = process.env.DEVELOPMENT || process.env.CI || false;
4493
5196
 
4494
5197
  // src/utils/sdk.ts
@@ -4597,17 +5300,17 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4597
5300
  name = "openai";
4598
5301
  /**
4599
5302
  * Creates a new instance of the OpenAIProvider.
4600
- *
5303
+ *
4601
5304
  * This is the default provider for the Composio SDK and is automatically
4602
5305
  * available without additional installation.
4603
- *
5306
+ *
4604
5307
  * @example
4605
5308
  * ```typescript
4606
5309
  * // The OpenAIProvider is used by default when initializing Composio
4607
5310
  * const composio = new Composio({
4608
5311
  * apiKey: 'your-api-key'
4609
5312
  * });
4610
- *
5313
+ *
4611
5314
  * // You can also explicitly specify it
4612
5315
  * const composio = new Composio({
4613
5316
  * apiKey: 'your-api-key',
@@ -4618,15 +5321,45 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4618
5321
  constructor() {
4619
5322
  super();
4620
5323
  }
5324
+ /**
5325
+ * Transform MCP URL response into OpenAI-specific format.
5326
+ * OpenAI uses the standard format by default.
5327
+ *
5328
+ * @param data - The MCP URL response data
5329
+ * @param serverName - Name of the MCP server
5330
+ * @param connectedAccountIds - Optional array of connected account IDs
5331
+ * @param userIds - Optional array of user IDs
5332
+ * @param toolkits - Optional array of toolkit names
5333
+ * @returns Standard MCP server response format
5334
+ */
5335
+ wrapMcpServerResponse(data, serverName, connectedAccountIds, userIds, toolkits) {
5336
+ if (connectedAccountIds?.length && data.connected_account_urls) {
5337
+ return data.connected_account_urls.map((url, index) => ({
5338
+ url: new URL(url),
5339
+ name: `${serverName}-${connectedAccountIds[index]}`,
5340
+ toolkit: toolkits?.[index]
5341
+ }));
5342
+ } else if (userIds?.length && data.user_ids_url) {
5343
+ return data.user_ids_url.map((url, index) => ({
5344
+ url: new URL(url),
5345
+ name: `${serverName}-${userIds[index]}`,
5346
+ toolkit: toolkits?.[index]
5347
+ }));
5348
+ }
5349
+ return {
5350
+ url: new URL(data.mcp_url),
5351
+ name: serverName
5352
+ };
5353
+ }
4621
5354
  /**
4622
5355
  * Wraps a Composio tool in the OpenAI function calling format.
4623
- *
5356
+ *
4624
5357
  * This method transforms a Composio tool definition into the format
4625
5358
  * expected by OpenAI's function calling API.
4626
- *
5359
+ *
4627
5360
  * @param tool - The Composio tool to wrap
4628
5361
  * @returns The wrapped tool in OpenAI format
4629
- *
5362
+ *
4630
5363
  * @example
4631
5364
  * ```typescript
4632
5365
  * // Wrap a single tool for use with OpenAI
@@ -4641,7 +5374,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4641
5374
  * required: ['query']
4642
5375
  * }
4643
5376
  * };
4644
- *
5377
+ *
4645
5378
  * const openAITool = provider.wrapTool(composioTool);
4646
5379
  * ```
4647
5380
  */
@@ -4658,13 +5391,13 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4658
5391
  };
4659
5392
  /**
4660
5393
  * Wraps multiple Composio tools in the OpenAI function calling format.
4661
- *
5394
+ *
4662
5395
  * This method transforms a list of Composio tools into the format
4663
5396
  * expected by OpenAI's function calling API.
4664
- *
5397
+ *
4665
5398
  * @param tools - Array of Composio tools to wrap
4666
5399
  * @returns Array of wrapped tools in OpenAI format
4667
- *
5400
+ *
4668
5401
  * @example
4669
5402
  * ```typescript
4670
5403
  * // Wrap multiple tools for use with OpenAI
@@ -4690,7 +5423,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4690
5423
  * }
4691
5424
  * }
4692
5425
  * ];
4693
- *
5426
+ *
4694
5427
  * const openAITools = provider.wrapTools(composioTools);
4695
5428
  * ```
4696
5429
  */
@@ -4699,16 +5432,16 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4699
5432
  };
4700
5433
  /**
4701
5434
  * Executes a tool call from OpenAI's chat completion.
4702
- *
5435
+ *
4703
5436
  * This method processes a tool call from OpenAI's chat completion API,
4704
5437
  * executes the corresponding Composio tool, and returns the result.
4705
- *
5438
+ *
4706
5439
  * @param {string} userId - The user ID for authentication and tracking
4707
5440
  * @param {OpenAI.ChatCompletionMessageToolCall} tool - The tool call from OpenAI
4708
5441
  * @param {ExecuteToolFnOptions} [options] - Optional execution options
4709
5442
  * @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
4710
5443
  * @returns {Promise<string>} The result of the tool call as a JSON string
4711
- *
5444
+ *
4712
5445
  * @example
4713
5446
  * ```typescript
4714
5447
  * // Execute a tool call from OpenAI
@@ -4720,7 +5453,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4720
5453
  * arguments: '{"query":"composio documentation"}'
4721
5454
  * }
4722
5455
  * };
4723
- *
5456
+ *
4724
5457
  * const result = await provider.executeToolCall(
4725
5458
  * 'user123',
4726
5459
  * toolCall,
@@ -4750,7 +5483,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4750
5483
  * @param {ExecuteToolFnOptions} [options] - Optional execution options
4751
5484
  * @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
4752
5485
  * @returns {Promise<string[]>} Array of tool execution results as JSON strings
4753
- *
5486
+ *
4754
5487
  * @example
4755
5488
  * ```typescript
4756
5489
  * // Handle tool calls from a chat completion response
@@ -4772,7 +5505,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4772
5505
  * }
4773
5506
  * ]
4774
5507
  * };
4775
- *
5508
+ *
4776
5509
  * const results = await provider.handleToolCalls(
4777
5510
  * 'user123',
4778
5511
  * chatCompletion,
@@ -4803,7 +5536,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4803
5536
  * @param {ExecuteToolFnOptions} [options] - Optional execution options
4804
5537
  * @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
4805
5538
  * @returns {Promise<OpenAI.Beta.Threads.Runs.RunSubmitToolOutputsParams.ToolOutput[]>} Array of tool outputs for submission
4806
- *
5539
+ *
4807
5540
  * @example
4808
5541
  * ```typescript
4809
5542
  * // Handle tool calls from an OpenAI Assistant run
@@ -4824,13 +5557,13 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4824
5557
  * }
4825
5558
  * }
4826
5559
  * };
4827
- *
5560
+ *
4828
5561
  * const toolOutputs = await provider.handleAssistantMessage(
4829
5562
  * 'user123',
4830
5563
  * run,
4831
5564
  * { connectedAccountId: 'conn_xyz456' }
4832
5565
  * );
4833
- *
5566
+ *
4834
5567
  * // Submit tool outputs back to OpenAI
4835
5568
  * await openai.beta.threads.runs.submitToolOutputs(
4836
5569
  * thread.id,
@@ -4873,7 +5606,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4873
5606
  * @param {ExecuteToolFnOptions} [options] - Optional execution options
4874
5607
  * @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
4875
5608
  * @returns {AsyncGenerator<OpenAI.Beta.Assistants.AssistantStreamEvent, void, unknown>} Generator yielding stream events
4876
- *
5609
+ *
4877
5610
  * @example
4878
5611
  * ```typescript
4879
5612
  * // Process an OpenAI Assistant stream with tool calls
@@ -4882,7 +5615,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4882
5615
  * assistant_id: 'asst_abc123',
4883
5616
  * tools: provider.wrapTools(composioTools)
4884
5617
  * });
4885
- *
5618
+ *
4886
5619
  * // Process the stream and handle tool calls
4887
5620
  * const streamProcessor = provider.waitAndHandleAssistantStreamToolCalls(
4888
5621
  * 'user123',
@@ -4891,7 +5624,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4891
5624
  * thread,
4892
5625
  * { connectedAccountId: 'conn_xyz456' }
4893
5626
  * );
4894
- *
5627
+ *
4895
5628
  * // Consume the stream events
4896
5629
  * for await (const event of streamProcessor) {
4897
5630
  * if (event.event === 'thread.message.delta') {
@@ -4961,7 +5694,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4961
5694
  * @param {ExecuteToolFnOptions} [options] - Optional execution options
4962
5695
  * @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
4963
5696
  * @returns {Promise<OpenAI.Beta.Threads.Run>} The final run object after completion
4964
- *
5697
+ *
4965
5698
  * @example
4966
5699
  * ```typescript
4967
5700
  * // Process an OpenAI Assistant run with tool calls
@@ -4970,12 +5703,12 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4970
5703
  * role: 'user',
4971
5704
  * content: 'Find information about Composio'
4972
5705
  * });
4973
- *
5706
+ *
4974
5707
  * let run = await openai.beta.threads.runs.create(thread.id, {
4975
5708
  * assistant_id: 'asst_abc123',
4976
5709
  * tools: provider.wrapTools(composioTools)
4977
5710
  * });
4978
- *
5711
+ *
4979
5712
  * // Wait for the run to complete, handling any tool calls
4980
5713
  * run = await provider.waitAndHandleAssistantToolCalls(
4981
5714
  * 'user123',
@@ -4984,7 +5717,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4984
5717
  * thread,
4985
5718
  * { connectedAccountId: 'conn_xyz456' }
4986
5719
  * );
4987
- *
5720
+ *
4988
5721
  * // Get the final messages after run completion
4989
5722
  * const messages = await openai.beta.threads.messages.list(thread.id);
4990
5723
  * console.log(messages.data[0].content);
@@ -5007,7 +5740,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
5007
5740
  };
5008
5741
 
5009
5742
  // package.json
5010
- var version = "0.1.24";
5743
+ var version = "0.1.25";
5011
5744
 
5012
5745
  // src/composio.ts
5013
5746
  var Composio = class _Composio {
@@ -5032,6 +5765,7 @@ var Composio = class _Composio {
5032
5765
  authConfigs;
5033
5766
  // connected accounts
5034
5767
  connectedAccounts;
5768
+ mcp;
5035
5769
  /**
5036
5770
  * Creates a new instance of the Composio SDK.
5037
5771
  *
@@ -5084,6 +5818,7 @@ var Composio = class _Composio {
5084
5818
  };
5085
5819
  this.provider = config?.provider ?? new OpenAIProvider();
5086
5820
  this.tools = new Tools(this.client, this.provider);
5821
+ this.mcp = new MCP(this.client, this.provider);
5087
5822
  this.toolkits = new Toolkits(this.client);
5088
5823
  this.triggers = new Triggers(this.client);
5089
5824
  this.authConfigs = new AuthConfigs(this.client);
@@ -5162,6 +5897,9 @@ var Composio = class _Composio {
5162
5897
  // src/provider/ComposioProvider.ts
5163
5898
  var ComposioProvider = class extends BaseNonAgenticProvider {
5164
5899
  name = "ComposioProvider";
5900
+ constructor() {
5901
+ super();
5902
+ }
5165
5903
  wrapTool = (tool) => {
5166
5904
  return tool;
5167
5905
  };
@@ -5414,8 +6152,34 @@ var AuthScheme = class {
5414
6152
  CreateComposioManagedAuthConfigParamsSchema,
5415
6153
  CreateCustomAuthConfigParamsSchema,
5416
6154
  CustomAuthParamsSchema,
6155
+ CustomCreateResponseCamelCaseSchema,
6156
+ CustomCreateResponseSchema,
6157
+ GenerateURLParamsSchema,
6158
+ GenerateURLParamsSnakeCaseSchema,
6159
+ GenerateURLResponseCamelCaseSchema,
6160
+ GenerateURLResponseSchema,
5417
6161
  IncomingTriggerPayloadSchema,
5418
6162
  JsonSchemaToZodError,
6163
+ MCP,
6164
+ MCPAuthOptionsSchema,
6165
+ MCPGenerateURLParamsSchema,
6166
+ MCPGetServerParamsSchema,
6167
+ MCPMultiAppServerSchema,
6168
+ MCPServerCreateResponseSchema,
6169
+ MCPServerListResponseSchema,
6170
+ MCPServerSchema,
6171
+ MCPServerUpdateParamsSchema,
6172
+ MCPSingleAppServerSchema,
6173
+ MCPToolkitConfigSchema,
6174
+ MCPToolkitConfigsArraySchema,
6175
+ McpDeleteResponseCamelCaseSchema,
6176
+ McpDeleteResponseSchema,
6177
+ McpListResponseCamelCaseSchema,
6178
+ McpListResponseSchema,
6179
+ McpRetrieveResponseCamelCaseSchema,
6180
+ McpRetrieveResponseSchema,
6181
+ McpUpdateResponseCamelCaseSchema,
6182
+ McpUpdateResponseSchema,
5419
6183
  Oauth1ActiveConnectionDataSchema,
5420
6184
  Oauth1ConnectionDataSchema,
5421
6185
  Oauth1ExpiredConnectionDataSchema,
@@ -5468,6 +6232,7 @@ var AuthScheme = class {
5468
6232
  TriggerSubscribeParamSchema,
5469
6233
  ValidationError,
5470
6234
  ValidationErrorCodes,
6235
+ constants,
5471
6236
  jsonSchemaToZodSchema,
5472
6237
  logger,
5473
6238
  removeNonRequiredProperties