connect-gmail
Integrate Gmail with the Meme MCP Server to enable direct email interaction for generating meme images via the ImgFlip API.
Instructions
Connect to Gmail
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools.ts:12-36 (handler)The handler function for the 'connect-gmail' tool. It uses the VercelAIToolSet from Composio to initiate a Gmail connection for the default user, generating an OAuth redirect URL for the user to authorize the connection.server.tool("connect-gmail", "Connect to Gmail", {}, async (args, extra) => { try { console.log('args ', args); console.log('extra ', extra); const userAddress = "default-user"; const entity = toolset.client.getEntity(userAddress); const connection = await entity.initiateConnection({ appName: "gmail" }); return { content: [{ type: "text", text: `🔗 Gmail connection initiated!\n\nPlease connect your Gmail account by clicking on the link below:\n\n${connection.redirectUrl}\n\nAfter connecting, you can use Gmail actions.` }], }; } catch (error) { console.error('Error initiating Gmail connection:', error); return { content: [{ type: "text", text: `Error initiating Gmail connection: ${error instanceof Error ? error.message : String(error)}` }], }; } });
- src/tools.ts:12-36 (registration)Registration of the 'connect-gmail' tool using server.tool(), with empty schema {} and inline handler function.server.tool("connect-gmail", "Connect to Gmail", {}, async (args, extra) => { try { console.log('args ', args); console.log('extra ', extra); const userAddress = "default-user"; const entity = toolset.client.getEntity(userAddress); const connection = await entity.initiateConnection({ appName: "gmail" }); return { content: [{ type: "text", text: `🔗 Gmail connection initiated!\n\nPlease connect your Gmail account by clicking on the link below:\n\n${connection.redirectUrl}\n\nAfter connecting, you can use Gmail actions.` }], }; } catch (error) { console.error('Error initiating Gmail connection:', error); return { content: [{ type: "text", text: `Error initiating Gmail connection: ${error instanceof Error ? error.message : String(error)}` }], }; } });
- src/tools.ts:6-8 (helper)Initialization of VercelAIToolSet used by the connect-gmail handler for Gmail integration via Composio.const toolset = new VercelAIToolSet({ apiKey: process.env.COMPOSIO_API_KEY || '4xyic69yfd4610srw8cebg', });