@composio/core 0.1.24 → 0.1.26
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 +824 -71
- package/dist/index.d.cts +1052 -63
- package/dist/index.d.ts +1052 -63
- package/dist/index.js +802 -71
- package/package.json +1 -1
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(
|
|
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(
|
|
2234
|
+
* const tools = await composio.tools.getRawComposioTools();
|
|
2208
2235
|
*
|
|
2209
2236
|
* // Get tools with filters
|
|
2210
|
-
* const githubTools = await composio.tools.getRawComposioTools(
|
|
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(
|
|
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(
|
|
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('
|
|
2308
|
+
* const tool = await composio.tools.getRawComposioToolBySlug('github');
|
|
2282
2309
|
* ```
|
|
2283
2310
|
*/
|
|
2284
|
-
async getRawComposioToolBySlug(
|
|
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(
|
|
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(
|
|
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(
|
|
2494
|
+
const composioTool = await this.getRawComposioToolBySlug(slug);
|
|
2468
2495
|
if (!composioTool) {
|
|
2469
2496
|
throw new ComposioToolNotFoundError(`Tool with slug ${slug} not found`);
|
|
2470
2497
|
}
|
|
@@ -2696,14 +2723,11 @@ var ToolkitRetrieveCategoriesResponseSchema = import_zod7.z.object({
|
|
|
2696
2723
|
nextCursor: import_zod7.z.string().nullable(),
|
|
2697
2724
|
totalPages: import_zod7.z.number()
|
|
2698
2725
|
});
|
|
2699
|
-
var ToolkitAuthFieldsResponseSchema = import_zod7.z.
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
})
|
|
2705
|
-
)
|
|
2706
|
-
});
|
|
2726
|
+
var ToolkitAuthFieldsResponseSchema = import_zod7.z.array(
|
|
2727
|
+
ToolkitAuthFieldSchema.extend({
|
|
2728
|
+
required: import_zod7.z.boolean().optional()
|
|
2729
|
+
})
|
|
2730
|
+
);
|
|
2707
2731
|
|
|
2708
2732
|
// src/models/AuthConfigs.ts
|
|
2709
2733
|
var AuthConfigs = class {
|
|
@@ -3595,43 +3619,37 @@ var Toolkits = class {
|
|
|
3595
3619
|
}
|
|
3596
3620
|
const authConfig = authScheme ? toolkit.authConfigDetails.find((authConfig2) => authConfig2.mode === authScheme) : toolkit.authConfigDetails[0];
|
|
3597
3621
|
if (!authConfig) {
|
|
3598
|
-
throw new ComposioAuthConfigNotFoundError(
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3622
|
+
throw new ComposioAuthConfigNotFoundError(
|
|
3623
|
+
`Auth schema ${authScheme} not found for toolkit ${toolkitSlug} with auth scheme ${authScheme}`,
|
|
3624
|
+
{
|
|
3625
|
+
meta: {
|
|
3626
|
+
toolkitSlug,
|
|
3627
|
+
authScheme
|
|
3628
|
+
}
|
|
3602
3629
|
}
|
|
3603
|
-
|
|
3630
|
+
);
|
|
3604
3631
|
}
|
|
3605
3632
|
const requiredFields = authConfig.fields[authConfigType].required.map((field) => ({
|
|
3606
3633
|
...field,
|
|
3607
3634
|
required: true
|
|
3608
3635
|
}));
|
|
3609
3636
|
if (requiredOnly) {
|
|
3610
|
-
return
|
|
3611
|
-
authScheme: AuthSchemeEnum.parse(authConfig.mode),
|
|
3612
|
-
fields: requiredFields
|
|
3613
|
-
};
|
|
3637
|
+
return requiredFields;
|
|
3614
3638
|
}
|
|
3615
3639
|
const optionalFields = authConfig.fields[authConfigType].optional.map((field) => ({
|
|
3616
3640
|
...field,
|
|
3617
3641
|
required: false
|
|
3618
3642
|
}));
|
|
3619
|
-
return
|
|
3620
|
-
authScheme: AuthSchemeEnum.parse(authConfig.mode),
|
|
3621
|
-
fields: [...requiredFields, ...optionalFields]
|
|
3622
|
-
};
|
|
3643
|
+
return [...requiredFields, ...optionalFields];
|
|
3623
3644
|
}
|
|
3624
3645
|
/**
|
|
3625
3646
|
* Retrieves the fields required for creating an auth config for a toolkit.
|
|
3626
3647
|
* @param toolkitSlug - The slug of the toolkit to retrieve the fields for
|
|
3627
3648
|
* @param authScheme - The auth scheme to retrieve the fields for
|
|
3628
|
-
* @param requiredOnly - Whether to only return the required fields
|
|
3649
|
+
* @param options.requiredOnly - Whether to only return the required fields
|
|
3629
3650
|
* @returns {Promise<ToolkitAuthFieldsResponse>} The fields required for creating an auth config
|
|
3630
3651
|
*/
|
|
3631
|
-
async getAuthConfigCreationFields(toolkitSlug, {
|
|
3632
|
-
authScheme,
|
|
3633
|
-
requiredOnly = false
|
|
3634
|
-
} = {}) {
|
|
3652
|
+
async getAuthConfigCreationFields(toolkitSlug, authScheme, { requiredOnly = false } = {}) {
|
|
3635
3653
|
return this.getAuthConfigFields(
|
|
3636
3654
|
toolkitSlug,
|
|
3637
3655
|
authScheme ?? null,
|
|
@@ -3643,13 +3661,10 @@ var Toolkits = class {
|
|
|
3643
3661
|
* Retrieves the fields required for initiating a connected account for a toolkit.
|
|
3644
3662
|
* @param toolkitSlug - The slug of the toolkit to retrieve the fields for
|
|
3645
3663
|
* @param authScheme - The auth scheme to retrieve the fields for
|
|
3646
|
-
* @param requiredOnly - Whether to only return the required fields
|
|
3664
|
+
* @param options.requiredOnly - Whether to only return the required fields
|
|
3647
3665
|
* @returns {Promise<ToolkitAuthFieldsResponse>} The fields required for initiating a connected account
|
|
3648
3666
|
*/
|
|
3649
|
-
async getConnectedAccountInitiationFields(toolkitSlug, {
|
|
3650
|
-
authScheme,
|
|
3651
|
-
requiredOnly = false
|
|
3652
|
-
} = {}) {
|
|
3667
|
+
async getConnectedAccountInitiationFields(toolkitSlug, authScheme, { requiredOnly = false } = {}) {
|
|
3653
3668
|
return this.getAuthConfigFields(
|
|
3654
3669
|
toolkitSlug,
|
|
3655
3670
|
authScheme ?? null,
|
|
@@ -4485,10 +4500,686 @@ var Triggers = class {
|
|
|
4485
4500
|
}
|
|
4486
4501
|
};
|
|
4487
4502
|
|
|
4503
|
+
// src/types/mcp.types.ts
|
|
4504
|
+
var import_zod10 = require("zod");
|
|
4505
|
+
var MCPToolkitConfigSchema = import_zod10.z.object({
|
|
4506
|
+
toolkit: import_zod10.z.string().min(1, "Toolkit name cannot be empty"),
|
|
4507
|
+
authConfigId: import_zod10.z.string().min(1, "Auth config ID cannot be empty"),
|
|
4508
|
+
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")
|
|
4509
|
+
});
|
|
4510
|
+
var MCPToolkitConfigsArraySchema = import_zod10.z.array(MCPToolkitConfigSchema).min(1, "At least one toolkit configuration is required").refine((configs) => {
|
|
4511
|
+
const toolkits = configs.map((config) => config.toolkit);
|
|
4512
|
+
const uniqueToolkits = new Set(toolkits);
|
|
4513
|
+
return uniqueToolkits.size === toolkits.length;
|
|
4514
|
+
}, "Duplicate toolkits are not allowed. Each toolkit must be unique.");
|
|
4515
|
+
var MCPAuthOptionsSchema = import_zod10.z.object({
|
|
4516
|
+
useComposioManagedAuth: import_zod10.z.boolean().optional()
|
|
4517
|
+
});
|
|
4518
|
+
var MCPGetServerParamsSchema = import_zod10.z.object({
|
|
4519
|
+
userId: import_zod10.z.string().min(1, "User ID cannot be empty").optional(),
|
|
4520
|
+
connectedAccountIds: import_zod10.z.record(import_zod10.z.string(), import_zod10.z.string().min(1, "Account ID cannot be empty")).optional()
|
|
4521
|
+
}).refine(
|
|
4522
|
+
(data) => {
|
|
4523
|
+
const hasUserId = !!data.userId;
|
|
4524
|
+
const hasConnectedAccountIds = !!data.connectedAccountIds && Object.keys(data.connectedAccountIds).length > 0;
|
|
4525
|
+
return hasUserId !== hasConnectedAccountIds;
|
|
4526
|
+
},
|
|
4527
|
+
{
|
|
4528
|
+
message: "Must provide either userId or connectedAccountIds, but not both"
|
|
4529
|
+
}
|
|
4530
|
+
);
|
|
4531
|
+
var MCPGenerateURLParamsSchema = import_zod10.z.object({
|
|
4532
|
+
userIds: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
4533
|
+
connectedAccountIds: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
4534
|
+
useComposioManagedAuth: import_zod10.z.boolean().optional()
|
|
4535
|
+
});
|
|
4536
|
+
var GenerateURLParamsSnakeCaseSchema = import_zod10.z.object({
|
|
4537
|
+
user_ids: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
4538
|
+
connected_account_ids: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
4539
|
+
mcp_server_id: import_zod10.z.string(),
|
|
4540
|
+
managed_auth_by_composio: import_zod10.z.boolean().optional()
|
|
4541
|
+
});
|
|
4542
|
+
var GenerateURLParamsSchema = import_zod10.z.object({
|
|
4543
|
+
userIds: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
4544
|
+
connectedAccountIds: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
4545
|
+
mcpServerId: import_zod10.z.string(),
|
|
4546
|
+
managedAuthByComposio: import_zod10.z.boolean().optional()
|
|
4547
|
+
});
|
|
4548
|
+
var GenerateURLResponseCamelCaseSchema = import_zod10.z.object({
|
|
4549
|
+
connectedAccountUrls: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
4550
|
+
userIdsUrl: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
4551
|
+
mcpUrl: import_zod10.z.string().min(1, "MCP URL cannot be empty")
|
|
4552
|
+
});
|
|
4553
|
+
var GenerateURLResponseSchema = import_zod10.z.object({
|
|
4554
|
+
connected_account_urls: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
4555
|
+
user_ids_url: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
4556
|
+
mcp_url: import_zod10.z.string().min(1, "MCP URL cannot be empty")
|
|
4557
|
+
});
|
|
4558
|
+
var MCPSingleAppServerSchema = import_zod10.z.object({
|
|
4559
|
+
name: import_zod10.z.string().describe("Name of the MCP server"),
|
|
4560
|
+
tools: import_zod10.z.array(import_zod10.z.string()).describe("List of allowed tools"),
|
|
4561
|
+
authConfigId: import_zod10.z.string().optional().describe("Auth config ID for the server")
|
|
4562
|
+
});
|
|
4563
|
+
var MCPMultiAppServerSchema = import_zod10.z.object({
|
|
4564
|
+
name: import_zod10.z.string().describe("Name of the MCP server"),
|
|
4565
|
+
tools: import_zod10.z.array(import_zod10.z.string()).describe("List of allowed tools across toolkits"),
|
|
4566
|
+
toolkits: import_zod10.z.array(import_zod10.z.string()).describe("List of allowed toolkits")
|
|
4567
|
+
});
|
|
4568
|
+
var MCPServerSchema = import_zod10.z.object({
|
|
4569
|
+
id: import_zod10.z.string().describe("Unique identifier for the MCP server"),
|
|
4570
|
+
type: import_zod10.z.enum(["single", "multi"]).describe("Type of MCP server"),
|
|
4571
|
+
createdAt: import_zod10.z.string().describe("Creation timestamp"),
|
|
4572
|
+
updatedAt: import_zod10.z.string().describe("Last update timestamp"),
|
|
4573
|
+
status: import_zod10.z.enum(["active", "inactive", "error"]).default("active"),
|
|
4574
|
+
config: import_zod10.z.union([MCPSingleAppServerSchema, MCPMultiAppServerSchema])
|
|
4575
|
+
});
|
|
4576
|
+
var MCPServerListResponseSchema = import_zod10.z.object({
|
|
4577
|
+
items: import_zod10.z.array(MCPServerSchema),
|
|
4578
|
+
total: import_zod10.z.number(),
|
|
4579
|
+
page: import_zod10.z.number(),
|
|
4580
|
+
pageSize: import_zod10.z.number()
|
|
4581
|
+
});
|
|
4582
|
+
var MCPServerUpdateParamsSchema = import_zod10.z.object({
|
|
4583
|
+
name: import_zod10.z.string().optional().describe("New name for the server"),
|
|
4584
|
+
toolkits: import_zod10.z.array(import_zod10.z.string()).optional().describe("Updated list of toolkits"),
|
|
4585
|
+
allowedTools: import_zod10.z.array(import_zod10.z.string()).optional().describe("Updated list of allowed tools")
|
|
4586
|
+
});
|
|
4587
|
+
var MCPServerCreateResponseSchema = MCPServerSchema;
|
|
4588
|
+
var CustomCreateResponseCamelCaseSchema = import_zod10.z.object({
|
|
4589
|
+
id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
|
|
4590
|
+
name: import_zod10.z.string().min(1, "Server name cannot be empty"),
|
|
4591
|
+
createdAt: import_zod10.z.string().nullish(),
|
|
4592
|
+
updatedAt: import_zod10.z.string().nullish(),
|
|
4593
|
+
status: import_zod10.z.string().nullish()
|
|
4594
|
+
});
|
|
4595
|
+
var CustomCreateResponseSchema = import_zod10.z.object({
|
|
4596
|
+
id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
|
|
4597
|
+
name: import_zod10.z.string().min(1, "Server name cannot be empty"),
|
|
4598
|
+
created_at: import_zod10.z.string().nullish(),
|
|
4599
|
+
updated_at: import_zod10.z.string().nullish(),
|
|
4600
|
+
status: import_zod10.z.string().nullish()
|
|
4601
|
+
});
|
|
4602
|
+
var McpListResponseCamelCaseSchema = import_zod10.z.object({
|
|
4603
|
+
items: import_zod10.z.array(
|
|
4604
|
+
import_zod10.z.object({
|
|
4605
|
+
id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
|
|
4606
|
+
name: import_zod10.z.string().min(1, "Server name cannot be empty"),
|
|
4607
|
+
createdAt: import_zod10.z.string().optional(),
|
|
4608
|
+
updatedAt: import_zod10.z.string().optional(),
|
|
4609
|
+
status: import_zod10.z.string().optional()
|
|
4610
|
+
})
|
|
4611
|
+
).optional()
|
|
4612
|
+
});
|
|
4613
|
+
var McpListResponseSchema = import_zod10.z.object({
|
|
4614
|
+
items: import_zod10.z.array(
|
|
4615
|
+
import_zod10.z.object({
|
|
4616
|
+
id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
|
|
4617
|
+
name: import_zod10.z.string().min(1, "Server name cannot be empty"),
|
|
4618
|
+
created_at: import_zod10.z.string().optional(),
|
|
4619
|
+
updated_at: import_zod10.z.string().optional(),
|
|
4620
|
+
status: import_zod10.z.string().optional()
|
|
4621
|
+
})
|
|
4622
|
+
).optional()
|
|
4623
|
+
});
|
|
4624
|
+
var McpRetrieveResponseCamelCaseSchema = import_zod10.z.object({
|
|
4625
|
+
id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
|
|
4626
|
+
name: import_zod10.z.string().min(1, "Server name cannot be empty"),
|
|
4627
|
+
createdAt: import_zod10.z.string().optional(),
|
|
4628
|
+
updatedAt: import_zod10.z.string().optional(),
|
|
4629
|
+
status: import_zod10.z.string().optional(),
|
|
4630
|
+
toolkits: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
4631
|
+
tools: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
4632
|
+
managedAuthViaComposio: import_zod10.z.boolean().optional()
|
|
4633
|
+
});
|
|
4634
|
+
var McpRetrieveResponseSchema = import_zod10.z.object({
|
|
4635
|
+
id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
|
|
4636
|
+
name: import_zod10.z.string().min(1, "Server name cannot be empty"),
|
|
4637
|
+
created_at: import_zod10.z.string().optional(),
|
|
4638
|
+
updated_at: import_zod10.z.string().optional(),
|
|
4639
|
+
status: import_zod10.z.string().optional(),
|
|
4640
|
+
toolkits: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
4641
|
+
tools: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
4642
|
+
managed_auth_via_composio: import_zod10.z.boolean().optional()
|
|
4643
|
+
});
|
|
4644
|
+
var McpDeleteResponseCamelCaseSchema = import_zod10.z.object({
|
|
4645
|
+
id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
|
|
4646
|
+
deleted: import_zod10.z.boolean().optional(),
|
|
4647
|
+
message: import_zod10.z.string().optional()
|
|
4648
|
+
});
|
|
4649
|
+
var McpDeleteResponseSchema = import_zod10.z.object({
|
|
4650
|
+
id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
|
|
4651
|
+
deleted: import_zod10.z.boolean().optional(),
|
|
4652
|
+
message: import_zod10.z.string().optional()
|
|
4653
|
+
});
|
|
4654
|
+
var McpUpdateResponseCamelCaseSchema = import_zod10.z.object({
|
|
4655
|
+
id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
|
|
4656
|
+
name: import_zod10.z.string().min(1, "Server name cannot be empty"),
|
|
4657
|
+
createdAt: import_zod10.z.string().optional(),
|
|
4658
|
+
updatedAt: import_zod10.z.string().optional(),
|
|
4659
|
+
status: import_zod10.z.string().optional(),
|
|
4660
|
+
toolkits: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
4661
|
+
tools: import_zod10.z.array(import_zod10.z.string()).optional()
|
|
4662
|
+
});
|
|
4663
|
+
var McpUpdateResponseSchema = import_zod10.z.object({
|
|
4664
|
+
id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
|
|
4665
|
+
name: import_zod10.z.string().min(1, "Server name cannot be empty"),
|
|
4666
|
+
created_at: import_zod10.z.string().optional(),
|
|
4667
|
+
updated_at: import_zod10.z.string().optional(),
|
|
4668
|
+
status: import_zod10.z.string().optional(),
|
|
4669
|
+
toolkits: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
4670
|
+
tools: import_zod10.z.array(import_zod10.z.string()).optional()
|
|
4671
|
+
});
|
|
4672
|
+
|
|
4673
|
+
// src/utils/transformers/mcp.ts
|
|
4674
|
+
function transformMcpCreateResponse(response) {
|
|
4675
|
+
const result = CustomCreateResponseCamelCaseSchema.safeParse({
|
|
4676
|
+
id: response.id,
|
|
4677
|
+
name: response.name,
|
|
4678
|
+
createdAt: response.created_at,
|
|
4679
|
+
updatedAt: response.updated_at,
|
|
4680
|
+
status: response.status
|
|
4681
|
+
});
|
|
4682
|
+
if (!result.success) {
|
|
4683
|
+
throw new ValidationError("Failed to parse MCP create response", {
|
|
4684
|
+
cause: result.error
|
|
4685
|
+
});
|
|
4686
|
+
}
|
|
4687
|
+
return result.data;
|
|
4688
|
+
}
|
|
4689
|
+
function transformMcpListResponse(response) {
|
|
4690
|
+
const transformedItems = response.items?.map((item) => ({
|
|
4691
|
+
id: item.id,
|
|
4692
|
+
name: item.name,
|
|
4693
|
+
createdAt: item.created_at,
|
|
4694
|
+
updatedAt: item.updated_at,
|
|
4695
|
+
status: item.status
|
|
4696
|
+
}));
|
|
4697
|
+
const result = McpListResponseCamelCaseSchema.safeParse({
|
|
4698
|
+
items: transformedItems
|
|
4699
|
+
});
|
|
4700
|
+
if (!result.success) {
|
|
4701
|
+
throw new ValidationError("Failed to parse MCP list response", {
|
|
4702
|
+
cause: result.error
|
|
4703
|
+
});
|
|
4704
|
+
}
|
|
4705
|
+
return result.data;
|
|
4706
|
+
}
|
|
4707
|
+
function transformMcpRetrieveResponse(response) {
|
|
4708
|
+
const result = McpRetrieveResponseCamelCaseSchema.safeParse({
|
|
4709
|
+
id: response.id,
|
|
4710
|
+
name: response.name,
|
|
4711
|
+
createdAt: response.created_at,
|
|
4712
|
+
updatedAt: response.updated_at,
|
|
4713
|
+
status: response.status,
|
|
4714
|
+
toolkits: response.toolkits,
|
|
4715
|
+
tools: response.tools,
|
|
4716
|
+
managedAuthViaComposio: response.managed_auth_via_composio
|
|
4717
|
+
});
|
|
4718
|
+
if (!result.success) {
|
|
4719
|
+
throw new ValidationError("Failed to parse MCP retrieve response", {
|
|
4720
|
+
cause: result.error
|
|
4721
|
+
});
|
|
4722
|
+
}
|
|
4723
|
+
return result.data;
|
|
4724
|
+
}
|
|
4725
|
+
function transformMcpDeleteResponse(response) {
|
|
4726
|
+
const result = McpDeleteResponseCamelCaseSchema.safeParse({
|
|
4727
|
+
id: response.id,
|
|
4728
|
+
deleted: response.deleted,
|
|
4729
|
+
message: response.message
|
|
4730
|
+
});
|
|
4731
|
+
if (!result.success) {
|
|
4732
|
+
throw new ValidationError("Failed to parse MCP delete response", {
|
|
4733
|
+
cause: result.error
|
|
4734
|
+
});
|
|
4735
|
+
}
|
|
4736
|
+
return result.data;
|
|
4737
|
+
}
|
|
4738
|
+
function transformMcpUpdateResponse(response) {
|
|
4739
|
+
const result = McpUpdateResponseCamelCaseSchema.safeParse({
|
|
4740
|
+
id: response.id,
|
|
4741
|
+
name: response.name,
|
|
4742
|
+
createdAt: response.created_at,
|
|
4743
|
+
updatedAt: response.updated_at,
|
|
4744
|
+
status: response.status,
|
|
4745
|
+
toolkits: response.toolkits,
|
|
4746
|
+
tools: response.tools
|
|
4747
|
+
});
|
|
4748
|
+
if (!result.success) {
|
|
4749
|
+
throw new ValidationError("Failed to parse MCP update response", {
|
|
4750
|
+
cause: result.error
|
|
4751
|
+
});
|
|
4752
|
+
}
|
|
4753
|
+
return result.data;
|
|
4754
|
+
}
|
|
4755
|
+
function transformMcpGenerateUrlResponse(response) {
|
|
4756
|
+
const result = GenerateURLResponseCamelCaseSchema.safeParse({
|
|
4757
|
+
connectedAccountUrls: response.connected_account_urls,
|
|
4758
|
+
userIdsUrl: response.user_ids_url,
|
|
4759
|
+
mcpUrl: response.mcp_url
|
|
4760
|
+
});
|
|
4761
|
+
if (!result.success) {
|
|
4762
|
+
throw new ValidationError("Failed to parse MCP generate URL response", {
|
|
4763
|
+
cause: result.error
|
|
4764
|
+
});
|
|
4765
|
+
}
|
|
4766
|
+
return result.data;
|
|
4767
|
+
}
|
|
4768
|
+
|
|
4769
|
+
// src/models/MCP.ts
|
|
4770
|
+
var MCP = class {
|
|
4771
|
+
client;
|
|
4772
|
+
provider;
|
|
4773
|
+
constructor(client, provider) {
|
|
4774
|
+
this.client = client;
|
|
4775
|
+
this.provider = provider;
|
|
4776
|
+
telemetry.instrument(this);
|
|
4777
|
+
}
|
|
4778
|
+
/**
|
|
4779
|
+
* Validates toolkit configurations using Zod schema
|
|
4780
|
+
* @private
|
|
4781
|
+
* @param {MCPToolkitConfig[]} toolkitConfigs - Array of toolkit configurations to validate
|
|
4782
|
+
* @param {MCPAuthOptions} [authOptions] - Authentication options to validate
|
|
4783
|
+
* @throws {ValidationError} If validation fails
|
|
4784
|
+
*/
|
|
4785
|
+
validateInputs(toolkitConfigs, authOptions) {
|
|
4786
|
+
const toolkitConfigsResult = MCPToolkitConfigsArraySchema.safeParse(toolkitConfigs);
|
|
4787
|
+
if (toolkitConfigsResult.error) {
|
|
4788
|
+
throw new ValidationError("Failed to parse toolkit configurations", {
|
|
4789
|
+
cause: toolkitConfigsResult.error
|
|
4790
|
+
});
|
|
4791
|
+
}
|
|
4792
|
+
if (authOptions !== void 0) {
|
|
4793
|
+
const authOptionsResult = MCPAuthOptionsSchema.safeParse(authOptions);
|
|
4794
|
+
if (authOptionsResult.error) {
|
|
4795
|
+
throw new ValidationError("Failed to parse auth options", {
|
|
4796
|
+
cause: authOptionsResult.error
|
|
4797
|
+
});
|
|
4798
|
+
}
|
|
4799
|
+
}
|
|
4800
|
+
}
|
|
4801
|
+
/**
|
|
4802
|
+
* Create a new MCP server
|
|
4803
|
+
* @param {string} name - Unique name for the MCP server
|
|
4804
|
+
* @param {MCPToolkitConfig[]} toolkitConfigs - Array of toolkit configurations
|
|
4805
|
+
* @param {MCPAuthOptions} [authOptions] - Authentication configuration options
|
|
4806
|
+
* @returns {Promise<McpServerCreateResponse<T>>} Created server details with instance getter
|
|
4807
|
+
*
|
|
4808
|
+
* @example
|
|
4809
|
+
* ```typescript
|
|
4810
|
+
* const server = await composio.mcp.create(
|
|
4811
|
+
* "personal-mcp-server",
|
|
4812
|
+
* [
|
|
4813
|
+
* {
|
|
4814
|
+
* toolkit: "GMAIL",
|
|
4815
|
+
* authConfigId: "ac_sdhkjfhjksdk",
|
|
4816
|
+
* allowedTools: ["GMAIL_FETCH_EMAILS"],
|
|
4817
|
+
* },
|
|
4818
|
+
* ],
|
|
4819
|
+
* { useComposioManagedAuth: true },
|
|
4820
|
+
* );
|
|
4821
|
+
*
|
|
4822
|
+
* // Option 1: Use convenience method on response
|
|
4823
|
+
* const urls = await server.getServer({
|
|
4824
|
+
* connectedAccountIds: { gmail: "account_id" }
|
|
4825
|
+
* });
|
|
4826
|
+
*
|
|
4827
|
+
* // Option 2: Use standalone method later
|
|
4828
|
+
* const urlsLater = await composio.mcp.getServer(server.id, {
|
|
4829
|
+
* connectedAccountIds: { gmail: "account_id" }
|
|
4830
|
+
* });
|
|
4831
|
+
* ```
|
|
4832
|
+
*/
|
|
4833
|
+
async create(name, toolkitConfigs, authOptions) {
|
|
4834
|
+
this.validateInputs(toolkitConfigs, authOptions);
|
|
4835
|
+
const toolkits = toolkitConfigs.map((config) => config.toolkit);
|
|
4836
|
+
let mcpServerCreatedResponse;
|
|
4837
|
+
try {
|
|
4838
|
+
mcpServerCreatedResponse = await this.client.mcp.custom.create({
|
|
4839
|
+
name,
|
|
4840
|
+
toolkits,
|
|
4841
|
+
custom_tools: toolkitConfigs.flatMap((config) => config.allowedTools),
|
|
4842
|
+
managed_auth_via_composio: authOptions?.useComposioManagedAuth || false,
|
|
4843
|
+
auth_config_ids: toolkitConfigs.map((config) => config.authConfigId)
|
|
4844
|
+
});
|
|
4845
|
+
} catch (error) {
|
|
4846
|
+
throw new ValidationError("Failed to create MCP server", {
|
|
4847
|
+
cause: error
|
|
4848
|
+
});
|
|
4849
|
+
}
|
|
4850
|
+
const serverResponseResult = CustomCreateResponseSchema.safeParse(mcpServerCreatedResponse);
|
|
4851
|
+
if (serverResponseResult.error) {
|
|
4852
|
+
throw new ValidationError("Failed to parse MCP server creation response", {
|
|
4853
|
+
cause: serverResponseResult.error
|
|
4854
|
+
});
|
|
4855
|
+
}
|
|
4856
|
+
const camelCaseResponse = transformMcpCreateResponse(mcpServerCreatedResponse);
|
|
4857
|
+
return {
|
|
4858
|
+
...camelCaseResponse,
|
|
4859
|
+
toolkits,
|
|
4860
|
+
getServer: async (params) => {
|
|
4861
|
+
return this.getServer(camelCaseResponse.id, params, authOptions);
|
|
4862
|
+
}
|
|
4863
|
+
};
|
|
4864
|
+
}
|
|
4865
|
+
/**
|
|
4866
|
+
* Get server URLs for an existing MCP server
|
|
4867
|
+
* @param {string} id - Server UUID
|
|
4868
|
+
* @param {MCPGetServerParams} params - Parameters for getting server URLs
|
|
4869
|
+
* @param {MCPAuthOptions} [authOptions] - Authentication options (optional, will use server's default if not provided)
|
|
4870
|
+
* @returns {Promise<T>} Transformed server URLs in provider-specific format
|
|
4871
|
+
*
|
|
4872
|
+
* @example
|
|
4873
|
+
* ```typescript
|
|
4874
|
+
* // Get URLs for an existing server
|
|
4875
|
+
* const urls = await composio.mcp.getServer("server-id", {
|
|
4876
|
+
* connectedAccountIds: {
|
|
4877
|
+
* gmail: "connected_account_id"
|
|
4878
|
+
* }
|
|
4879
|
+
* });
|
|
4880
|
+
* ```
|
|
4881
|
+
*/
|
|
4882
|
+
async getServer(id, params, authOptions) {
|
|
4883
|
+
const serverDetails = await this.get(id);
|
|
4884
|
+
const paramsResult = MCPGetServerParamsSchema.safeParse(params);
|
|
4885
|
+
if (paramsResult.error) {
|
|
4886
|
+
throw new ValidationError("Failed to parse get server parameters", {
|
|
4887
|
+
cause: paramsResult.error
|
|
4888
|
+
});
|
|
4889
|
+
}
|
|
4890
|
+
const toolkits = serverDetails.toolkits || [];
|
|
4891
|
+
if (paramsResult.data.connectedAccountIds) {
|
|
4892
|
+
const providedToolkits = Object.keys(paramsResult.data.connectedAccountIds);
|
|
4893
|
+
const invalidToolkits = providedToolkits.filter((toolkit) => !toolkits.includes(toolkit));
|
|
4894
|
+
if (invalidToolkits.length > 0) {
|
|
4895
|
+
throw new ValidationError(
|
|
4896
|
+
`Invalid toolkits provided: ${invalidToolkits.join(", ")}. Available toolkits are: ${toolkits.join(", ")}`,
|
|
4897
|
+
{}
|
|
4898
|
+
);
|
|
4899
|
+
}
|
|
4900
|
+
}
|
|
4901
|
+
let data;
|
|
4902
|
+
try {
|
|
4903
|
+
data = await this.client.mcp.generate.url({
|
|
4904
|
+
user_ids: paramsResult.data.userId ? [paramsResult.data.userId] : [],
|
|
4905
|
+
connected_account_ids: paramsResult.data.connectedAccountIds ? Object.values(paramsResult.data.connectedAccountIds) : [],
|
|
4906
|
+
mcp_server_id: id,
|
|
4907
|
+
managed_auth_by_composio: authOptions?.useComposioManagedAuth ?? serverDetails.managedAuthViaComposio ?? false
|
|
4908
|
+
});
|
|
4909
|
+
} catch (error) {
|
|
4910
|
+
throw new ValidationError("Failed to generate MCP server URL", {
|
|
4911
|
+
cause: error
|
|
4912
|
+
});
|
|
4913
|
+
}
|
|
4914
|
+
const urlResponseResult = GenerateURLResponseSchema.safeParse(data);
|
|
4915
|
+
if (urlResponseResult.error) {
|
|
4916
|
+
throw new ValidationError("Failed to parse MCP URL generation response", {
|
|
4917
|
+
cause: urlResponseResult.error
|
|
4918
|
+
});
|
|
4919
|
+
}
|
|
4920
|
+
const camelCaseData = transformMcpGenerateUrlResponse(data);
|
|
4921
|
+
return this.wrapMcpServerResponse(
|
|
4922
|
+
camelCaseData,
|
|
4923
|
+
serverDetails.name,
|
|
4924
|
+
paramsResult.data.connectedAccountIds ? Object.values(paramsResult.data.connectedAccountIds) : void 0,
|
|
4925
|
+
paramsResult.data.userId ? [paramsResult.data.userId] : void 0,
|
|
4926
|
+
paramsResult.data.connectedAccountIds ? Object.keys(paramsResult.data.connectedAccountIds) : void 0
|
|
4927
|
+
);
|
|
4928
|
+
}
|
|
4929
|
+
/**
|
|
4930
|
+
* List MCP server configurations with filtering options
|
|
4931
|
+
* @param {Object} options - Filtering and pagination options
|
|
4932
|
+
* @param {number} [options.page] - Page number for pagination
|
|
4933
|
+
* @param {number} [options.limit] - Number of items per page
|
|
4934
|
+
* @param {string[]} [options.toolkits] - Filter servers by toolkit names
|
|
4935
|
+
* @param {string[]} [options.authConfigs] - Filter servers by auth config IDs
|
|
4936
|
+
* @param {string} [options.name] - Filter servers by name
|
|
4937
|
+
* @param {string} [options.user] - Filter servers by user ID
|
|
4938
|
+
* @returns {Promise<McpListResponse>} List of MCP servers matching the filters
|
|
4939
|
+
*
|
|
4940
|
+
* @example
|
|
4941
|
+
* ```typescript
|
|
4942
|
+
* // List all servers with pagination
|
|
4943
|
+
* const servers = await composio.mcp.list({
|
|
4944
|
+
* page: 1,
|
|
4945
|
+
* limit: 10
|
|
4946
|
+
* });
|
|
4947
|
+
*
|
|
4948
|
+
* // List Gmail and Supabase servers
|
|
4949
|
+
* const filteredServers = await composio.mcp.list({
|
|
4950
|
+
* toolkits: ['GMAIL', 'SUPABASE'],
|
|
4951
|
+
* authConfigIds: ['auth_123', 'auth_456']
|
|
4952
|
+
* });
|
|
4953
|
+
* ```
|
|
4954
|
+
*/
|
|
4955
|
+
async list(options) {
|
|
4956
|
+
let listResponse;
|
|
4957
|
+
try {
|
|
4958
|
+
listResponse = await this.client.mcp.list({
|
|
4959
|
+
page_no: options.page || 1,
|
|
4960
|
+
limit: options.limit || 10,
|
|
4961
|
+
toolkits: options?.toolkits?.join(",") || "",
|
|
4962
|
+
auth_config_ids: options?.authConfigs?.join(",") || "",
|
|
4963
|
+
name: options?.name
|
|
4964
|
+
});
|
|
4965
|
+
} catch (error) {
|
|
4966
|
+
throw new ValidationError("Failed to list MCP servers", {
|
|
4967
|
+
cause: error
|
|
4968
|
+
});
|
|
4969
|
+
}
|
|
4970
|
+
const listResponseResult = McpListResponseSchema.safeParse(listResponse);
|
|
4971
|
+
if (listResponseResult.error) {
|
|
4972
|
+
throw new ValidationError("Failed to parse MCP server list response", {
|
|
4973
|
+
cause: listResponseResult.error
|
|
4974
|
+
});
|
|
4975
|
+
}
|
|
4976
|
+
return transformMcpListResponse(listResponse);
|
|
4977
|
+
}
|
|
4978
|
+
/**
|
|
4979
|
+
* Get details of a specific MCP server
|
|
4980
|
+
* @param {string} id - Server UUID
|
|
4981
|
+
* @returns {Promise<ReturnType<typeof transformMcpRetrieveResponse>>} Server details
|
|
4982
|
+
*
|
|
4983
|
+
* @example
|
|
4984
|
+
* ```typescript
|
|
4985
|
+
* const serverDetails = await composio.mcp.get('server-uuid');
|
|
4986
|
+
* ```
|
|
4987
|
+
*/
|
|
4988
|
+
async get(id) {
|
|
4989
|
+
let retrieveResponse;
|
|
4990
|
+
try {
|
|
4991
|
+
retrieveResponse = await this.client.mcp.retrieve(id);
|
|
4992
|
+
} catch (error) {
|
|
4993
|
+
throw new ValidationError("Failed to retrieve MCP server", {
|
|
4994
|
+
cause: error
|
|
4995
|
+
});
|
|
4996
|
+
}
|
|
4997
|
+
const retrieveResponseResult = McpRetrieveResponseSchema.safeParse(retrieveResponse);
|
|
4998
|
+
if (retrieveResponseResult.error) {
|
|
4999
|
+
throw new ValidationError("Failed to parse MCP server retrieve response", {
|
|
5000
|
+
cause: retrieveResponseResult.error
|
|
5001
|
+
});
|
|
5002
|
+
}
|
|
5003
|
+
return transformMcpRetrieveResponse(retrieveResponse);
|
|
5004
|
+
}
|
|
5005
|
+
/**
|
|
5006
|
+
* Delete an MCP server
|
|
5007
|
+
* @param {string} id - Server UUID
|
|
5008
|
+
* @returns {Promise<ReturnType<typeof transformMcpDeleteResponse>>} Deletion response
|
|
5009
|
+
*
|
|
5010
|
+
* @example
|
|
5011
|
+
* ```typescript
|
|
5012
|
+
* const result = await composio.mcp.delete('server-uuid');
|
|
5013
|
+
* ```
|
|
5014
|
+
*/
|
|
5015
|
+
async delete(id) {
|
|
5016
|
+
let deleteResponse;
|
|
5017
|
+
try {
|
|
5018
|
+
deleteResponse = await this.client.mcp.delete(id);
|
|
5019
|
+
} catch (error) {
|
|
5020
|
+
throw new ValidationError("Failed to delete MCP server", {
|
|
5021
|
+
cause: error
|
|
5022
|
+
});
|
|
5023
|
+
}
|
|
5024
|
+
const deleteResponseResult = McpDeleteResponseSchema.safeParse(deleteResponse);
|
|
5025
|
+
if (deleteResponseResult.error) {
|
|
5026
|
+
throw new ValidationError("Failed to parse MCP server delete response", {
|
|
5027
|
+
cause: deleteResponseResult.error
|
|
5028
|
+
});
|
|
5029
|
+
}
|
|
5030
|
+
return transformMcpDeleteResponse(deleteResponse);
|
|
5031
|
+
}
|
|
5032
|
+
/**
|
|
5033
|
+
* Update an MCP server configuration
|
|
5034
|
+
* @param {string} id - Server UUID
|
|
5035
|
+
* @param {string} name - New unique name for the server
|
|
5036
|
+
* @param {MCPToolkitConfig[]} toolkitConfigs - Array of toolkit configurations
|
|
5037
|
+
* @param {MCPAuthOptions} [authOptions] - Updated authentication options
|
|
5038
|
+
* @returns {Promise<ReturnType<typeof transformMcpUpdateResponse>>} Updated server details
|
|
5039
|
+
*
|
|
5040
|
+
* @example
|
|
5041
|
+
* ```typescript
|
|
5042
|
+
* const updatedServer = await composio.mcp.update(
|
|
5043
|
+
* "server-uuid",
|
|
5044
|
+
* "my-updated-server",
|
|
5045
|
+
* [
|
|
5046
|
+
* {
|
|
5047
|
+
* toolkit: "GMAIL",
|
|
5048
|
+
* authConfigId: "ac_sdhkjfhjksdk",
|
|
5049
|
+
* allowedTools: ["GMAIL_FETCH_EMAILS"],
|
|
5050
|
+
* },
|
|
5051
|
+
* ],
|
|
5052
|
+
* {
|
|
5053
|
+
* useComposioManagedAuth: true,
|
|
5054
|
+
* }
|
|
5055
|
+
* );
|
|
5056
|
+
* ```
|
|
5057
|
+
*/
|
|
5058
|
+
async update(id, name, toolkitConfigs, authOptions) {
|
|
5059
|
+
this.validateInputs(toolkitConfigs, authOptions);
|
|
5060
|
+
const toolkits = toolkitConfigs.map((config) => config.toolkit);
|
|
5061
|
+
let updateResponse;
|
|
5062
|
+
try {
|
|
5063
|
+
updateResponse = await this.client.mcp.update(id, {
|
|
5064
|
+
name,
|
|
5065
|
+
toolkits,
|
|
5066
|
+
allowed_tools: toolkitConfigs.flatMap((config) => config.allowedTools),
|
|
5067
|
+
managed_auth_via_composio: authOptions?.useComposioManagedAuth || false
|
|
5068
|
+
});
|
|
5069
|
+
} catch (error) {
|
|
5070
|
+
throw new ValidationError("Failed to update MCP server", {
|
|
5071
|
+
cause: error
|
|
5072
|
+
});
|
|
5073
|
+
}
|
|
5074
|
+
const updateResponseResult = McpUpdateResponseSchema.safeParse(updateResponse);
|
|
5075
|
+
if (updateResponseResult.error) {
|
|
5076
|
+
throw new ValidationError("Failed to parse MCP server update response", {
|
|
5077
|
+
cause: updateResponseResult.error
|
|
5078
|
+
});
|
|
5079
|
+
}
|
|
5080
|
+
return transformMcpUpdateResponse(updateResponse);
|
|
5081
|
+
}
|
|
5082
|
+
/**
|
|
5083
|
+
* Generate URL for an MCP server
|
|
5084
|
+
* @param {GenerateURLParams} params - Parameters for URL generation
|
|
5085
|
+
* @returns {Promise<ReturnType<typeof transformMcpGenerateUrlResponse>>} Generated URL response
|
|
5086
|
+
*
|
|
5087
|
+
* @example
|
|
5088
|
+
* ```typescript
|
|
5089
|
+
* const urlResponse = await composio.mcp.generateUrl({
|
|
5090
|
+
* user_ids: ['user123'],
|
|
5091
|
+
* connected_account_ids: ['account456'],
|
|
5092
|
+
* mcp_server_id: 'server-uuid',
|
|
5093
|
+
* managed_auth_by_composio: true
|
|
5094
|
+
* });
|
|
5095
|
+
* ```
|
|
5096
|
+
*/
|
|
5097
|
+
async generateUrl(params) {
|
|
5098
|
+
const paramsResult = GenerateURLParamsSnakeCaseSchema.safeParse(params);
|
|
5099
|
+
if (paramsResult.error) {
|
|
5100
|
+
throw new ValidationError("Failed to parse generateUrl parameters", {
|
|
5101
|
+
cause: paramsResult.error
|
|
5102
|
+
});
|
|
5103
|
+
}
|
|
5104
|
+
let urlResponse;
|
|
5105
|
+
try {
|
|
5106
|
+
urlResponse = await this.client.mcp.generate.url(params);
|
|
5107
|
+
} catch (error) {
|
|
5108
|
+
throw new ValidationError("Failed to generate MCP URL", {
|
|
5109
|
+
cause: error
|
|
5110
|
+
});
|
|
5111
|
+
}
|
|
5112
|
+
const responseResult = GenerateURLResponseSchema.safeParse(urlResponse);
|
|
5113
|
+
if (responseResult.error) {
|
|
5114
|
+
throw new ValidationError("Failed to parse MCP URL generation response", {
|
|
5115
|
+
cause: responseResult.error
|
|
5116
|
+
});
|
|
5117
|
+
}
|
|
5118
|
+
return transformMcpGenerateUrlResponse(urlResponse);
|
|
5119
|
+
}
|
|
5120
|
+
/**
|
|
5121
|
+
* Transform MCP URL response into the appropriate format.
|
|
5122
|
+
* If the provider has a custom transform method, use it.
|
|
5123
|
+
* Otherwise, use the default transformation.
|
|
5124
|
+
*
|
|
5125
|
+
* @param data - The MCP URL response data (in camelCase)
|
|
5126
|
+
* @param serverName - Name of the MCP server
|
|
5127
|
+
* @param connectedAccountIds - Optional array of connected account IDs
|
|
5128
|
+
* @param userIds - Optional array of user IDs
|
|
5129
|
+
* @param toolkits - Optional array of toolkit names
|
|
5130
|
+
* @returns Transformed response in appropriate format
|
|
5131
|
+
*/
|
|
5132
|
+
wrapMcpServerResponse(data, serverName, connectedAccountIds, userIds, toolkits) {
|
|
5133
|
+
if (this.provider && typeof this.provider.wrapMcpServerResponse === "function") {
|
|
5134
|
+
const snakeCaseData = {
|
|
5135
|
+
mcp_url: data.mcpUrl,
|
|
5136
|
+
...data.connectedAccountUrls && { connected_account_urls: data.connectedAccountUrls },
|
|
5137
|
+
...data.userIdsUrl && { user_ids_url: data.userIdsUrl }
|
|
5138
|
+
};
|
|
5139
|
+
const transformed = this.provider.wrapMcpServerResponse(
|
|
5140
|
+
snakeCaseData,
|
|
5141
|
+
serverName,
|
|
5142
|
+
connectedAccountIds,
|
|
5143
|
+
userIds,
|
|
5144
|
+
toolkits
|
|
5145
|
+
);
|
|
5146
|
+
return transformed;
|
|
5147
|
+
}
|
|
5148
|
+
if (connectedAccountIds?.length && data.connectedAccountUrls) {
|
|
5149
|
+
return data.connectedAccountUrls.map((url, index) => ({
|
|
5150
|
+
url: new URL(url),
|
|
5151
|
+
name: `${serverName}-${connectedAccountIds[index]}`,
|
|
5152
|
+
toolkit: toolkits?.[index]
|
|
5153
|
+
}));
|
|
5154
|
+
} else if (userIds?.length && data.userIdsUrl) {
|
|
5155
|
+
return data.userIdsUrl.map((url, index) => ({
|
|
5156
|
+
url: new URL(url),
|
|
5157
|
+
name: `${serverName}-${userIds[index]}`,
|
|
5158
|
+
toolkit: toolkits?.[index]
|
|
5159
|
+
}));
|
|
5160
|
+
}
|
|
5161
|
+
return {
|
|
5162
|
+
url: new URL(data.mcpUrl),
|
|
5163
|
+
name: serverName
|
|
5164
|
+
};
|
|
5165
|
+
}
|
|
5166
|
+
};
|
|
5167
|
+
|
|
4488
5168
|
// src/utils/constants.ts
|
|
5169
|
+
var constants_exports = {};
|
|
5170
|
+
__export(constants_exports, {
|
|
5171
|
+
COMPOSIO_DIR: () => COMPOSIO_DIR,
|
|
5172
|
+
DEFAULT_BASE_URL: () => DEFAULT_BASE_URL,
|
|
5173
|
+
IS_DEVELOPMENT_OR_CI: () => IS_DEVELOPMENT_OR_CI,
|
|
5174
|
+
TELEMETRY_URL: () => TELEMETRY_URL2,
|
|
5175
|
+
TEMP_FILES_DIRECTORY_NAME: () => TEMP_FILES_DIRECTORY_NAME,
|
|
5176
|
+
USER_DATA_FILE_NAME: () => USER_DATA_FILE_NAME
|
|
5177
|
+
});
|
|
4489
5178
|
var COMPOSIO_DIR = ".composio";
|
|
4490
5179
|
var USER_DATA_FILE_NAME = "user_data.json";
|
|
5180
|
+
var TEMP_FILES_DIRECTORY_NAME = "files";
|
|
4491
5181
|
var DEFAULT_BASE_URL = "https://backend.composio.dev";
|
|
5182
|
+
var TELEMETRY_URL2 = "https://app.composio.dev";
|
|
4492
5183
|
var IS_DEVELOPMENT_OR_CI = process.env.DEVELOPMENT || process.env.CI || false;
|
|
4493
5184
|
|
|
4494
5185
|
// src/utils/sdk.ts
|
|
@@ -4597,17 +5288,17 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4597
5288
|
name = "openai";
|
|
4598
5289
|
/**
|
|
4599
5290
|
* Creates a new instance of the OpenAIProvider.
|
|
4600
|
-
*
|
|
5291
|
+
*
|
|
4601
5292
|
* This is the default provider for the Composio SDK and is automatically
|
|
4602
5293
|
* available without additional installation.
|
|
4603
|
-
*
|
|
5294
|
+
*
|
|
4604
5295
|
* @example
|
|
4605
5296
|
* ```typescript
|
|
4606
5297
|
* // The OpenAIProvider is used by default when initializing Composio
|
|
4607
5298
|
* const composio = new Composio({
|
|
4608
5299
|
* apiKey: 'your-api-key'
|
|
4609
5300
|
* });
|
|
4610
|
-
*
|
|
5301
|
+
*
|
|
4611
5302
|
* // You can also explicitly specify it
|
|
4612
5303
|
* const composio = new Composio({
|
|
4613
5304
|
* apiKey: 'your-api-key',
|
|
@@ -4618,15 +5309,45 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4618
5309
|
constructor() {
|
|
4619
5310
|
super();
|
|
4620
5311
|
}
|
|
5312
|
+
/**
|
|
5313
|
+
* Transform MCP URL response into OpenAI-specific format.
|
|
5314
|
+
* OpenAI uses the standard format by default.
|
|
5315
|
+
*
|
|
5316
|
+
* @param data - The MCP URL response data
|
|
5317
|
+
* @param serverName - Name of the MCP server
|
|
5318
|
+
* @param connectedAccountIds - Optional array of connected account IDs
|
|
5319
|
+
* @param userIds - Optional array of user IDs
|
|
5320
|
+
* @param toolkits - Optional array of toolkit names
|
|
5321
|
+
* @returns Standard MCP server response format
|
|
5322
|
+
*/
|
|
5323
|
+
wrapMcpServerResponse(data, serverName, connectedAccountIds, userIds, toolkits) {
|
|
5324
|
+
if (connectedAccountIds?.length && data.connected_account_urls) {
|
|
5325
|
+
return data.connected_account_urls.map((url, index) => ({
|
|
5326
|
+
url: new URL(url),
|
|
5327
|
+
name: `${serverName}-${connectedAccountIds[index]}`,
|
|
5328
|
+
toolkit: toolkits?.[index]
|
|
5329
|
+
}));
|
|
5330
|
+
} else if (userIds?.length && data.user_ids_url) {
|
|
5331
|
+
return data.user_ids_url.map((url, index) => ({
|
|
5332
|
+
url: new URL(url),
|
|
5333
|
+
name: `${serverName}-${userIds[index]}`,
|
|
5334
|
+
toolkit: toolkits?.[index]
|
|
5335
|
+
}));
|
|
5336
|
+
}
|
|
5337
|
+
return {
|
|
5338
|
+
url: new URL(data.mcp_url),
|
|
5339
|
+
name: serverName
|
|
5340
|
+
};
|
|
5341
|
+
}
|
|
4621
5342
|
/**
|
|
4622
5343
|
* Wraps a Composio tool in the OpenAI function calling format.
|
|
4623
|
-
*
|
|
5344
|
+
*
|
|
4624
5345
|
* This method transforms a Composio tool definition into the format
|
|
4625
5346
|
* expected by OpenAI's function calling API.
|
|
4626
|
-
*
|
|
5347
|
+
*
|
|
4627
5348
|
* @param tool - The Composio tool to wrap
|
|
4628
5349
|
* @returns The wrapped tool in OpenAI format
|
|
4629
|
-
*
|
|
5350
|
+
*
|
|
4630
5351
|
* @example
|
|
4631
5352
|
* ```typescript
|
|
4632
5353
|
* // Wrap a single tool for use with OpenAI
|
|
@@ -4641,7 +5362,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4641
5362
|
* required: ['query']
|
|
4642
5363
|
* }
|
|
4643
5364
|
* };
|
|
4644
|
-
*
|
|
5365
|
+
*
|
|
4645
5366
|
* const openAITool = provider.wrapTool(composioTool);
|
|
4646
5367
|
* ```
|
|
4647
5368
|
*/
|
|
@@ -4658,13 +5379,13 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4658
5379
|
};
|
|
4659
5380
|
/**
|
|
4660
5381
|
* Wraps multiple Composio tools in the OpenAI function calling format.
|
|
4661
|
-
*
|
|
5382
|
+
*
|
|
4662
5383
|
* This method transforms a list of Composio tools into the format
|
|
4663
5384
|
* expected by OpenAI's function calling API.
|
|
4664
|
-
*
|
|
5385
|
+
*
|
|
4665
5386
|
* @param tools - Array of Composio tools to wrap
|
|
4666
5387
|
* @returns Array of wrapped tools in OpenAI format
|
|
4667
|
-
*
|
|
5388
|
+
*
|
|
4668
5389
|
* @example
|
|
4669
5390
|
* ```typescript
|
|
4670
5391
|
* // Wrap multiple tools for use with OpenAI
|
|
@@ -4690,7 +5411,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4690
5411
|
* }
|
|
4691
5412
|
* }
|
|
4692
5413
|
* ];
|
|
4693
|
-
*
|
|
5414
|
+
*
|
|
4694
5415
|
* const openAITools = provider.wrapTools(composioTools);
|
|
4695
5416
|
* ```
|
|
4696
5417
|
*/
|
|
@@ -4699,16 +5420,16 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4699
5420
|
};
|
|
4700
5421
|
/**
|
|
4701
5422
|
* Executes a tool call from OpenAI's chat completion.
|
|
4702
|
-
*
|
|
5423
|
+
*
|
|
4703
5424
|
* This method processes a tool call from OpenAI's chat completion API,
|
|
4704
5425
|
* executes the corresponding Composio tool, and returns the result.
|
|
4705
|
-
*
|
|
5426
|
+
*
|
|
4706
5427
|
* @param {string} userId - The user ID for authentication and tracking
|
|
4707
5428
|
* @param {OpenAI.ChatCompletionMessageToolCall} tool - The tool call from OpenAI
|
|
4708
5429
|
* @param {ExecuteToolFnOptions} [options] - Optional execution options
|
|
4709
5430
|
* @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
|
|
4710
5431
|
* @returns {Promise<string>} The result of the tool call as a JSON string
|
|
4711
|
-
*
|
|
5432
|
+
*
|
|
4712
5433
|
* @example
|
|
4713
5434
|
* ```typescript
|
|
4714
5435
|
* // Execute a tool call from OpenAI
|
|
@@ -4720,7 +5441,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4720
5441
|
* arguments: '{"query":"composio documentation"}'
|
|
4721
5442
|
* }
|
|
4722
5443
|
* };
|
|
4723
|
-
*
|
|
5444
|
+
*
|
|
4724
5445
|
* const result = await provider.executeToolCall(
|
|
4725
5446
|
* 'user123',
|
|
4726
5447
|
* toolCall,
|
|
@@ -4750,7 +5471,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4750
5471
|
* @param {ExecuteToolFnOptions} [options] - Optional execution options
|
|
4751
5472
|
* @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
|
|
4752
5473
|
* @returns {Promise<string[]>} Array of tool execution results as JSON strings
|
|
4753
|
-
*
|
|
5474
|
+
*
|
|
4754
5475
|
* @example
|
|
4755
5476
|
* ```typescript
|
|
4756
5477
|
* // Handle tool calls from a chat completion response
|
|
@@ -4772,7 +5493,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4772
5493
|
* }
|
|
4773
5494
|
* ]
|
|
4774
5495
|
* };
|
|
4775
|
-
*
|
|
5496
|
+
*
|
|
4776
5497
|
* const results = await provider.handleToolCalls(
|
|
4777
5498
|
* 'user123',
|
|
4778
5499
|
* chatCompletion,
|
|
@@ -4803,7 +5524,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4803
5524
|
* @param {ExecuteToolFnOptions} [options] - Optional execution options
|
|
4804
5525
|
* @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
|
|
4805
5526
|
* @returns {Promise<OpenAI.Beta.Threads.Runs.RunSubmitToolOutputsParams.ToolOutput[]>} Array of tool outputs for submission
|
|
4806
|
-
*
|
|
5527
|
+
*
|
|
4807
5528
|
* @example
|
|
4808
5529
|
* ```typescript
|
|
4809
5530
|
* // Handle tool calls from an OpenAI Assistant run
|
|
@@ -4824,13 +5545,13 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4824
5545
|
* }
|
|
4825
5546
|
* }
|
|
4826
5547
|
* };
|
|
4827
|
-
*
|
|
5548
|
+
*
|
|
4828
5549
|
* const toolOutputs = await provider.handleAssistantMessage(
|
|
4829
5550
|
* 'user123',
|
|
4830
5551
|
* run,
|
|
4831
5552
|
* { connectedAccountId: 'conn_xyz456' }
|
|
4832
5553
|
* );
|
|
4833
|
-
*
|
|
5554
|
+
*
|
|
4834
5555
|
* // Submit tool outputs back to OpenAI
|
|
4835
5556
|
* await openai.beta.threads.runs.submitToolOutputs(
|
|
4836
5557
|
* thread.id,
|
|
@@ -4873,7 +5594,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4873
5594
|
* @param {ExecuteToolFnOptions} [options] - Optional execution options
|
|
4874
5595
|
* @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
|
|
4875
5596
|
* @returns {AsyncGenerator<OpenAI.Beta.Assistants.AssistantStreamEvent, void, unknown>} Generator yielding stream events
|
|
4876
|
-
*
|
|
5597
|
+
*
|
|
4877
5598
|
* @example
|
|
4878
5599
|
* ```typescript
|
|
4879
5600
|
* // Process an OpenAI Assistant stream with tool calls
|
|
@@ -4882,7 +5603,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4882
5603
|
* assistant_id: 'asst_abc123',
|
|
4883
5604
|
* tools: provider.wrapTools(composioTools)
|
|
4884
5605
|
* });
|
|
4885
|
-
*
|
|
5606
|
+
*
|
|
4886
5607
|
* // Process the stream and handle tool calls
|
|
4887
5608
|
* const streamProcessor = provider.waitAndHandleAssistantStreamToolCalls(
|
|
4888
5609
|
* 'user123',
|
|
@@ -4891,7 +5612,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4891
5612
|
* thread,
|
|
4892
5613
|
* { connectedAccountId: 'conn_xyz456' }
|
|
4893
5614
|
* );
|
|
4894
|
-
*
|
|
5615
|
+
*
|
|
4895
5616
|
* // Consume the stream events
|
|
4896
5617
|
* for await (const event of streamProcessor) {
|
|
4897
5618
|
* if (event.event === 'thread.message.delta') {
|
|
@@ -4961,7 +5682,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4961
5682
|
* @param {ExecuteToolFnOptions} [options] - Optional execution options
|
|
4962
5683
|
* @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
|
|
4963
5684
|
* @returns {Promise<OpenAI.Beta.Threads.Run>} The final run object after completion
|
|
4964
|
-
*
|
|
5685
|
+
*
|
|
4965
5686
|
* @example
|
|
4966
5687
|
* ```typescript
|
|
4967
5688
|
* // Process an OpenAI Assistant run with tool calls
|
|
@@ -4970,12 +5691,12 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4970
5691
|
* role: 'user',
|
|
4971
5692
|
* content: 'Find information about Composio'
|
|
4972
5693
|
* });
|
|
4973
|
-
*
|
|
5694
|
+
*
|
|
4974
5695
|
* let run = await openai.beta.threads.runs.create(thread.id, {
|
|
4975
5696
|
* assistant_id: 'asst_abc123',
|
|
4976
5697
|
* tools: provider.wrapTools(composioTools)
|
|
4977
5698
|
* });
|
|
4978
|
-
*
|
|
5699
|
+
*
|
|
4979
5700
|
* // Wait for the run to complete, handling any tool calls
|
|
4980
5701
|
* run = await provider.waitAndHandleAssistantToolCalls(
|
|
4981
5702
|
* 'user123',
|
|
@@ -4984,7 +5705,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4984
5705
|
* thread,
|
|
4985
5706
|
* { connectedAccountId: 'conn_xyz456' }
|
|
4986
5707
|
* );
|
|
4987
|
-
*
|
|
5708
|
+
*
|
|
4988
5709
|
* // Get the final messages after run completion
|
|
4989
5710
|
* const messages = await openai.beta.threads.messages.list(thread.id);
|
|
4990
5711
|
* console.log(messages.data[0].content);
|
|
@@ -5007,7 +5728,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
5007
5728
|
};
|
|
5008
5729
|
|
|
5009
5730
|
// package.json
|
|
5010
|
-
var version = "0.1.
|
|
5731
|
+
var version = "0.1.26";
|
|
5011
5732
|
|
|
5012
5733
|
// src/composio.ts
|
|
5013
5734
|
var Composio = class _Composio {
|
|
@@ -5032,6 +5753,7 @@ var Composio = class _Composio {
|
|
|
5032
5753
|
authConfigs;
|
|
5033
5754
|
// connected accounts
|
|
5034
5755
|
connectedAccounts;
|
|
5756
|
+
mcp;
|
|
5035
5757
|
/**
|
|
5036
5758
|
* Creates a new instance of the Composio SDK.
|
|
5037
5759
|
*
|
|
@@ -5084,6 +5806,7 @@ var Composio = class _Composio {
|
|
|
5084
5806
|
};
|
|
5085
5807
|
this.provider = config?.provider ?? new OpenAIProvider();
|
|
5086
5808
|
this.tools = new Tools(this.client, this.provider);
|
|
5809
|
+
this.mcp = new MCP(this.client, this.provider);
|
|
5087
5810
|
this.toolkits = new Toolkits(this.client);
|
|
5088
5811
|
this.triggers = new Triggers(this.client);
|
|
5089
5812
|
this.authConfigs = new AuthConfigs(this.client);
|
|
@@ -5162,6 +5885,9 @@ var Composio = class _Composio {
|
|
|
5162
5885
|
// src/provider/ComposioProvider.ts
|
|
5163
5886
|
var ComposioProvider = class extends BaseNonAgenticProvider {
|
|
5164
5887
|
name = "ComposioProvider";
|
|
5888
|
+
constructor() {
|
|
5889
|
+
super();
|
|
5890
|
+
}
|
|
5165
5891
|
wrapTool = (tool) => {
|
|
5166
5892
|
return tool;
|
|
5167
5893
|
};
|
|
@@ -5414,8 +6140,34 @@ var AuthScheme = class {
|
|
|
5414
6140
|
CreateComposioManagedAuthConfigParamsSchema,
|
|
5415
6141
|
CreateCustomAuthConfigParamsSchema,
|
|
5416
6142
|
CustomAuthParamsSchema,
|
|
6143
|
+
CustomCreateResponseCamelCaseSchema,
|
|
6144
|
+
CustomCreateResponseSchema,
|
|
6145
|
+
GenerateURLParamsSchema,
|
|
6146
|
+
GenerateURLParamsSnakeCaseSchema,
|
|
6147
|
+
GenerateURLResponseCamelCaseSchema,
|
|
6148
|
+
GenerateURLResponseSchema,
|
|
5417
6149
|
IncomingTriggerPayloadSchema,
|
|
5418
6150
|
JsonSchemaToZodError,
|
|
6151
|
+
MCP,
|
|
6152
|
+
MCPAuthOptionsSchema,
|
|
6153
|
+
MCPGenerateURLParamsSchema,
|
|
6154
|
+
MCPGetServerParamsSchema,
|
|
6155
|
+
MCPMultiAppServerSchema,
|
|
6156
|
+
MCPServerCreateResponseSchema,
|
|
6157
|
+
MCPServerListResponseSchema,
|
|
6158
|
+
MCPServerSchema,
|
|
6159
|
+
MCPServerUpdateParamsSchema,
|
|
6160
|
+
MCPSingleAppServerSchema,
|
|
6161
|
+
MCPToolkitConfigSchema,
|
|
6162
|
+
MCPToolkitConfigsArraySchema,
|
|
6163
|
+
McpDeleteResponseCamelCaseSchema,
|
|
6164
|
+
McpDeleteResponseSchema,
|
|
6165
|
+
McpListResponseCamelCaseSchema,
|
|
6166
|
+
McpListResponseSchema,
|
|
6167
|
+
McpRetrieveResponseCamelCaseSchema,
|
|
6168
|
+
McpRetrieveResponseSchema,
|
|
6169
|
+
McpUpdateResponseCamelCaseSchema,
|
|
6170
|
+
McpUpdateResponseSchema,
|
|
5419
6171
|
Oauth1ActiveConnectionDataSchema,
|
|
5420
6172
|
Oauth1ConnectionDataSchema,
|
|
5421
6173
|
Oauth1ExpiredConnectionDataSchema,
|
|
@@ -5468,6 +6220,7 @@ var AuthScheme = class {
|
|
|
5468
6220
|
TriggerSubscribeParamSchema,
|
|
5469
6221
|
ValidationError,
|
|
5470
6222
|
ValidationErrorCodes,
|
|
6223
|
+
constants,
|
|
5471
6224
|
jsonSchemaToZodSchema,
|
|
5472
6225
|
logger,
|
|
5473
6226
|
removeNonRequiredProperties
|