@composio/core 0.1.23 → 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.js CHANGED
@@ -1,9 +1,14 @@
1
+ var __defProp = Object.defineProperty;
1
2
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
3
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
4
  }) : x)(function(x) {
4
5
  if (typeof require !== "undefined") return require.apply(this, arguments);
5
6
  throw Error('Dynamic require of "' + x + '" is not supported');
6
7
  });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
7
12
 
8
13
  // src/composio.ts
9
14
  import ComposioClient4 from "@composio/client";
@@ -721,7 +726,8 @@ var TelemetryTransport = class {
721
726
  service: this.telemetryServiceName,
722
727
  language: this.telemetryLanguage,
723
728
  version: this.telemetryMetadata?.version,
724
- platform: this.telemetryMetadata?.isBrowser ? "browser" : "node"
729
+ platform: this.telemetryMetadata?.isBrowser ? "browser" : "node",
730
+ environment: getEnvVariable("NODE_ENV", "production")
725
731
  };
726
732
  this.sendMetric([
727
733
  {
@@ -2036,7 +2042,7 @@ var Tools = class {
2036
2042
  * @returns {Promise<string | null>} The connected account id or null if the toolkit is a no auth app
2037
2043
  */
2038
2044
  async getConnectedAccountIdForTool(userId, toolSlug) {
2039
- const tool = await this.getRawComposioToolBySlug(userId, toolSlug);
2045
+ const tool = await this.getRawComposioToolBySlug(toolSlug);
2040
2046
  if (!tool.toolkit) {
2041
2047
  throw new Error(`Unable to find toolkit for tool ${toolSlug}`);
2042
2048
  }
@@ -2068,7 +2074,6 @@ var Tools = class {
2068
2074
  * This method fetches tools from the Composio API in raw format and combines them with
2069
2075
  * any registered custom tools. The response can be filtered and modified as needed.
2070
2076
  *
2071
- * @param {string} userId - The user ID for whom to fetch the tools
2072
2077
  * @param {ToolListParams} [query={}] - Optional query parameters to filter the tools
2073
2078
  * @param {TransformToolSchemaModifier} [modifier] - Optional function to transform tool schemas
2074
2079
  * @returns {Promise<ToolList>} List of tools matching the query criteria
@@ -2076,16 +2081,16 @@ var Tools = class {
2076
2081
  * @example
2077
2082
  * ```typescript
2078
2083
  * // Get all tools
2079
- * const tools = await composio.tools.getRawComposioTools('default');
2084
+ * const tools = await composio.tools.getRawComposioTools();
2080
2085
  *
2081
2086
  * // Get tools with filters
2082
- * const githubTools = await composio.tools.getRawComposioTools('default', {
2087
+ * const githubTools = await composio.tools.getRawComposioTools({
2083
2088
  * toolkits: ['github'],
2084
2089
  * important: true
2085
2090
  * });
2086
2091
  *
2087
2092
  * // Get tools with schema transformation
2088
- * const tools = await composio.tools.getRawComposioTools('default', {},
2093
+ * const tools = await composio.tools.getRawComposioTools({},
2089
2094
  * (toolSlug, toolkitSlug, tool) => {
2090
2095
  * // Add custom properties to tool schema
2091
2096
  * return {...tool, customProperty: 'value'};
@@ -2093,7 +2098,7 @@ var Tools = class {
2093
2098
  * );
2094
2099
  * ```
2095
2100
  */
2096
- async getRawComposioTools(userId, query, modifier) {
2101
+ async getRawComposioTools(query, modifier) {
2097
2102
  if ("tools" in query && "toolkits" in query) {
2098
2103
  throw new ValidationError(
2099
2104
  "Invalid tool list parameters. You should not use tools and toolkits filter together."
@@ -2150,10 +2155,10 @@ var Tools = class {
2150
2155
  *
2151
2156
  * @example
2152
2157
  * ```ts
2153
- * const tool = await composio.tools.getRawComposioToolBySlug('default', 'github');
2158
+ * const tool = await composio.tools.getRawComposioToolBySlug('github');
2154
2159
  * ```
2155
2160
  */
2156
- async getRawComposioToolBySlug(userId, slug, modifier) {
2161
+ async getRawComposioToolBySlug(slug, modifier) {
2157
2162
  const customTool = await this.customTools.getCustomToolBySlug(slug);
2158
2163
  if (customTool) {
2159
2164
  logger_default.debug(`Found ${slug} to be a custom tool`, JSON.stringify(customTool, null, 2));
@@ -2191,10 +2196,10 @@ var Tools = class {
2191
2196
  async get(userId, arg2, options) {
2192
2197
  const executeToolFn = this.createExecuteToolFn(userId, options);
2193
2198
  if (typeof arg2 === "string") {
2194
- const tool = await this.getRawComposioToolBySlug(userId, arg2, options?.modifySchema);
2199
+ const tool = await this.getRawComposioToolBySlug(arg2, options?.modifySchema);
2195
2200
  return this.provider.wrapTools([tool], executeToolFn);
2196
2201
  } else {
2197
- const tools = await this.getRawComposioTools(userId, arg2, options?.modifySchema);
2202
+ const tools = await this.getRawComposioTools(arg2, options?.modifySchema);
2198
2203
  return this.provider.wrapTools(tools, executeToolFn);
2199
2204
  }
2200
2205
  }
@@ -2336,7 +2341,7 @@ var Tools = class {
2336
2341
  if (customTool) {
2337
2342
  return this.handleCustomToolExecution(customTool, body, modifiers);
2338
2343
  } else {
2339
- const composioTool = await this.getRawComposioToolBySlug(body.userId, slug);
2344
+ const composioTool = await this.getRawComposioToolBySlug(slug);
2340
2345
  if (!composioTool) {
2341
2346
  throw new ComposioToolNotFoundError(`Tool with slug ${slug} not found`);
2342
2347
  }
@@ -4357,10 +4362,686 @@ var Triggers = class {
4357
4362
  }
4358
4363
  };
4359
4364
 
4365
+ // src/types/mcp.types.ts
4366
+ import { z as z8 } from "zod";
4367
+ var MCPToolkitConfigSchema = z8.object({
4368
+ toolkit: z8.string().min(1, "Toolkit name cannot be empty"),
4369
+ authConfigId: z8.string().min(1, "Auth config ID cannot be empty"),
4370
+ allowedTools: z8.array(z8.string().min(1, "Tool name cannot be empty")).min(1, "At least one tool must be specified")
4371
+ });
4372
+ var MCPToolkitConfigsArraySchema = z8.array(MCPToolkitConfigSchema).min(1, "At least one toolkit configuration is required").refine((configs) => {
4373
+ const toolkits = configs.map((config) => config.toolkit);
4374
+ const uniqueToolkits = new Set(toolkits);
4375
+ return uniqueToolkits.size === toolkits.length;
4376
+ }, "Duplicate toolkits are not allowed. Each toolkit must be unique.");
4377
+ var MCPAuthOptionsSchema = z8.object({
4378
+ useComposioManagedAuth: z8.boolean().optional()
4379
+ });
4380
+ var MCPGetServerParamsSchema = z8.object({
4381
+ userId: z8.string().min(1, "User ID cannot be empty").optional(),
4382
+ connectedAccountIds: z8.record(z8.string(), z8.string().min(1, "Account ID cannot be empty")).optional()
4383
+ }).refine(
4384
+ (data) => {
4385
+ const hasUserId = !!data.userId;
4386
+ const hasConnectedAccountIds = !!data.connectedAccountIds && Object.keys(data.connectedAccountIds).length > 0;
4387
+ return hasUserId !== hasConnectedAccountIds;
4388
+ },
4389
+ {
4390
+ message: "Must provide either userId or connectedAccountIds, but not both"
4391
+ }
4392
+ );
4393
+ var MCPGenerateURLParamsSchema = z8.object({
4394
+ userIds: z8.array(z8.string()).optional(),
4395
+ connectedAccountIds: z8.array(z8.string()).optional(),
4396
+ useComposioManagedAuth: z8.boolean().optional()
4397
+ });
4398
+ var GenerateURLParamsSnakeCaseSchema = z8.object({
4399
+ user_ids: z8.array(z8.string()).optional(),
4400
+ connected_account_ids: z8.array(z8.string()).optional(),
4401
+ mcp_server_id: z8.string(),
4402
+ managed_auth_by_composio: z8.boolean().optional()
4403
+ });
4404
+ var GenerateURLParamsSchema = z8.object({
4405
+ userIds: z8.array(z8.string()).optional(),
4406
+ connectedAccountIds: z8.array(z8.string()).optional(),
4407
+ mcpServerId: z8.string(),
4408
+ managedAuthByComposio: z8.boolean().optional()
4409
+ });
4410
+ var GenerateURLResponseCamelCaseSchema = z8.object({
4411
+ connectedAccountUrls: z8.array(z8.string()).optional(),
4412
+ userIdsUrl: z8.array(z8.string()).optional(),
4413
+ mcpUrl: z8.string().min(1, "MCP URL cannot be empty")
4414
+ });
4415
+ var GenerateURLResponseSchema = z8.object({
4416
+ connected_account_urls: z8.array(z8.string()).optional(),
4417
+ user_ids_url: z8.array(z8.string()).optional(),
4418
+ mcp_url: z8.string().min(1, "MCP URL cannot be empty")
4419
+ });
4420
+ var MCPSingleAppServerSchema = z8.object({
4421
+ name: z8.string().describe("Name of the MCP server"),
4422
+ tools: z8.array(z8.string()).describe("List of allowed tools"),
4423
+ authConfigId: z8.string().optional().describe("Auth config ID for the server")
4424
+ });
4425
+ var MCPMultiAppServerSchema = z8.object({
4426
+ name: z8.string().describe("Name of the MCP server"),
4427
+ tools: z8.array(z8.string()).describe("List of allowed tools across toolkits"),
4428
+ toolkits: z8.array(z8.string()).describe("List of allowed toolkits")
4429
+ });
4430
+ var MCPServerSchema = z8.object({
4431
+ id: z8.string().describe("Unique identifier for the MCP server"),
4432
+ type: z8.enum(["single", "multi"]).describe("Type of MCP server"),
4433
+ createdAt: z8.string().describe("Creation timestamp"),
4434
+ updatedAt: z8.string().describe("Last update timestamp"),
4435
+ status: z8.enum(["active", "inactive", "error"]).default("active"),
4436
+ config: z8.union([MCPSingleAppServerSchema, MCPMultiAppServerSchema])
4437
+ });
4438
+ var MCPServerListResponseSchema = z8.object({
4439
+ items: z8.array(MCPServerSchema),
4440
+ total: z8.number(),
4441
+ page: z8.number(),
4442
+ pageSize: z8.number()
4443
+ });
4444
+ var MCPServerUpdateParamsSchema = z8.object({
4445
+ name: z8.string().optional().describe("New name for the server"),
4446
+ toolkits: z8.array(z8.string()).optional().describe("Updated list of toolkits"),
4447
+ allowedTools: z8.array(z8.string()).optional().describe("Updated list of allowed tools")
4448
+ });
4449
+ var MCPServerCreateResponseSchema = MCPServerSchema;
4450
+ var CustomCreateResponseCamelCaseSchema = z8.object({
4451
+ id: z8.string().min(1, "Server ID cannot be empty"),
4452
+ name: z8.string().min(1, "Server name cannot be empty"),
4453
+ createdAt: z8.string().nullish(),
4454
+ updatedAt: z8.string().nullish(),
4455
+ status: z8.string().nullish()
4456
+ });
4457
+ var CustomCreateResponseSchema = z8.object({
4458
+ id: z8.string().min(1, "Server ID cannot be empty"),
4459
+ name: z8.string().min(1, "Server name cannot be empty"),
4460
+ created_at: z8.string().nullish(),
4461
+ updated_at: z8.string().nullish(),
4462
+ status: z8.string().nullish()
4463
+ });
4464
+ var McpListResponseCamelCaseSchema = z8.object({
4465
+ items: z8.array(
4466
+ z8.object({
4467
+ id: z8.string().min(1, "Server ID cannot be empty"),
4468
+ name: z8.string().min(1, "Server name cannot be empty"),
4469
+ createdAt: z8.string().optional(),
4470
+ updatedAt: z8.string().optional(),
4471
+ status: z8.string().optional()
4472
+ })
4473
+ ).optional()
4474
+ });
4475
+ var McpListResponseSchema = z8.object({
4476
+ items: z8.array(
4477
+ z8.object({
4478
+ id: z8.string().min(1, "Server ID cannot be empty"),
4479
+ name: z8.string().min(1, "Server name cannot be empty"),
4480
+ created_at: z8.string().optional(),
4481
+ updated_at: z8.string().optional(),
4482
+ status: z8.string().optional()
4483
+ })
4484
+ ).optional()
4485
+ });
4486
+ var McpRetrieveResponseCamelCaseSchema = z8.object({
4487
+ id: z8.string().min(1, "Server ID cannot be empty"),
4488
+ name: z8.string().min(1, "Server name cannot be empty"),
4489
+ createdAt: z8.string().optional(),
4490
+ updatedAt: z8.string().optional(),
4491
+ status: z8.string().optional(),
4492
+ toolkits: z8.array(z8.string()).optional(),
4493
+ tools: z8.array(z8.string()).optional(),
4494
+ managedAuthViaComposio: z8.boolean().optional()
4495
+ });
4496
+ var McpRetrieveResponseSchema = z8.object({
4497
+ id: z8.string().min(1, "Server ID cannot be empty"),
4498
+ name: z8.string().min(1, "Server name cannot be empty"),
4499
+ created_at: z8.string().optional(),
4500
+ updated_at: z8.string().optional(),
4501
+ status: z8.string().optional(),
4502
+ toolkits: z8.array(z8.string()).optional(),
4503
+ tools: z8.array(z8.string()).optional(),
4504
+ managed_auth_via_composio: z8.boolean().optional()
4505
+ });
4506
+ var McpDeleteResponseCamelCaseSchema = z8.object({
4507
+ id: z8.string().min(1, "Server ID cannot be empty"),
4508
+ deleted: z8.boolean().optional(),
4509
+ message: z8.string().optional()
4510
+ });
4511
+ var McpDeleteResponseSchema = z8.object({
4512
+ id: z8.string().min(1, "Server ID cannot be empty"),
4513
+ deleted: z8.boolean().optional(),
4514
+ message: z8.string().optional()
4515
+ });
4516
+ var McpUpdateResponseCamelCaseSchema = z8.object({
4517
+ id: z8.string().min(1, "Server ID cannot be empty"),
4518
+ name: z8.string().min(1, "Server name cannot be empty"),
4519
+ createdAt: z8.string().optional(),
4520
+ updatedAt: z8.string().optional(),
4521
+ status: z8.string().optional(),
4522
+ toolkits: z8.array(z8.string()).optional(),
4523
+ tools: z8.array(z8.string()).optional()
4524
+ });
4525
+ var McpUpdateResponseSchema = z8.object({
4526
+ id: z8.string().min(1, "Server ID cannot be empty"),
4527
+ name: z8.string().min(1, "Server name cannot be empty"),
4528
+ created_at: z8.string().optional(),
4529
+ updated_at: z8.string().optional(),
4530
+ status: z8.string().optional(),
4531
+ toolkits: z8.array(z8.string()).optional(),
4532
+ tools: z8.array(z8.string()).optional()
4533
+ });
4534
+
4535
+ // src/utils/transformers/mcp.ts
4536
+ function transformMcpCreateResponse(response) {
4537
+ const result = CustomCreateResponseCamelCaseSchema.safeParse({
4538
+ id: response.id,
4539
+ name: response.name,
4540
+ createdAt: response.created_at,
4541
+ updatedAt: response.updated_at,
4542
+ status: response.status
4543
+ });
4544
+ if (!result.success) {
4545
+ throw new ValidationError("Failed to parse MCP create response", {
4546
+ cause: result.error
4547
+ });
4548
+ }
4549
+ return result.data;
4550
+ }
4551
+ function transformMcpListResponse(response) {
4552
+ const transformedItems = response.items?.map((item) => ({
4553
+ id: item.id,
4554
+ name: item.name,
4555
+ createdAt: item.created_at,
4556
+ updatedAt: item.updated_at,
4557
+ status: item.status
4558
+ }));
4559
+ const result = McpListResponseCamelCaseSchema.safeParse({
4560
+ items: transformedItems
4561
+ });
4562
+ if (!result.success) {
4563
+ throw new ValidationError("Failed to parse MCP list response", {
4564
+ cause: result.error
4565
+ });
4566
+ }
4567
+ return result.data;
4568
+ }
4569
+ function transformMcpRetrieveResponse(response) {
4570
+ const result = McpRetrieveResponseCamelCaseSchema.safeParse({
4571
+ id: response.id,
4572
+ name: response.name,
4573
+ createdAt: response.created_at,
4574
+ updatedAt: response.updated_at,
4575
+ status: response.status,
4576
+ toolkits: response.toolkits,
4577
+ tools: response.tools,
4578
+ managedAuthViaComposio: response.managed_auth_via_composio
4579
+ });
4580
+ if (!result.success) {
4581
+ throw new ValidationError("Failed to parse MCP retrieve response", {
4582
+ cause: result.error
4583
+ });
4584
+ }
4585
+ return result.data;
4586
+ }
4587
+ function transformMcpDeleteResponse(response) {
4588
+ const result = McpDeleteResponseCamelCaseSchema.safeParse({
4589
+ id: response.id,
4590
+ deleted: response.deleted,
4591
+ message: response.message
4592
+ });
4593
+ if (!result.success) {
4594
+ throw new ValidationError("Failed to parse MCP delete response", {
4595
+ cause: result.error
4596
+ });
4597
+ }
4598
+ return result.data;
4599
+ }
4600
+ function transformMcpUpdateResponse(response) {
4601
+ const result = McpUpdateResponseCamelCaseSchema.safeParse({
4602
+ id: response.id,
4603
+ name: response.name,
4604
+ createdAt: response.created_at,
4605
+ updatedAt: response.updated_at,
4606
+ status: response.status,
4607
+ toolkits: response.toolkits,
4608
+ tools: response.tools
4609
+ });
4610
+ if (!result.success) {
4611
+ throw new ValidationError("Failed to parse MCP update response", {
4612
+ cause: result.error
4613
+ });
4614
+ }
4615
+ return result.data;
4616
+ }
4617
+ function transformMcpGenerateUrlResponse(response) {
4618
+ const result = GenerateURLResponseCamelCaseSchema.safeParse({
4619
+ connectedAccountUrls: response.connected_account_urls,
4620
+ userIdsUrl: response.user_ids_url,
4621
+ mcpUrl: response.mcp_url
4622
+ });
4623
+ if (!result.success) {
4624
+ throw new ValidationError("Failed to parse MCP generate URL response", {
4625
+ cause: result.error
4626
+ });
4627
+ }
4628
+ return result.data;
4629
+ }
4630
+
4631
+ // src/models/MCP.ts
4632
+ var MCP = class {
4633
+ client;
4634
+ provider;
4635
+ constructor(client, provider) {
4636
+ this.client = client;
4637
+ this.provider = provider;
4638
+ telemetry.instrument(this);
4639
+ }
4640
+ /**
4641
+ * Validates toolkit configurations using Zod schema
4642
+ * @private
4643
+ * @param {MCPToolkitConfig[]} toolkitConfigs - Array of toolkit configurations to validate
4644
+ * @param {MCPAuthOptions} [authOptions] - Authentication options to validate
4645
+ * @throws {ValidationError} If validation fails
4646
+ */
4647
+ validateInputs(toolkitConfigs, authOptions) {
4648
+ const toolkitConfigsResult = MCPToolkitConfigsArraySchema.safeParse(toolkitConfigs);
4649
+ if (toolkitConfigsResult.error) {
4650
+ throw new ValidationError("Failed to parse toolkit configurations", {
4651
+ cause: toolkitConfigsResult.error
4652
+ });
4653
+ }
4654
+ if (authOptions !== void 0) {
4655
+ const authOptionsResult = MCPAuthOptionsSchema.safeParse(authOptions);
4656
+ if (authOptionsResult.error) {
4657
+ throw new ValidationError("Failed to parse auth options", {
4658
+ cause: authOptionsResult.error
4659
+ });
4660
+ }
4661
+ }
4662
+ }
4663
+ /**
4664
+ * Create a new MCP server
4665
+ * @param {string} name - Unique name for the MCP server
4666
+ * @param {MCPToolkitConfig[]} toolkitConfigs - Array of toolkit configurations
4667
+ * @param {MCPAuthOptions} [authOptions] - Authentication configuration options
4668
+ * @returns {Promise<McpServerCreateResponse<T>>} Created server details with instance getter
4669
+ *
4670
+ * @example
4671
+ * ```typescript
4672
+ * const server = await composio.mcp.create(
4673
+ * "personal-mcp-server",
4674
+ * [
4675
+ * {
4676
+ * toolkit: "GMAIL",
4677
+ * authConfigId: "ac_sdhkjfhjksdk",
4678
+ * allowedTools: ["GMAIL_FETCH_EMAILS"],
4679
+ * },
4680
+ * ],
4681
+ * { useComposioManagedAuth: true },
4682
+ * );
4683
+ *
4684
+ * // Option 1: Use convenience method on response
4685
+ * const urls = await server.getServer({
4686
+ * connectedAccountIds: { gmail: "account_id" }
4687
+ * });
4688
+ *
4689
+ * // Option 2: Use standalone method later
4690
+ * const urlsLater = await composio.mcp.getServer(server.id, {
4691
+ * connectedAccountIds: { gmail: "account_id" }
4692
+ * });
4693
+ * ```
4694
+ */
4695
+ async create(name, toolkitConfigs, authOptions) {
4696
+ this.validateInputs(toolkitConfigs, authOptions);
4697
+ const toolkits = toolkitConfigs.map((config) => config.toolkit);
4698
+ let mcpServerCreatedResponse;
4699
+ try {
4700
+ mcpServerCreatedResponse = await this.client.mcp.custom.create({
4701
+ name,
4702
+ toolkits,
4703
+ custom_tools: toolkitConfigs.flatMap((config) => config.allowedTools),
4704
+ managed_auth_via_composio: authOptions?.useComposioManagedAuth || false,
4705
+ auth_config_ids: toolkitConfigs.map((config) => config.authConfigId)
4706
+ });
4707
+ } catch (error) {
4708
+ throw new ValidationError("Failed to create MCP server", {
4709
+ cause: error
4710
+ });
4711
+ }
4712
+ const serverResponseResult = CustomCreateResponseSchema.safeParse(mcpServerCreatedResponse);
4713
+ if (serverResponseResult.error) {
4714
+ throw new ValidationError("Failed to parse MCP server creation response", {
4715
+ cause: serverResponseResult.error
4716
+ });
4717
+ }
4718
+ const camelCaseResponse = transformMcpCreateResponse(mcpServerCreatedResponse);
4719
+ return {
4720
+ ...camelCaseResponse,
4721
+ toolkits,
4722
+ getServer: async (params) => {
4723
+ return this.getServer(camelCaseResponse.id, params, authOptions);
4724
+ }
4725
+ };
4726
+ }
4727
+ /**
4728
+ * Get server URLs for an existing MCP server
4729
+ * @param {string} id - Server UUID
4730
+ * @param {MCPGetServerParams} params - Parameters for getting server URLs
4731
+ * @param {MCPAuthOptions} [authOptions] - Authentication options (optional, will use server's default if not provided)
4732
+ * @returns {Promise<T>} Transformed server URLs in provider-specific format
4733
+ *
4734
+ * @example
4735
+ * ```typescript
4736
+ * // Get URLs for an existing server
4737
+ * const urls = await composio.mcp.getServer("server-id", {
4738
+ * connectedAccountIds: {
4739
+ * gmail: "connected_account_id"
4740
+ * }
4741
+ * });
4742
+ * ```
4743
+ */
4744
+ async getServer(id, params, authOptions) {
4745
+ const serverDetails = await this.get(id);
4746
+ const paramsResult = MCPGetServerParamsSchema.safeParse(params);
4747
+ if (paramsResult.error) {
4748
+ throw new ValidationError("Failed to parse get server parameters", {
4749
+ cause: paramsResult.error
4750
+ });
4751
+ }
4752
+ const toolkits = serverDetails.toolkits || [];
4753
+ if (paramsResult.data.connectedAccountIds) {
4754
+ const providedToolkits = Object.keys(paramsResult.data.connectedAccountIds);
4755
+ const invalidToolkits = providedToolkits.filter((toolkit) => !toolkits.includes(toolkit));
4756
+ if (invalidToolkits.length > 0) {
4757
+ throw new ValidationError(
4758
+ `Invalid toolkits provided: ${invalidToolkits.join(", ")}. Available toolkits are: ${toolkits.join(", ")}`,
4759
+ {}
4760
+ );
4761
+ }
4762
+ }
4763
+ let data;
4764
+ try {
4765
+ data = await this.client.mcp.generate.url({
4766
+ user_ids: paramsResult.data.userId ? [paramsResult.data.userId] : [],
4767
+ connected_account_ids: paramsResult.data.connectedAccountIds ? Object.values(paramsResult.data.connectedAccountIds) : [],
4768
+ mcp_server_id: id,
4769
+ managed_auth_by_composio: authOptions?.useComposioManagedAuth ?? serverDetails.managedAuthViaComposio ?? false
4770
+ });
4771
+ } catch (error) {
4772
+ throw new ValidationError("Failed to generate MCP server URL", {
4773
+ cause: error
4774
+ });
4775
+ }
4776
+ const urlResponseResult = GenerateURLResponseSchema.safeParse(data);
4777
+ if (urlResponseResult.error) {
4778
+ throw new ValidationError("Failed to parse MCP URL generation response", {
4779
+ cause: urlResponseResult.error
4780
+ });
4781
+ }
4782
+ const camelCaseData = transformMcpGenerateUrlResponse(data);
4783
+ return this.wrapMcpServerResponse(
4784
+ camelCaseData,
4785
+ serverDetails.name,
4786
+ paramsResult.data.connectedAccountIds ? Object.values(paramsResult.data.connectedAccountIds) : void 0,
4787
+ paramsResult.data.userId ? [paramsResult.data.userId] : void 0,
4788
+ paramsResult.data.connectedAccountIds ? Object.keys(paramsResult.data.connectedAccountIds) : void 0
4789
+ );
4790
+ }
4791
+ /**
4792
+ * List MCP server configurations with filtering options
4793
+ * @param {Object} options - Filtering and pagination options
4794
+ * @param {number} [options.page] - Page number for pagination
4795
+ * @param {number} [options.limit] - Number of items per page
4796
+ * @param {string[]} [options.toolkits] - Filter servers by toolkit names
4797
+ * @param {string[]} [options.authConfigs] - Filter servers by auth config IDs
4798
+ * @param {string} [options.name] - Filter servers by name
4799
+ * @param {string} [options.user] - Filter servers by user ID
4800
+ * @returns {Promise<McpListResponse>} List of MCP servers matching the filters
4801
+ *
4802
+ * @example
4803
+ * ```typescript
4804
+ * // List all servers with pagination
4805
+ * const servers = await composio.mcp.list({
4806
+ * page: 1,
4807
+ * limit: 10
4808
+ * });
4809
+ *
4810
+ * // List Gmail and Supabase servers
4811
+ * const filteredServers = await composio.mcp.list({
4812
+ * toolkits: ['GMAIL', 'SUPABASE'],
4813
+ * authConfigIds: ['auth_123', 'auth_456']
4814
+ * });
4815
+ * ```
4816
+ */
4817
+ async list(options) {
4818
+ let listResponse;
4819
+ try {
4820
+ listResponse = await this.client.mcp.list({
4821
+ page_no: options.page || 1,
4822
+ limit: options.limit || 10,
4823
+ toolkits: options?.toolkits?.join(",") || "",
4824
+ auth_config_ids: options?.authConfigs?.join(",") || "",
4825
+ name: options?.name
4826
+ });
4827
+ } catch (error) {
4828
+ throw new ValidationError("Failed to list MCP servers", {
4829
+ cause: error
4830
+ });
4831
+ }
4832
+ const listResponseResult = McpListResponseSchema.safeParse(listResponse);
4833
+ if (listResponseResult.error) {
4834
+ throw new ValidationError("Failed to parse MCP server list response", {
4835
+ cause: listResponseResult.error
4836
+ });
4837
+ }
4838
+ return transformMcpListResponse(listResponse);
4839
+ }
4840
+ /**
4841
+ * Get details of a specific MCP server
4842
+ * @param {string} id - Server UUID
4843
+ * @returns {Promise<ReturnType<typeof transformMcpRetrieveResponse>>} Server details
4844
+ *
4845
+ * @example
4846
+ * ```typescript
4847
+ * const serverDetails = await composio.mcp.get('server-uuid');
4848
+ * ```
4849
+ */
4850
+ async get(id) {
4851
+ let retrieveResponse;
4852
+ try {
4853
+ retrieveResponse = await this.client.mcp.retrieve(id);
4854
+ } catch (error) {
4855
+ throw new ValidationError("Failed to retrieve MCP server", {
4856
+ cause: error
4857
+ });
4858
+ }
4859
+ const retrieveResponseResult = McpRetrieveResponseSchema.safeParse(retrieveResponse);
4860
+ if (retrieveResponseResult.error) {
4861
+ throw new ValidationError("Failed to parse MCP server retrieve response", {
4862
+ cause: retrieveResponseResult.error
4863
+ });
4864
+ }
4865
+ return transformMcpRetrieveResponse(retrieveResponse);
4866
+ }
4867
+ /**
4868
+ * Delete an MCP server
4869
+ * @param {string} id - Server UUID
4870
+ * @returns {Promise<ReturnType<typeof transformMcpDeleteResponse>>} Deletion response
4871
+ *
4872
+ * @example
4873
+ * ```typescript
4874
+ * const result = await composio.mcp.delete('server-uuid');
4875
+ * ```
4876
+ */
4877
+ async delete(id) {
4878
+ let deleteResponse;
4879
+ try {
4880
+ deleteResponse = await this.client.mcp.delete(id);
4881
+ } catch (error) {
4882
+ throw new ValidationError("Failed to delete MCP server", {
4883
+ cause: error
4884
+ });
4885
+ }
4886
+ const deleteResponseResult = McpDeleteResponseSchema.safeParse(deleteResponse);
4887
+ if (deleteResponseResult.error) {
4888
+ throw new ValidationError("Failed to parse MCP server delete response", {
4889
+ cause: deleteResponseResult.error
4890
+ });
4891
+ }
4892
+ return transformMcpDeleteResponse(deleteResponse);
4893
+ }
4894
+ /**
4895
+ * Update an MCP server configuration
4896
+ * @param {string} id - Server UUID
4897
+ * @param {string} name - New unique name for the server
4898
+ * @param {MCPToolkitConfig[]} toolkitConfigs - Array of toolkit configurations
4899
+ * @param {MCPAuthOptions} [authOptions] - Updated authentication options
4900
+ * @returns {Promise<ReturnType<typeof transformMcpUpdateResponse>>} Updated server details
4901
+ *
4902
+ * @example
4903
+ * ```typescript
4904
+ * const updatedServer = await composio.mcp.update(
4905
+ * "server-uuid",
4906
+ * "my-updated-server",
4907
+ * [
4908
+ * {
4909
+ * toolkit: "GMAIL",
4910
+ * authConfigId: "ac_sdhkjfhjksdk",
4911
+ * allowedTools: ["GMAIL_FETCH_EMAILS"],
4912
+ * },
4913
+ * ],
4914
+ * {
4915
+ * useComposioManagedAuth: true,
4916
+ * }
4917
+ * );
4918
+ * ```
4919
+ */
4920
+ async update(id, name, toolkitConfigs, authOptions) {
4921
+ this.validateInputs(toolkitConfigs, authOptions);
4922
+ const toolkits = toolkitConfigs.map((config) => config.toolkit);
4923
+ let updateResponse;
4924
+ try {
4925
+ updateResponse = await this.client.mcp.update(id, {
4926
+ name,
4927
+ toolkits,
4928
+ allowed_tools: toolkitConfigs.flatMap((config) => config.allowedTools),
4929
+ managed_auth_via_composio: authOptions?.useComposioManagedAuth || false
4930
+ });
4931
+ } catch (error) {
4932
+ throw new ValidationError("Failed to update MCP server", {
4933
+ cause: error
4934
+ });
4935
+ }
4936
+ const updateResponseResult = McpUpdateResponseSchema.safeParse(updateResponse);
4937
+ if (updateResponseResult.error) {
4938
+ throw new ValidationError("Failed to parse MCP server update response", {
4939
+ cause: updateResponseResult.error
4940
+ });
4941
+ }
4942
+ return transformMcpUpdateResponse(updateResponse);
4943
+ }
4944
+ /**
4945
+ * Generate URL for an MCP server
4946
+ * @param {GenerateURLParams} params - Parameters for URL generation
4947
+ * @returns {Promise<ReturnType<typeof transformMcpGenerateUrlResponse>>} Generated URL response
4948
+ *
4949
+ * @example
4950
+ * ```typescript
4951
+ * const urlResponse = await composio.mcp.generateUrl({
4952
+ * user_ids: ['user123'],
4953
+ * connected_account_ids: ['account456'],
4954
+ * mcp_server_id: 'server-uuid',
4955
+ * managed_auth_by_composio: true
4956
+ * });
4957
+ * ```
4958
+ */
4959
+ async generateUrl(params) {
4960
+ const paramsResult = GenerateURLParamsSnakeCaseSchema.safeParse(params);
4961
+ if (paramsResult.error) {
4962
+ throw new ValidationError("Failed to parse generateUrl parameters", {
4963
+ cause: paramsResult.error
4964
+ });
4965
+ }
4966
+ let urlResponse;
4967
+ try {
4968
+ urlResponse = await this.client.mcp.generate.url(params);
4969
+ } catch (error) {
4970
+ throw new ValidationError("Failed to generate MCP URL", {
4971
+ cause: error
4972
+ });
4973
+ }
4974
+ const responseResult = GenerateURLResponseSchema.safeParse(urlResponse);
4975
+ if (responseResult.error) {
4976
+ throw new ValidationError("Failed to parse MCP URL generation response", {
4977
+ cause: responseResult.error
4978
+ });
4979
+ }
4980
+ return transformMcpGenerateUrlResponse(urlResponse);
4981
+ }
4982
+ /**
4983
+ * Transform MCP URL response into the appropriate format.
4984
+ * If the provider has a custom transform method, use it.
4985
+ * Otherwise, use the default transformation.
4986
+ *
4987
+ * @param data - The MCP URL response data (in camelCase)
4988
+ * @param serverName - Name of the MCP server
4989
+ * @param connectedAccountIds - Optional array of connected account IDs
4990
+ * @param userIds - Optional array of user IDs
4991
+ * @param toolkits - Optional array of toolkit names
4992
+ * @returns Transformed response in appropriate format
4993
+ */
4994
+ wrapMcpServerResponse(data, serverName, connectedAccountIds, userIds, toolkits) {
4995
+ if (this.provider && typeof this.provider.wrapMcpServerResponse === "function") {
4996
+ const snakeCaseData = {
4997
+ mcp_url: data.mcpUrl,
4998
+ ...data.connectedAccountUrls && { connected_account_urls: data.connectedAccountUrls },
4999
+ ...data.userIdsUrl && { user_ids_url: data.userIdsUrl }
5000
+ };
5001
+ const transformed = this.provider.wrapMcpServerResponse(
5002
+ snakeCaseData,
5003
+ serverName,
5004
+ connectedAccountIds,
5005
+ userIds,
5006
+ toolkits
5007
+ );
5008
+ return transformed;
5009
+ }
5010
+ if (connectedAccountIds?.length && data.connectedAccountUrls) {
5011
+ return data.connectedAccountUrls.map((url, index) => ({
5012
+ url: new URL(url),
5013
+ name: `${serverName}-${connectedAccountIds[index]}`,
5014
+ toolkit: toolkits?.[index]
5015
+ }));
5016
+ } else if (userIds?.length && data.userIdsUrl) {
5017
+ return data.userIdsUrl.map((url, index) => ({
5018
+ url: new URL(url),
5019
+ name: `${serverName}-${userIds[index]}`,
5020
+ toolkit: toolkits?.[index]
5021
+ }));
5022
+ }
5023
+ return {
5024
+ url: new URL(data.mcpUrl),
5025
+ name: serverName
5026
+ };
5027
+ }
5028
+ };
5029
+
4360
5030
  // src/utils/constants.ts
5031
+ var constants_exports = {};
5032
+ __export(constants_exports, {
5033
+ COMPOSIO_DIR: () => COMPOSIO_DIR,
5034
+ DEFAULT_BASE_URL: () => DEFAULT_BASE_URL,
5035
+ IS_DEVELOPMENT_OR_CI: () => IS_DEVELOPMENT_OR_CI,
5036
+ TELEMETRY_URL: () => TELEMETRY_URL2,
5037
+ TEMP_FILES_DIRECTORY_NAME: () => TEMP_FILES_DIRECTORY_NAME,
5038
+ USER_DATA_FILE_NAME: () => USER_DATA_FILE_NAME
5039
+ });
4361
5040
  var COMPOSIO_DIR = ".composio";
4362
5041
  var USER_DATA_FILE_NAME = "user_data.json";
5042
+ var TEMP_FILES_DIRECTORY_NAME = "files";
4363
5043
  var DEFAULT_BASE_URL = "https://backend.composio.dev";
5044
+ var TELEMETRY_URL2 = "https://app.composio.dev";
4364
5045
  var IS_DEVELOPMENT_OR_CI = process.env.DEVELOPMENT || process.env.CI || false;
4365
5046
 
4366
5047
  // src/utils/sdk.ts
@@ -4469,17 +5150,17 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4469
5150
  name = "openai";
4470
5151
  /**
4471
5152
  * Creates a new instance of the OpenAIProvider.
4472
- *
5153
+ *
4473
5154
  * This is the default provider for the Composio SDK and is automatically
4474
5155
  * available without additional installation.
4475
- *
5156
+ *
4476
5157
  * @example
4477
5158
  * ```typescript
4478
5159
  * // The OpenAIProvider is used by default when initializing Composio
4479
5160
  * const composio = new Composio({
4480
5161
  * apiKey: 'your-api-key'
4481
5162
  * });
4482
- *
5163
+ *
4483
5164
  * // You can also explicitly specify it
4484
5165
  * const composio = new Composio({
4485
5166
  * apiKey: 'your-api-key',
@@ -4490,15 +5171,45 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4490
5171
  constructor() {
4491
5172
  super();
4492
5173
  }
5174
+ /**
5175
+ * Transform MCP URL response into OpenAI-specific format.
5176
+ * OpenAI uses the standard format by default.
5177
+ *
5178
+ * @param data - The MCP URL response data
5179
+ * @param serverName - Name of the MCP server
5180
+ * @param connectedAccountIds - Optional array of connected account IDs
5181
+ * @param userIds - Optional array of user IDs
5182
+ * @param toolkits - Optional array of toolkit names
5183
+ * @returns Standard MCP server response format
5184
+ */
5185
+ wrapMcpServerResponse(data, serverName, connectedAccountIds, userIds, toolkits) {
5186
+ if (connectedAccountIds?.length && data.connected_account_urls) {
5187
+ return data.connected_account_urls.map((url, index) => ({
5188
+ url: new URL(url),
5189
+ name: `${serverName}-${connectedAccountIds[index]}`,
5190
+ toolkit: toolkits?.[index]
5191
+ }));
5192
+ } else if (userIds?.length && data.user_ids_url) {
5193
+ return data.user_ids_url.map((url, index) => ({
5194
+ url: new URL(url),
5195
+ name: `${serverName}-${userIds[index]}`,
5196
+ toolkit: toolkits?.[index]
5197
+ }));
5198
+ }
5199
+ return {
5200
+ url: new URL(data.mcp_url),
5201
+ name: serverName
5202
+ };
5203
+ }
4493
5204
  /**
4494
5205
  * Wraps a Composio tool in the OpenAI function calling format.
4495
- *
5206
+ *
4496
5207
  * This method transforms a Composio tool definition into the format
4497
5208
  * expected by OpenAI's function calling API.
4498
- *
5209
+ *
4499
5210
  * @param tool - The Composio tool to wrap
4500
5211
  * @returns The wrapped tool in OpenAI format
4501
- *
5212
+ *
4502
5213
  * @example
4503
5214
  * ```typescript
4504
5215
  * // Wrap a single tool for use with OpenAI
@@ -4513,7 +5224,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4513
5224
  * required: ['query']
4514
5225
  * }
4515
5226
  * };
4516
- *
5227
+ *
4517
5228
  * const openAITool = provider.wrapTool(composioTool);
4518
5229
  * ```
4519
5230
  */
@@ -4530,13 +5241,13 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4530
5241
  };
4531
5242
  /**
4532
5243
  * Wraps multiple Composio tools in the OpenAI function calling format.
4533
- *
5244
+ *
4534
5245
  * This method transforms a list of Composio tools into the format
4535
5246
  * expected by OpenAI's function calling API.
4536
- *
5247
+ *
4537
5248
  * @param tools - Array of Composio tools to wrap
4538
5249
  * @returns Array of wrapped tools in OpenAI format
4539
- *
5250
+ *
4540
5251
  * @example
4541
5252
  * ```typescript
4542
5253
  * // Wrap multiple tools for use with OpenAI
@@ -4562,7 +5273,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4562
5273
  * }
4563
5274
  * }
4564
5275
  * ];
4565
- *
5276
+ *
4566
5277
  * const openAITools = provider.wrapTools(composioTools);
4567
5278
  * ```
4568
5279
  */
@@ -4571,16 +5282,16 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4571
5282
  };
4572
5283
  /**
4573
5284
  * Executes a tool call from OpenAI's chat completion.
4574
- *
5285
+ *
4575
5286
  * This method processes a tool call from OpenAI's chat completion API,
4576
5287
  * executes the corresponding Composio tool, and returns the result.
4577
- *
5288
+ *
4578
5289
  * @param {string} userId - The user ID for authentication and tracking
4579
5290
  * @param {OpenAI.ChatCompletionMessageToolCall} tool - The tool call from OpenAI
4580
5291
  * @param {ExecuteToolFnOptions} [options] - Optional execution options
4581
5292
  * @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
4582
5293
  * @returns {Promise<string>} The result of the tool call as a JSON string
4583
- *
5294
+ *
4584
5295
  * @example
4585
5296
  * ```typescript
4586
5297
  * // Execute a tool call from OpenAI
@@ -4592,7 +5303,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4592
5303
  * arguments: '{"query":"composio documentation"}'
4593
5304
  * }
4594
5305
  * };
4595
- *
5306
+ *
4596
5307
  * const result = await provider.executeToolCall(
4597
5308
  * 'user123',
4598
5309
  * toolCall,
@@ -4622,7 +5333,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4622
5333
  * @param {ExecuteToolFnOptions} [options] - Optional execution options
4623
5334
  * @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
4624
5335
  * @returns {Promise<string[]>} Array of tool execution results as JSON strings
4625
- *
5336
+ *
4626
5337
  * @example
4627
5338
  * ```typescript
4628
5339
  * // Handle tool calls from a chat completion response
@@ -4644,7 +5355,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4644
5355
  * }
4645
5356
  * ]
4646
5357
  * };
4647
- *
5358
+ *
4648
5359
  * const results = await provider.handleToolCalls(
4649
5360
  * 'user123',
4650
5361
  * chatCompletion,
@@ -4675,7 +5386,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4675
5386
  * @param {ExecuteToolFnOptions} [options] - Optional execution options
4676
5387
  * @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
4677
5388
  * @returns {Promise<OpenAI.Beta.Threads.Runs.RunSubmitToolOutputsParams.ToolOutput[]>} Array of tool outputs for submission
4678
- *
5389
+ *
4679
5390
  * @example
4680
5391
  * ```typescript
4681
5392
  * // Handle tool calls from an OpenAI Assistant run
@@ -4696,13 +5407,13 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4696
5407
  * }
4697
5408
  * }
4698
5409
  * };
4699
- *
5410
+ *
4700
5411
  * const toolOutputs = await provider.handleAssistantMessage(
4701
5412
  * 'user123',
4702
5413
  * run,
4703
5414
  * { connectedAccountId: 'conn_xyz456' }
4704
5415
  * );
4705
- *
5416
+ *
4706
5417
  * // Submit tool outputs back to OpenAI
4707
5418
  * await openai.beta.threads.runs.submitToolOutputs(
4708
5419
  * thread.id,
@@ -4745,7 +5456,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4745
5456
  * @param {ExecuteToolFnOptions} [options] - Optional execution options
4746
5457
  * @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
4747
5458
  * @returns {AsyncGenerator<OpenAI.Beta.Assistants.AssistantStreamEvent, void, unknown>} Generator yielding stream events
4748
- *
5459
+ *
4749
5460
  * @example
4750
5461
  * ```typescript
4751
5462
  * // Process an OpenAI Assistant stream with tool calls
@@ -4754,7 +5465,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4754
5465
  * assistant_id: 'asst_abc123',
4755
5466
  * tools: provider.wrapTools(composioTools)
4756
5467
  * });
4757
- *
5468
+ *
4758
5469
  * // Process the stream and handle tool calls
4759
5470
  * const streamProcessor = provider.waitAndHandleAssistantStreamToolCalls(
4760
5471
  * 'user123',
@@ -4763,7 +5474,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4763
5474
  * thread,
4764
5475
  * { connectedAccountId: 'conn_xyz456' }
4765
5476
  * );
4766
- *
5477
+ *
4767
5478
  * // Consume the stream events
4768
5479
  * for await (const event of streamProcessor) {
4769
5480
  * if (event.event === 'thread.message.delta') {
@@ -4833,7 +5544,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4833
5544
  * @param {ExecuteToolFnOptions} [options] - Optional execution options
4834
5545
  * @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
4835
5546
  * @returns {Promise<OpenAI.Beta.Threads.Run>} The final run object after completion
4836
- *
5547
+ *
4837
5548
  * @example
4838
5549
  * ```typescript
4839
5550
  * // Process an OpenAI Assistant run with tool calls
@@ -4842,12 +5553,12 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4842
5553
  * role: 'user',
4843
5554
  * content: 'Find information about Composio'
4844
5555
  * });
4845
- *
5556
+ *
4846
5557
  * let run = await openai.beta.threads.runs.create(thread.id, {
4847
5558
  * assistant_id: 'asst_abc123',
4848
5559
  * tools: provider.wrapTools(composioTools)
4849
5560
  * });
4850
- *
5561
+ *
4851
5562
  * // Wait for the run to complete, handling any tool calls
4852
5563
  * run = await provider.waitAndHandleAssistantToolCalls(
4853
5564
  * 'user123',
@@ -4856,7 +5567,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4856
5567
  * thread,
4857
5568
  * { connectedAccountId: 'conn_xyz456' }
4858
5569
  * );
4859
- *
5570
+ *
4860
5571
  * // Get the final messages after run completion
4861
5572
  * const messages = await openai.beta.threads.messages.list(thread.id);
4862
5573
  * console.log(messages.data[0].content);
@@ -4879,7 +5590,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4879
5590
  };
4880
5591
 
4881
5592
  // package.json
4882
- var version = "0.1.23";
5593
+ var version = "0.1.25";
4883
5594
 
4884
5595
  // src/composio.ts
4885
5596
  var Composio = class _Composio {
@@ -4904,6 +5615,7 @@ var Composio = class _Composio {
4904
5615
  authConfigs;
4905
5616
  // connected accounts
4906
5617
  connectedAccounts;
5618
+ mcp;
4907
5619
  /**
4908
5620
  * Creates a new instance of the Composio SDK.
4909
5621
  *
@@ -4956,6 +5668,7 @@ var Composio = class _Composio {
4956
5668
  };
4957
5669
  this.provider = config?.provider ?? new OpenAIProvider();
4958
5670
  this.tools = new Tools(this.client, this.provider);
5671
+ this.mcp = new MCP(this.client, this.provider);
4959
5672
  this.toolkits = new Toolkits(this.client);
4960
5673
  this.triggers = new Triggers(this.client);
4961
5674
  this.authConfigs = new AuthConfigs(this.client);
@@ -5034,6 +5747,9 @@ var Composio = class _Composio {
5034
5747
  // src/provider/ComposioProvider.ts
5035
5748
  var ComposioProvider = class extends BaseNonAgenticProvider {
5036
5749
  name = "ComposioProvider";
5750
+ constructor() {
5751
+ super();
5752
+ }
5037
5753
  wrapTool = (tool) => {
5038
5754
  return tool;
5039
5755
  };
@@ -5108,11 +5824,12 @@ var AuthScheme = class {
5108
5824
  * Creates a ConnectionData object for Composio Link authentication
5109
5825
  * @returns ConnectionData object
5110
5826
  */
5111
- static ComposioLink() {
5827
+ static ComposioLink(params) {
5112
5828
  return {
5113
5829
  authScheme: AuthSchemeTypes.COMPOSIO_LINK,
5114
5830
  val: {
5115
- status: ConnectionStatuses.INITIALIZING
5831
+ status: ConnectionStatuses.INITIALIZING,
5832
+ ...params
5116
5833
  }
5117
5834
  };
5118
5835
  }
@@ -5126,7 +5843,7 @@ var AuthScheme = class {
5126
5843
  authScheme: AuthSchemeTypes.API_KEY,
5127
5844
  val: {
5128
5845
  status: ConnectionStatuses.ACTIVE,
5129
- api_key: params.api_key
5846
+ ...params
5130
5847
  }
5131
5848
  };
5132
5849
  }
@@ -5140,8 +5857,7 @@ var AuthScheme = class {
5140
5857
  authScheme: AuthSchemeTypes.BASIC,
5141
5858
  val: {
5142
5859
  status: ConnectionStatuses.ACTIVE,
5143
- username: params.username,
5144
- password: params.password
5860
+ ...params
5145
5861
  }
5146
5862
  };
5147
5863
  }
@@ -5155,7 +5871,7 @@ var AuthScheme = class {
5155
5871
  authScheme: AuthSchemeTypes.BEARER_TOKEN,
5156
5872
  val: {
5157
5873
  status: ConnectionStatuses.ACTIVE,
5158
- token: params.token
5874
+ ...params
5159
5875
  }
5160
5876
  };
5161
5877
  }
@@ -5169,7 +5885,7 @@ var AuthScheme = class {
5169
5885
  authScheme: AuthSchemeTypes.GOOGLE_SERVICE_ACCOUNT,
5170
5886
  val: {
5171
5887
  status: ConnectionStatuses.ACTIVE,
5172
- credentials_json: params.credentials_json
5888
+ ...params
5173
5889
  }
5174
5890
  };
5175
5891
  }
@@ -5177,11 +5893,12 @@ var AuthScheme = class {
5177
5893
  * Creates a ConnectionData object for No Auth authentication
5178
5894
  * @returns ConnectionData object
5179
5895
  */
5180
- static NoAuth() {
5896
+ static NoAuth(params) {
5181
5897
  return {
5182
5898
  authScheme: AuthSchemeTypes.NO_AUTH,
5183
5899
  val: {
5184
- status: ConnectionStatuses.ACTIVE
5900
+ status: ConnectionStatuses.ACTIVE,
5901
+ ...params
5185
5902
  }
5186
5903
  };
5187
5904
  }
@@ -5195,8 +5912,7 @@ var AuthScheme = class {
5195
5912
  authScheme: AuthSchemeTypes.BASIC_WITH_JWT,
5196
5913
  val: {
5197
5914
  status: ConnectionStatuses.ACTIVE,
5198
- username: params.username,
5199
- password: params.password
5915
+ ...params
5200
5916
  }
5201
5917
  };
5202
5918
  }
@@ -5204,11 +5920,12 @@ var AuthScheme = class {
5204
5920
  * Creates a ConnectionData object for Cal.com authentication
5205
5921
  * @returns ConnectionData object
5206
5922
  */
5207
- static CalcomAuth() {
5923
+ static CalcomAuth(params) {
5208
5924
  return {
5209
5925
  authScheme: AuthSchemeTypes.CALCOM_AUTH,
5210
5926
  val: {
5211
- status: ConnectionStatuses.ACTIVE
5927
+ status: ConnectionStatuses.ACTIVE,
5928
+ ...params
5212
5929
  }
5213
5930
  };
5214
5931
  }
@@ -5216,11 +5933,12 @@ var AuthScheme = class {
5216
5933
  * Creates a ConnectionData object for Snowflake authentication
5217
5934
  * @returns ConnectionData object
5218
5935
  */
5219
- static Snowflake() {
5936
+ static Snowflake(params) {
5220
5937
  return {
5221
5938
  authScheme: AuthSchemeTypes.SNOWFLAKE,
5222
5939
  val: {
5223
- status: ConnectionStatuses.ACTIVE
5940
+ status: ConnectionStatuses.ACTIVE,
5941
+ ...params
5224
5942
  }
5225
5943
  };
5226
5944
  }
@@ -5234,8 +5952,7 @@ var AuthScheme = class {
5234
5952
  authScheme: AuthSchemeTypes.BILLCOM_AUTH,
5235
5953
  val: {
5236
5954
  status: ConnectionStatuses.ACTIVE,
5237
- sessionId: params.sessionId,
5238
- devKey: params.devKey
5955
+ ...params
5239
5956
  }
5240
5957
  };
5241
5958
  }
@@ -5284,8 +6001,34 @@ export {
5284
6001
  CreateComposioManagedAuthConfigParamsSchema,
5285
6002
  CreateCustomAuthConfigParamsSchema,
5286
6003
  CustomAuthParamsSchema,
6004
+ CustomCreateResponseCamelCaseSchema,
6005
+ CustomCreateResponseSchema,
6006
+ GenerateURLParamsSchema,
6007
+ GenerateURLParamsSnakeCaseSchema,
6008
+ GenerateURLResponseCamelCaseSchema,
6009
+ GenerateURLResponseSchema,
5287
6010
  IncomingTriggerPayloadSchema,
5288
6011
  JsonSchemaToZodError,
6012
+ MCP,
6013
+ MCPAuthOptionsSchema,
6014
+ MCPGenerateURLParamsSchema,
6015
+ MCPGetServerParamsSchema,
6016
+ MCPMultiAppServerSchema,
6017
+ MCPServerCreateResponseSchema,
6018
+ MCPServerListResponseSchema,
6019
+ MCPServerSchema,
6020
+ MCPServerUpdateParamsSchema,
6021
+ MCPSingleAppServerSchema,
6022
+ MCPToolkitConfigSchema,
6023
+ MCPToolkitConfigsArraySchema,
6024
+ McpDeleteResponseCamelCaseSchema,
6025
+ McpDeleteResponseSchema,
6026
+ McpListResponseCamelCaseSchema,
6027
+ McpListResponseSchema,
6028
+ McpRetrieveResponseCamelCaseSchema,
6029
+ McpRetrieveResponseSchema,
6030
+ McpUpdateResponseCamelCaseSchema,
6031
+ McpUpdateResponseSchema,
5289
6032
  Oauth1ActiveConnectionDataSchema,
5290
6033
  Oauth1ConnectionDataSchema,
5291
6034
  Oauth1ExpiredConnectionDataSchema,
@@ -5338,6 +6081,7 @@ export {
5338
6081
  TriggerSubscribeParamSchema,
5339
6082
  ValidationError,
5340
6083
  ValidationErrorCodes,
6084
+ constants_exports as constants,
5341
6085
  jsonSchemaToZodSchema,
5342
6086
  logger_default as logger,
5343
6087
  removeNonRequiredProperties