@composio/core 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BaseProvider-BBnsv9kS.d.mts +29425 -0
- package/dist/{BaseProvider-CVbQxTNa.d.cts → BaseProvider-Brb3o86-.d.mts} +91 -44
- package/dist/CustomTool-D9qwyMrv.mjs +468 -0
- package/dist/{CustomTool-C-IUByoU.d.cts → CustomTool-Dmi6ti3I.d.mts} +2 -4
- package/dist/{CustomTool-CChQSp44.d.mts → CustomTool-DrJpOhY2.d.mts} +2 -4
- package/dist/{FileModifierErrors-C7z16Dfi.mjs → FileModifierErrors-3fSwIWoa.mjs} +35 -36
- package/dist/{Telemetry-DQax33Gh.mjs → Telemetry-DhGI_J4G.mjs} +15 -15
- package/dist/{composio-pcA13w87.d.cts → composio-DHIKRdeG.d.mts} +641 -380
- package/dist/{composio-BlASKqjQ.d.mts → composio-vMwhASRc.d.mts} +1390 -1129
- package/dist/{customTool.types-QtkAZQma.d.cts → customTool.types-CKH2R2ia.d.mts} +487 -189
- package/dist/{customTool.types-DLIORcYN.d.mts → customTool.types-DXin7Cfc.d.mts} +924 -626
- package/dist/docs/error-consistency.md +97 -0
- package/dist/docs/reference/sdk-reference/typescript/auth-configs.mdx +306 -0
- package/dist/docs/reference/sdk-reference/typescript/composio.mdx +205 -0
- package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +488 -0
- package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +94 -0
- package/dist/docs/reference/sdk-reference/typescript/index.mdx +67 -0
- package/dist/docs/reference/sdk-reference/typescript/mcp.mdx +304 -0
- package/dist/docs/reference/sdk-reference/typescript/meta.json +17 -0
- package/dist/docs/reference/sdk-reference/typescript/remote-file.mdx +107 -0
- package/dist/docs/reference/sdk-reference/typescript/session-files.mdx +163 -0
- package/dist/docs/reference/sdk-reference/typescript/session.mdx +229 -0
- package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +131 -0
- package/dist/docs/reference/sdk-reference/typescript/toolkits.mdx +169 -0
- package/dist/docs/reference/sdk-reference/typescript/tools.mdx +453 -0
- package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +434 -0
- package/dist/{CustomTool-D5s-aADw.mjs → errors-DSIlYfl5.mjs} +72 -459
- package/dist/experimental/index.d.mts +2 -3
- package/dist/experimental/index.mjs +1 -3
- package/dist/{fileUtils.node-Dq7ebZPC.mjs → fileUtils.node-BiO1JQsJ.mjs} +26 -25
- package/dist/index.d.mts +1708 -2400
- package/dist/index.mjs +2632 -2006
- package/dist/jsonSchema-CFKdONpP.mjs +251 -0
- package/dist/models/Files.node.d.mts +1 -2
- package/dist/models/Files.node.mjs +3 -4
- package/dist/models/Files.workerd.d.mts +0 -1
- package/dist/platform/node.d.mts +1 -2
- package/dist/platform/workerd.d.mts +1 -2
- package/dist/{chunk-CWQeghP5.mjs → rolldown-runtime-w6R9maHv.mjs} +3 -5
- package/dist/{types-J2KCXP8R.d.mts → types-D4Id3wXA.d.mts} +2 -3
- package/dist/{types-DRG5qLxI.d.cts → types-qTbYYBJw.d.mts} +2 -3
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -4
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -4
- package/dist/utils/config-defaults/ConfigDefaults.workerd.mjs +3 -0
- package/dist/utils/json-schema.d.mts +2 -0
- package/dist/utils/json-schema.mjs +3 -0
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +3 -1
- package/dist/utils/modifiers/FileToolModifier.node.mjs +44 -24
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +3 -1
- package/dist/utils/modifiers/FileToolModifier.workerd.mjs +1 -1
- package/docs/error-consistency.md +97 -0
- package/package.json +40 -88
- package/src/composio.ts +509 -0
- package/src/errors/AuthConfigErrors.ts +23 -0
- package/src/errors/ComposioError.ts +408 -0
- package/src/errors/ConnectedAccountsErrors.ts +158 -0
- package/src/errors/ConnectionRequestErrors.ts +32 -0
- package/src/errors/FileModifierErrors.ts +100 -0
- package/src/errors/PusherErrors.ts +28 -0
- package/src/errors/RemoteFileErrors.ts +62 -0
- package/src/errors/SDKErrors.ts +92 -0
- package/src/errors/ToolErrors.ts +244 -0
- package/src/errors/ToolkitErrors.ts +39 -0
- package/src/errors/TriggerErrors.ts +120 -0
- package/src/errors/ValidationErrors.ts +99 -0
- package/src/errors/index.ts +41 -0
- package/src/experimental/index.ts +28 -0
- package/src/index.ts +64 -0
- package/src/lib/toolRouterConstants.ts +1 -0
- package/src/lib/toolRouterParams.ts +306 -0
- package/src/models/AuthConfigs.ts +398 -0
- package/src/models/AuthScheme.ts +206 -0
- package/src/models/ConnectedAccounts.ts +735 -0
- package/src/models/ConnectionRequest.ts +150 -0
- package/src/models/CustomTool.ts +676 -0
- package/src/models/Experimental.ts +202 -0
- package/src/models/Files.node.ts +93 -0
- package/src/models/Files.workerd.ts +49 -0
- package/src/models/MCP.ts +478 -0
- package/src/models/RemoteFile.ts +172 -0
- package/src/models/SessionContext.ts +147 -0
- package/src/models/Sessions.ts +21 -0
- package/src/models/ToolRouter.ts +391 -0
- package/src/models/ToolRouterSession.ts +827 -0
- package/src/models/ToolRouterSessionFileMount.ts +389 -0
- package/src/models/Toolkits.ts +412 -0
- package/src/models/Tools.ts +1260 -0
- package/src/models/Triggers.ts +1381 -0
- package/src/models/customToolExecution.ts +118 -0
- package/src/models/inlineCustomToolsPayload.ts +17 -0
- package/src/models/proxyParamsTransform.ts +26 -0
- package/src/provider/BaseProvider.ts +138 -0
- package/src/provider/ComposioProvider.ts +29 -0
- package/src/provider/OpenAIProvider.ts +547 -0
- package/src/services/internal/InternalService.ts +50 -0
- package/src/services/internal/InternalService.types.ts +14 -0
- package/src/services/pusher/Pusher.ts +230 -0
- package/src/services/telemetry/TelemetryService.ts +48 -0
- package/src/services/telemetry/TelemetryService.types.ts +67 -0
- package/src/telemetry/BatchProcessor.ts +77 -0
- package/src/telemetry/README.md +123 -0
- package/src/telemetry/Telemetry.ts +356 -0
- package/src/types/ToolRouterSessionFilesMount.types.ts +96 -0
- package/src/types/authConfigs.types.ts +174 -0
- package/src/types/composio.types.ts +1 -0
- package/src/types/connectedAccountAuthStates.types.ts +852 -0
- package/src/types/connectedAccounts.types.ts +395 -0
- package/src/types/connectionRequest.types.ts +16 -0
- package/src/types/customTool.types.ts +261 -0
- package/{dist/files.types-lo4zZd87.d.cts → src/types/files.types.ts} +3 -5
- package/src/types/mcp.experimental.types.ts +163 -0
- package/src/types/mcp.types.ts +362 -0
- package/src/types/modifiers.types.ts +663 -0
- package/src/types/org.types.ts +0 -0
- package/src/types/provider.types.ts +41 -0
- package/src/types/pusher.types.ts +18 -0
- package/src/types/requestOptions.types.ts +62 -0
- package/src/types/telemetry.types.ts +89 -0
- package/src/types/tool.types.ts +408 -0
- package/src/types/toolRouter.types.ts +761 -0
- package/src/types/toolkit.types.ts +130 -0
- package/src/types/triggers.types.ts +401 -0
- package/src/types/webhookEvents.types.ts +219 -0
- package/src/utils/buffer.ts +30 -0
- package/src/utils/cancellation.ts +22 -0
- package/src/utils/config-defaults/ConfigDefaults.node.ts +7 -0
- package/src/utils/config-defaults/ConfigDefaults.workerd.ts +10 -0
- package/src/utils/config-defaults/index.ts +1 -0
- package/src/utils/config-defaults/types.ts +14 -0
- package/src/utils/constants.ts +22 -0
- package/src/utils/crypto.ts +34 -0
- package/src/utils/env.ts +34 -0
- package/src/utils/fileDirs.ts +81 -0
- package/src/utils/fileUtils.node.ts +458 -0
- package/src/utils/json-schema.ts +1 -0
- package/src/utils/jsonSchema.ts +355 -0
- package/src/utils/logger.ts +99 -0
- package/src/utils/mime.ts +75 -0
- package/src/utils/modifiers/FileToolModifier.node.ts +477 -0
- package/src/utils/modifiers/FileToolModifier.utils.neutral.ts +132 -0
- package/src/utils/modifiers/FileToolModifier.workerd.ts +51 -0
- package/src/utils/pagination.ts +73 -0
- package/src/utils/pusher.ts +286 -0
- package/src/utils/schemaPropertyKeys.ts +433 -0
- package/src/utils/sdk.ts +110 -0
- package/src/utils/sensitiveFileUploadPaths.node.ts +105 -0
- package/src/utils/session.ts +114 -0
- package/src/utils/toolArguments.ts +73 -0
- package/src/utils/toolkitVersion.ts +26 -0
- package/src/utils/transform.ts +42 -0
- package/src/utils/transformers/authConfigs.ts +107 -0
- package/src/utils/transformers/connectedAccounts.ts +119 -0
- package/src/utils/transformers/mcp.ts +164 -0
- package/src/utils/transformers/toolRouterResponseTransform.ts +160 -0
- package/src/utils/transformers/toolkits.ts +100 -0
- package/src/utils/transformers/triggers.ts +118 -0
- package/src/utils/uploadDirAllowlist.node.ts +178 -0
- package/src/utils/uuid.ts +7 -0
- package/src/utils/version.ts +58 -0
- package/src/utils/zodSchema.ts +90 -0
- package/dist/BaseProvider-BvHvJLXc.d.mts +0 -29378
- package/dist/CustomTool-D3-NreIm.cjs +0 -1341
- package/dist/FileModifierErrors-BYJBHiay.cjs +0 -554
- package/dist/FileToolModifier.utils.neutral-DSBQs9-i.cjs +0 -96
- package/dist/Telemetry-BQ_pl5AK.cjs +0 -360
- package/dist/buffer-BjWptbNH.cjs +0 -63
- package/dist/chunk-CQwRTUmo.cjs +0 -53
- package/dist/experimental/index.cjs +0 -5
- package/dist/experimental/index.d.cts +0 -3
- package/dist/fileUtils.node-DtnSRMWa.cjs +0 -462
- package/dist/index.cjs +0 -8523
- package/dist/index.d.cts +0 -6065
- package/dist/models/Files.node.cjs +0 -55
- package/dist/models/Files.node.d.cts +0 -56
- package/dist/models/Files.workerd.cjs +0 -29
- package/dist/models/Files.workerd.d.cts +0 -13
- package/dist/platform/node.cjs +0 -55
- package/dist/platform/node.d.cts +0 -11
- package/dist/platform/workerd.cjs +0 -42
- package/dist/platform/workerd.d.cts +0 -12
- package/dist/types-pDNm1lYs.d.cts +0 -69
- package/dist/utils/config-defaults/ConfigDefaults.node.cjs +0 -10
- package/dist/utils/config-defaults/ConfigDefaults.node.d.cts +0 -7
- package/dist/utils/config-defaults/ConfigDefaults.workerd.cjs +0 -10
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.cts +0 -7
- package/dist/utils/modifiers/FileToolModifier.node.cjs +0 -224
- package/dist/utils/modifiers/FileToolModifier.node.d.cts +0 -22
- package/dist/utils/modifiers/FileToolModifier.workerd.cjs +0 -27
- package/dist/utils/modifiers/FileToolModifier.workerd.d.cts +0 -20
- /package/dist/{FileToolModifier.utils.neutral-BpSceNK8.mjs → FileToolModifier.utils.neutral-B5rT711M.mjs} +0 -0
- /package/dist/{buffer-yOtEsT4J.mjs → buffer-PcbMMsgm.mjs} +0 -0
- /package/dist/{files.types-BXDWA_zS.d.mts → files.types-DeMC_mAW.d.mts} +0 -0
- /package/dist/{types-HpJQ8K9l.d.mts → types-DdoCRzLj.d.mts} +0 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "MCP"
|
|
3
|
+
description: "MCP (Model Control Protocol) class Handles MCP server operations. When `config.experimental.mcp` is enabled, this class augments the features of `composio.mcp`."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<Callout type="warn" title="Deprecated">
|
|
7
|
+
Use a session's MCP endpoint instead: `composio.create(userId, \{ mcp: true \})`
|
|
8
|
+
returns a session that exposes `session.mcp.url` / `session.mcp.headers`. MCP is now
|
|
9
|
+
opt-in per session; the standalone `composio.mcp` server-management API is kept only for
|
|
10
|
+
backwards compatibility. Prefer the session MCP endpoint; do not generate new code against
|
|
11
|
+
`composio.mcp`. See https://docs.composio.dev/docs/sessions-via-mcp
|
|
12
|
+
</Callout>
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
Access this class through the `composio.mcp` property:
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
20
|
+
const result = await composio.mcp.list();
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Properties
|
|
24
|
+
|
|
25
|
+
| Name | Type |
|
|
26
|
+
|------|------|
|
|
27
|
+
| `client` | `Composio` |
|
|
28
|
+
|
|
29
|
+
## Methods
|
|
30
|
+
|
|
31
|
+
### create()
|
|
32
|
+
|
|
33
|
+
Create a new MCP configuration.
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
async create(name: string, mcpConfig: MCPConfigCreationParams, requestOptions?: ComposioRequestOptions): Promise<MCPConfigCreateResponse>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Parameters**
|
|
40
|
+
|
|
41
|
+
| Name | Type |
|
|
42
|
+
|------|------|
|
|
43
|
+
| `name` | `string` |
|
|
44
|
+
| `mcpConfig` | `MCPConfigCreationParams` |
|
|
45
|
+
| `requestOptions?` | `ComposioRequestOptions` |
|
|
46
|
+
|
|
47
|
+
**Returns**
|
|
48
|
+
|
|
49
|
+
`Promise<MCPConfigCreateResponse>` — Created server details with instance getter
|
|
50
|
+
|
|
51
|
+
**Example**
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
const server = await composio.mcpConfig.create("personal-mcp-server", {
|
|
55
|
+
toolkits: ["github", "slack"],
|
|
56
|
+
allowedTools: ["GMAIL_FETCH_EMAILS", "SLACK_SEND_MESSAGE"],
|
|
57
|
+
manuallyManageConnections: false
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const server = await composio.mcpConfig.create("personal-mcp-server", {
|
|
62
|
+
toolkits: [{ toolkit: "gmail", authConfigId: "ac_243434343" }],
|
|
63
|
+
allowedTools: ["GMAIL_FETCH_EMAILS"],
|
|
64
|
+
manuallyManageConnections: false
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
### delete()
|
|
72
|
+
|
|
73
|
+
Delete an MCP server configuration permanently
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
async delete(serverId: string, requestOptions?: ComposioRequestOptions): Promise<{ id: string; deleted: boolean }>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Parameters**
|
|
80
|
+
|
|
81
|
+
| Name | Type | Description |
|
|
82
|
+
|------|------|-------------|
|
|
83
|
+
| `serverId` | `string` | The unique identifier of the MCP server to delete |
|
|
84
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
85
|
+
|
|
86
|
+
**Returns**
|
|
87
|
+
|
|
88
|
+
`Promise<\{ id: string; deleted: boolean \}>` — Confirmation object with server ID and deletion status
|
|
89
|
+
|
|
90
|
+
**Example**
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
// Delete an MCP server by ID
|
|
94
|
+
const result = await composio.experimental.mcp.delete("mcp_12345");
|
|
95
|
+
|
|
96
|
+
if (result.deleted) {
|
|
97
|
+
console.log(`Server ${result.id} has been successfully deleted`);
|
|
98
|
+
} else {
|
|
99
|
+
console.log(`Failed to delete server ${result.id}`);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Example with error handling
|
|
103
|
+
try {
|
|
104
|
+
const result = await composio.experimental.mcp.delete("mcp_12345");
|
|
105
|
+
console.log("Deletion successful:", result);
|
|
106
|
+
} catch (error) {
|
|
107
|
+
console.error("Failed to delete MCP server:", error.message);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Delete and verify from list
|
|
111
|
+
await composio.experimental.mcp.delete("mcp_12345");
|
|
112
|
+
const servers = await composio.experimental.mcp.list({});
|
|
113
|
+
const serverExists = servers.items.some(server => server.id === "mcp_12345");
|
|
114
|
+
console.log("Server still exists:", serverExists); // Should be false
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
### generate()
|
|
120
|
+
|
|
121
|
+
Get server URLs for an existing MCP server.
|
|
122
|
+
The response is wrapped according to the provider's specifications.
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
async generate(userId: string, mcpConfigId: string, options?: MCPGetInstanceParams, requestOptions?: ComposioRequestOptions): Promise<MCPServerInstance>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Parameters**
|
|
129
|
+
|
|
130
|
+
| Name | Type | Description |
|
|
131
|
+
|------|------|-------------|
|
|
132
|
+
| `userId` | `string` | \{string\} external user id from your database for whom you want the server for |
|
|
133
|
+
| `mcpConfigId` | `string` | \{string\} config id of the MCPConfig for which you want to create a server for |
|
|
134
|
+
| `options?` | `MCPGetInstanceParams` | \{object\} additional options |
|
|
135
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
136
|
+
|
|
137
|
+
**Returns**
|
|
138
|
+
|
|
139
|
+
`Promise<MCPServerInstance>`
|
|
140
|
+
|
|
141
|
+
**Example**
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
import { Composio } from "@composio/code";
|
|
145
|
+
|
|
146
|
+
const composio = new Composio();
|
|
147
|
+
const mcp = await composio.experimental.mcp.generate("default", "<mcp_config_id>");
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
### get()
|
|
153
|
+
|
|
154
|
+
Retrieve detailed information about a specific MCP server by its ID
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
async get(serverId: string, requestOptions?: ComposioRequestOptions): Promise<MCPItem>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Parameters**
|
|
161
|
+
|
|
162
|
+
| Name | Type | Description |
|
|
163
|
+
|------|------|-------------|
|
|
164
|
+
| `serverId` | `string` | The unique identifier of the MCP server to retrieve |
|
|
165
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
166
|
+
|
|
167
|
+
**Returns**
|
|
168
|
+
|
|
169
|
+
`Promise<MCPItem>` — Complete MCP server details including configuration, tools, and metadata
|
|
170
|
+
|
|
171
|
+
**Example**
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
// Get a specific MCP server by ID
|
|
175
|
+
const server = await composio.experimental.mcp.get("mcp_12345");
|
|
176
|
+
|
|
177
|
+
console.log(server.name); // "My Personal MCP Server"
|
|
178
|
+
console.log(server.allowedTools); // ["GITHUB_CREATE_ISSUE", "SLACK_SEND_MESSAGE"]
|
|
179
|
+
console.log(server.toolkits); // ["github", "slack"]
|
|
180
|
+
console.log(server.serverInstanceCount); // 3
|
|
181
|
+
|
|
182
|
+
// Access setup commands for different clients
|
|
183
|
+
console.log(server.commands.claude); // Claude setup command
|
|
184
|
+
console.log(server.commands.cursor); // Cursor setup command
|
|
185
|
+
console.log(server.commands.windsurf); // Windsurf setup command
|
|
186
|
+
|
|
187
|
+
// Use the MCP URL for direct connections
|
|
188
|
+
const mcpUrl = server.MCPUrl;
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
### list()
|
|
194
|
+
|
|
195
|
+
List the MCP servers with optional filtering and pagination
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
async list(options: MCPListParams, requestOptions?: ComposioRequestOptions): Promise<MCPListResponse>
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Parameters**
|
|
202
|
+
|
|
203
|
+
| Name | Type | Description |
|
|
204
|
+
|------|------|-------------|
|
|
205
|
+
| `options` | `MCPListParams` | Filtering and pagination options |
|
|
206
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
207
|
+
|
|
208
|
+
**Returns**
|
|
209
|
+
|
|
210
|
+
`Promise<MCPListResponse>` — Paginated list of MCP servers with metadata
|
|
211
|
+
|
|
212
|
+
**Example**
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
// List all MCP servers
|
|
216
|
+
const allServers = await composio.experimental.mcp.list({});
|
|
217
|
+
|
|
218
|
+
// List with pagination
|
|
219
|
+
const pagedServers = await composio.experimental.mcp.list({
|
|
220
|
+
page: 2,
|
|
221
|
+
limit: 5
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
// Filter by toolkit
|
|
225
|
+
const githubServers = await composio.experimental.mcp.list({
|
|
226
|
+
toolkits: ['github', 'slack']
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
// Filter by name
|
|
230
|
+
const namedServers = await composio.experimental.mcp.list({
|
|
231
|
+
name: 'personal'
|
|
232
|
+
});
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
### update()
|
|
238
|
+
|
|
239
|
+
Update an existing MCP server configuration with new settings
|
|
240
|
+
|
|
241
|
+
```typescript
|
|
242
|
+
async update(serverId: string, config: MCPUpdateParams, requestOptions?: ComposioRequestOptions): Promise<MCPItem>
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Parameters**
|
|
246
|
+
|
|
247
|
+
| Name | Type | Description |
|
|
248
|
+
|------|------|-------------|
|
|
249
|
+
| `serverId` | `string` | The unique identifier of the MCP server to update |
|
|
250
|
+
| `config` | `MCPUpdateParams` | Update configuration parameters |
|
|
251
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
252
|
+
|
|
253
|
+
**Returns**
|
|
254
|
+
|
|
255
|
+
`Promise<MCPItem>` — Updated MCP server configuration with all details
|
|
256
|
+
|
|
257
|
+
**Example**
|
|
258
|
+
|
|
259
|
+
```typescript
|
|
260
|
+
// Update server name only
|
|
261
|
+
const updatedServer = await composio.experimental.mcp.update("mcp_12345", {
|
|
262
|
+
name: "My Updated MCP Server"
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
// Update toolkits and tools
|
|
266
|
+
const serverWithNewTools = await composio.experimental.mcp.update("mcp_12345", {
|
|
267
|
+
toolkits: [
|
|
268
|
+
{
|
|
269
|
+
toolkit: "github",
|
|
270
|
+
authConfigId: "auth_abc123",
|
|
271
|
+
allowedTools: ["GITHUB_CREATE_ISSUE", "GITHUB_LIST_REPOS"]
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
toolkit: "slack",
|
|
275
|
+
authConfigId: "auth_xyz789",
|
|
276
|
+
allowedTools: ["SLACK_SEND_MESSAGE", "SLACK_LIST_CHANNELS"]
|
|
277
|
+
}
|
|
278
|
+
]
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
// Update connection management setting
|
|
282
|
+
const serverWithManualAuth = await composio.experimental.mcp.update("mcp_12345", {
|
|
283
|
+
name: "Manual Auth Server",
|
|
284
|
+
manuallyManageConnections: true
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
// Complete update example
|
|
288
|
+
const fullyUpdatedServer = await composio.experimental.mcp.update("mcp_12345", {
|
|
289
|
+
name: "Production MCP Server",
|
|
290
|
+
toolkits: [
|
|
291
|
+
{
|
|
292
|
+
toolkit: "gmail",
|
|
293
|
+
authConfigId: "auth_gmail_prod",
|
|
294
|
+
}
|
|
295
|
+
],
|
|
296
|
+
allowedTools: ["GMAIL_SEND_EMAIL", "GMAIL_FETCH_EMAILS"]
|
|
297
|
+
manuallyManageConnections: false
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
console.log("Updated server:", fullyUpdatedServer.name);
|
|
301
|
+
console.log("New tools:", fullyUpdatedServer.allowedTools);
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
---
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "RemoteFile"
|
|
3
|
+
description: "Represents a file stored in a tool router session's file mount. Provides methods to fetch, save, and work with the file content."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
Access this class through the `composio.remoteFile` property:
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
+
const result = await composio.remoteFile.list();
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
| Name | Type | Description |
|
|
18
|
+
|------|------|-------------|
|
|
19
|
+
| `downloadUrl` | `string` | Presigned URL for downloading the file |
|
|
20
|
+
| `expiresAt` | `string` | ISO 8601 timestamp when the download URL expires |
|
|
21
|
+
| `mountRelativePath` | `string` | Relative path within the mount (e.g. "report.pdf") |
|
|
22
|
+
| `sandboxMountPrefix` | `string` | Absolute mount path inside the sandbox (e.g. /mnt/files) |
|
|
23
|
+
|
|
24
|
+
## Methods
|
|
25
|
+
|
|
26
|
+
### blob()
|
|
27
|
+
|
|
28
|
+
Fetches the file content as a Blob.
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
async blob(): Promise<Blob>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Returns**
|
|
35
|
+
|
|
36
|
+
`Promise<Blob>` — The file content as a Blob
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
### buffer()
|
|
41
|
+
|
|
42
|
+
Fetches the file content as a buffer.
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
async buffer(): Promise<Uint8Array>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Returns**
|
|
49
|
+
|
|
50
|
+
`Promise<Uint8Array>` — The file content as a Uint8Array
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
### save()
|
|
55
|
+
|
|
56
|
+
Downloads and saves the file to the local filesystem.
|
|
57
|
+
Requires a Node.js runtime with file system support (not available in Cloudflare Workers/Edge).
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
async save(path?: string): Promise<string>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Parameters**
|
|
64
|
+
|
|
65
|
+
| Name | Type | Description |
|
|
66
|
+
|------|------|-------------|
|
|
67
|
+
| `path?` | `string` | Local path to save the file. If omitted, saves to the Composio temp directory using the filename from the mount path. |
|
|
68
|
+
|
|
69
|
+
**Returns**
|
|
70
|
+
|
|
71
|
+
`Promise<string>` — The absolute path where the file was saved
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
### text()
|
|
76
|
+
|
|
77
|
+
Fetches the file content as UTF-8 text.
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
async text(): Promise<string>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Returns**
|
|
84
|
+
|
|
85
|
+
`Promise<string>` — The file content as a string
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
### parse()
|
|
90
|
+
|
|
91
|
+
Parses an API response (snake_case) and returns a RemoteFile instance.
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
parse(data: unknown): RemoteFile
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Parameters**
|
|
98
|
+
|
|
99
|
+
| Name | Type | Description |
|
|
100
|
+
|------|------|-------------|
|
|
101
|
+
| `data` | `unknown` | Raw API response with snake_case keys |
|
|
102
|
+
|
|
103
|
+
**Returns**
|
|
104
|
+
|
|
105
|
+
`RemoteFile` — A RemoteFile instance
|
|
106
|
+
|
|
107
|
+
---
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Session files"
|
|
3
|
+
description: "File mount for a Composio session, reached via `session.experimental.files` on a session created with `composio.sessions.create(...)`. Upload, list, download, and delete files scoped to a single session."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Methods
|
|
7
|
+
|
|
8
|
+
### delete()
|
|
9
|
+
|
|
10
|
+
Deletes a file or directory at the specified path on the session's file mount.
|
|
11
|
+
|
|
12
|
+
Removes the file or directory from the virtual filesystem. Use with caution:
|
|
13
|
+
deletion is typically irreversible. Ensure the path exists and is intended for removal.
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
async delete(remotePath: string, options?: ToolRouterSessionFilesMountDeleteOptions): Promise<FileDeleteResponse>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Parameters**
|
|
20
|
+
|
|
21
|
+
| Name | Type | Description |
|
|
22
|
+
|------|------|-------------|
|
|
23
|
+
| `remotePath` | `string` | The path of the file or directory to delete on the mount. |
|
|
24
|
+
| `options?` | `ToolRouterSessionFilesMountDeleteOptions` | Optional configuration for the delete operation. |
|
|
25
|
+
|
|
26
|
+
**Returns**
|
|
27
|
+
|
|
28
|
+
`Promise<FileDeleteResponse>` — Confirmation of deletion (implementation-specific).
|
|
29
|
+
|
|
30
|
+
**Example**
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
const session = await composio.toolRouter.use('session_123');
|
|
34
|
+
await session.experimental.files.delete('/temp/cache.json');
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
// Delete from a custom mount
|
|
39
|
+
await session.experimental.files.delete('/old-backup', {
|
|
40
|
+
mountId: 'custom-mount',
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
### download()
|
|
47
|
+
|
|
48
|
+
Downloads a file from the session's file mount to the local filesystem.
|
|
49
|
+
|
|
50
|
+
Retrieves a file stored in the session's virtual filesystem (e.g., one produced
|
|
51
|
+
by a tool or previously uploaded) and saves it to the specified local path.
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
async download(filePath: string, options?: ToolRouterSessionFilesMountDownloadOptions): Promise<RemoteFile>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Parameters**
|
|
58
|
+
|
|
59
|
+
| Name | Type | Description |
|
|
60
|
+
|------|------|-------------|
|
|
61
|
+
| `filePath` | `string` | The path of the file on the mount to download, or the local path where the file should be saved (implementation-specific). |
|
|
62
|
+
| `options?` | `ToolRouterSessionFilesMountDownloadOptions` | Optional configuration for the download. |
|
|
63
|
+
|
|
64
|
+
**Returns**
|
|
65
|
+
|
|
66
|
+
`Promise<RemoteFile>` — The downloaded file data or path (implementation-specific).
|
|
67
|
+
|
|
68
|
+
**Example**
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
const session = await composio.toolRouter.use('session_123');
|
|
72
|
+
const result = await session.experimental.files.download('/output/report.pdf');
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
// Download from a custom mount
|
|
77
|
+
await session.experimental.files.download('/exports/data.json', {
|
|
78
|
+
mountId: 'custom-mount',
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
### list()
|
|
85
|
+
|
|
86
|
+
Lists files and directories at the specified path on the session's file mount.
|
|
87
|
+
|
|
88
|
+
Use this to browse the virtual filesystem attached to the tool router session.
|
|
89
|
+
The path is relative to the mount root (e.g., `"/"` for root, `"/documents"` for a subdirectory).
|
|
90
|
+
Supports cursor-based pagination via `cursor` and `limit` options.
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
async list(options?: ToolRouterSessionFilesMountListOptions): Promise<FileListResponse>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Parameters**
|
|
97
|
+
|
|
98
|
+
| Name | Type | Description |
|
|
99
|
+
|------|------|-------------|
|
|
100
|
+
| `options?` | `ToolRouterSessionFilesMountListOptions` | Optional configuration for the list operation. |
|
|
101
|
+
|
|
102
|
+
**Returns**
|
|
103
|
+
|
|
104
|
+
`Promise<FileListResponse>` — List of files with nextCursor for pagination.
|
|
105
|
+
|
|
106
|
+
**Example**
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
const session = await composio.toolRouter.use('session_123');
|
|
110
|
+
const { items, nextCursor } = await session.experimental.files.list({ path: '/' });
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
// Paginated listing
|
|
115
|
+
let result = await session.experimental.files.list({ path: '/', limit: 10 });
|
|
116
|
+
while (result.nextCursor) {
|
|
117
|
+
result = await session.experimental.files.list({ path: '/', cursor: result.nextCursor, limit: 10 });
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
### upload()
|
|
124
|
+
|
|
125
|
+
Uploads a file to the session's file mount.
|
|
126
|
+
|
|
127
|
+
Accepts a file path (local or URL), a native File object, or a raw buffer.
|
|
128
|
+
The file is stored in the virtual filesystem associated with the tool router session.
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
async upload(input: string | File | ArrayBuffer | Uint8Array, options?: ToolRouterSessionFilesMountUploadOptions): Promise<RemoteFile>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Parameters**
|
|
135
|
+
|
|
136
|
+
| Name | Type | Description |
|
|
137
|
+
|------|------|-------------|
|
|
138
|
+
| `input` | `string \| File \| ArrayBuffer \| Uint8Array` | File path (string), native File, or raw buffer (ArrayBuffer | Uint8Array). |
|
|
139
|
+
| `options?` | `ToolRouterSessionFilesMountUploadOptions` | Optional configuration. When passing a buffer, remotePath is required. |
|
|
140
|
+
|
|
141
|
+
**Returns**
|
|
142
|
+
|
|
143
|
+
`Promise<RemoteFile>` — Metadata about the uploaded file.
|
|
144
|
+
|
|
145
|
+
**Example**
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
// From file path (local or URL)
|
|
149
|
+
await session.experimental.files.upload('/path/to/report.pdf');
|
|
150
|
+
await session.experimental.files.upload('https://example.com/file.pdf');
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
// From native File (e.g. from input[type=file])
|
|
155
|
+
await session.experimental.files.upload(fileInput.files[0]);
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
// From raw buffer
|
|
160
|
+
await session.experimental.files.upload(buffer, { remotePath: 'data.json', mimetype: 'application/json' });
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|