createConnection
Establish connections to cloud storage services like Notion, Google Drive, and Dropbox to authorize document ingestion for knowledge management.
Instructions
Creates a new connection to a specific source. The connector parameter should be a valid SourceSync connector enum value. The clientRedirectUrl parameter is optional and can be used to specify a custom redirect URL for the connection. This will give you a authorization url which you can redirect the user to. The user will then be asked to pick the documents they want to ingest.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| namespaceId | No | ||
| name | Yes | ||
| connector | Yes | ||
| clientRedirectUrl | No | ||
| tenantId | No |
Implementation Reference
- src/index.ts:636-656 (registration)Registration of the MCP tool 'createConnection' including its handler function that wraps the SourceSync client call.server.tool( 'createConnection', 'Creates a new connection to a specific source. The connector parameter should be a valid SourceSync connector enum value. The clientRedirectUrl parameter is optional and can be used to specify a custom redirect URL for the connection. This will give you a authorization url which you can redirect the user to. The user will then be asked to pick the documents they want to ingest.', CreateConnectionSchema.shape, async (params: any) => { return safeApiCall(async () => { const { namespaceId, name, connector, clientRedirectUrl, tenantId } = params // Create a client with the provided parameters const client = createClient({ namespaceId, tenantId }) // Call the createConnection method with the connector as enum return await client.createConnection({ name, connector, clientRedirectUrl, }) }) }, )
- src/sourcesync.ts:237-255 (handler)Core handler logic for createConnection in SourceSyncApiClient class, performing the HTTP POST request to the SourceSync API.public async createConnection({ name, connector, clientRedirectUrl, }: Omit< SourceSyncCreateConnectionRequest, 'namespaceId' >): Promise<SourceSyncCreateConnectionResponse> { return this.client .url('/v1/connections') .json({ namespaceId: this.namespaceId, name, connector, clientRedirectUrl, } satisfies SourceSyncCreateConnectionRequest) .post() .json<SourceSyncCreateConnectionResponse>() }
- src/schemas.ts:467-473 (schema)Zod schema defining input parameters for the createConnection tool, used for validation in MCP.export const CreateConnectionSchema = z.object({ namespaceId: namespaceIdSchema.optional(), name: z.string(), connector: ConnectorEnum, clientRedirectUrl: z.string().optional(), tenantId: tenantIdSchema, })
- src/sourcesync.types.ts:331-342 (schema)TypeScript type definitions for the SourceSync API request and response for createConnection.export type SourceSyncCreateConnectionRequest = { namespaceId: string name: string connector: SourceSyncConnector clientRedirectUrl?: string } export type SourceSyncCreateConnectionResponse = SourceSyncApiResponse<{ connection: SourceSyncFaunaRef authorizationUrl: string }>