* Update an existing MCP server configuration with new settings * @param {string} serverId - The unique identifier of the MCP server to update * @param {Object} config - Update configuration parameters * @param {string} [config.name] - New name for the MCP server * @param {Array} [config
(
serverId: string,
config: MCPUpdateParams,
requestOptions?: ComposioRequestOptions
)
| 367 | * @note When updating toolkits, the entire toolkit configuration is replaced, not merged. |
| 368 | */ |
| 369 | async update( |
| 370 | serverId: string, |
| 371 | config: MCPUpdateParams, |
| 372 | requestOptions?: ComposioRequestOptions |
| 373 | ): Promise<MCPItem> { |
| 374 | const { data: params, error } = MCPUpdateParamsSchema.safeParse(config); |
| 375 | if (error) { |
| 376 | throw new ValidationError('Failed to validate update params', { |
| 377 | cause: error, |
| 378 | }); |
| 379 | } |
| 380 | |
| 381 | const toolkits: string[] = []; |
| 382 | const auth_config_ids: string[] = []; |
| 383 | const custom_tools: string[] | undefined = params.allowedTools ?? undefined; |
| 384 | |
| 385 | // extract all the toolkits, authconfigs, and allowed tools to separate slugs |
| 386 | params.toolkits?.forEach(toolkit => { |
| 387 | if (typeof toolkit === 'string') { |
| 388 | toolkits.push(toolkit); |
| 389 | } else if (toolkit.toolkit) { |
| 390 | toolkits.push(toolkit.toolkit); |
| 391 | } else if (toolkit.authConfigId) { |
| 392 | auth_config_ids.push(toolkit.authConfigId); |
| 393 | } |
| 394 | }); |
| 395 | const updateBody = { |
| 396 | ...{ name: params.name ?? undefined }, |
| 397 | ...(params.toolkits |
| 398 | ? { |
| 399 | custom_tools: custom_tools, |
| 400 | toolkits: toolkits, |
| 401 | auth_config_ids: auth_config_ids, |
| 402 | } |
| 403 | : {}), |
| 404 | ...{ managed_auth_via_composio: params.manuallyManageConnections ?? undefined }, |
| 405 | }; |
| 406 | const response = await withCancellation( |
| 407 | () => this.client.mcp.update(serverId, updateBody, requestOptions), |
| 408 | requestOptions?.signal |
| 409 | ); |
| 410 | return transformMCPItemResponse(response); |
| 411 | } |
| 412 | |
| 413 | /** |
| 414 | * Get server URLs for an existing MCP server. |