Skip to main content
Glama

instacart_login

Initiate the Instacart login process to enable grocery shopping automation. Provides a URL for manual login completion, then verify with status check.

Instructions

Initiate Instacart login flow. Returns a URL and instructions for the user to complete login manually. After logging in, use instacart_status to verify.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Tool schema definition for instacart_login in the ListToolsRequestSchema handler - defines the tool name, description, and input schema (empty object)
    {
      name: "instacart_login",
      description:
        "Initiate Instacart login flow. Returns a URL and instructions for the user to complete login manually. After logging in, use instacart_status to verify.",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • src/index.ts:216-234 (registration)
    Tool registration handler for instacart_login in the CallToolRequestSchema switch statement - calls initiateLogin() and returns the login URL and instructions
    case "instacart_login": {
      const result = await initiateLogin();
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              {
                success: true,
                ...result,
              },
              null,
              2
            ),
          },
        ],
      };
    }
  • Core implementation of initiateLogin() function - initializes browser, navigates to Instacart login page, saves cookies, and returns login URL with user instructions
    export async function initiateLogin(): Promise<{ loginUrl: string; instructions: string }> {
      const { page, context } = await initBrowser();
    
      try {
        await page.goto(`${INSTACART_BASE_URL}/login`, { waitUntil: "networkidle", timeout: DEFAULT_TIMEOUT });
        await saveCookies(context);
    
        return {
          loginUrl: `${INSTACART_BASE_URL}/login`,
          instructions:
            "Please log in to Instacart manually:\n" +
            "1. Open the URL in your browser\n" +
            "2. Log in with your Instacart account\n" +
            "3. Once logged in, run 'instacart_status' to verify the session\n\n" +
            "Note: For headless operation, you may need to log in using the visible browser mode first, " +
            "then the session cookies will be saved for future use.",
        };
      } catch (error) {
        throw new Error(`Failed to initiate login: ${error instanceof Error ? error.message : String(error)}`);
      }
    }

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/markswendsen-code/mcp-instacart'

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