Skip to main content
Glama
arpitbatra123

Google Tasks MCP Server

set-auth-code

Set the authentication code from Google OAuth to enable secure access and manage Google Tasks directly through the Claude interface.

Instructions

Set the authentication code received from Google OAuth flow

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesThe authentication code received from Google

Implementation Reference

  • The main handler function for the 'set-auth-code' tool. It exchanges the provided OAuth authorization code for access and refresh tokens using Google OAuth2 client, stores the credentials in memory, closes the temporary auth server if running, and returns a success message or error response.
    async ({ code }) => { try { const { tokens } = await oauth2Client.getToken(code); oauth2Client.setCredentials(tokens); // Store tokens in memory only credentials = tokens; // Close auth server if it's still running if (authServer) { try { authServer.close(); } catch (error) { console.error('Error closing auth server:', error); } authServer = null; } return { content: [ { type: "text", text: "Authentication successful! You can now use the Google Tasks tools.", }, ], }; } catch (error) { console.error('Error retrieving access token:', error); return { isError: true, content: [ { type: "text", text: `Authentication failed: ${error}`, }, ], }; } }
  • Zod schema defining the input parameter 'code' as a required string for the authorization code.
    { code: z.string().describe("The authentication code received from Google"), },
  • src/index.ts:139-184 (registration)
    Registration of the 'set-auth-code' tool using server.tool(), including name, description, input schema, and inline handler function.
    server.tool( "set-auth-code", "Set the authentication code received from Google OAuth flow", { code: z.string().describe("The authentication code received from Google"), }, async ({ code }) => { try { const { tokens } = await oauth2Client.getToken(code); oauth2Client.setCredentials(tokens); // Store tokens in memory only credentials = tokens; // Close auth server if it's still running if (authServer) { try { authServer.close(); } catch (error) { console.error('Error closing auth server:', error); } authServer = null; } return { content: [ { type: "text", text: "Authentication successful! You can now use the Google Tasks tools.", }, ], }; } catch (error) { console.error('Error retrieving access token:', error); return { isError: true, content: [ { type: "text", text: `Authentication failed: ${error}`, }, ], }; } } );

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/arpitbatra123/mcp-googletasks'

If you have feedback or need assistance with the MCP directory API, please join our Discord server