All MCP clientsFocused: Sheets setup
MCP setupAuthorization Bearer

Connect Vercel AI SDK to LeadMagic

For AI SDK Core, @ai-sdk/mcp, @ai-sdk/openai.

Server-side code sends a LeadMagic OAuth access token. User-facing apps pass an OAuth `authProvider` to createMCPClient and host the callback themselves.

Focused MCP endpoint

https://mcp.leadmagic.io/mcp/sheets-advanced
Sign-in: Server-side code sends a LeadMagic OAuth access token. User-facing apps pass an OAuth `authProvider` to createMCPClient and host the callback themselves.

createMCPClient (@ai-sdk/mcp)

Recommended

typescript · manual · Token

Needs a LeadMagic OAuth access token (issued by https://clerk.leadmagic.io, scope mcp_all, valid for one day). LeadMagic API keys are rejected.

import { createMCPClient } from "@ai-sdk/mcp";

const leadmagic_sheet_setup = await createMCPClient({
  transport: {
    type: "http",
    url: "https://mcp.leadmagic.io/mcp/sheets-advanced",
    // Server-side: send a LeadMagic OAuth access token.
    headers: { Authorization: `Bearer ${process.env.LEADMAGIC_OAUTH_TOKEN}` },
    // User-facing apps: pass `authProvider` instead and host the OAuth callback.
  },
});

try {
  const tools = await leadmagic_sheet_setup.tools();
  // Pass `tools` into generateText, streamText, or your agent.
} finally {
  await leadmagic_sheet_setup.close();
}

openai.tools.mcp (OpenAI Responses provider)

typescript · manual · Token

`authorization` takes the access token. The allowedTools list is an example; /clients?format=json has the full tool list. Needs a LeadMagic OAuth access token (issued by https://clerk.leadmagic.io, scope mcp_all, valid for one day). LeadMagic API keys are rejected.

import { openai } from "@ai-sdk/openai";

const tools = {
  leadmagic: openai.tools.mcp({
    serverLabel: "leadmagic_sheet_setup",
    serverUrl: "https://mcp.leadmagic.io/mcp/sheets-advanced",
    serverDescription:
      "LeadMagic B2B enrichment: email, contacts, account intel, hiring signals, ads, jobs, credits.",
    authorization: process.env.LEADMAGIC_OAUTH_TOKEN,
    allowedTools: ["configure_sheet_column","set_sheet_column_auto_run","draft_sheet_ai_prompt","list_sheet_column_fields","extract_sheet_json_field","reorder_sheet_columns","list_sheet_http_requests","parse_sheet_http_request","test_sheet_http_request","save_sheet_http_request","get_sheet_http_request","update_sheet_http_request","list_sheet_http_credentials","draft_sheet_http_request","export_sheet_recipe","import_sheet_recipe","restore_sheet_rows","check_credit_balance","preview_cost"],
  }),
};

Client documentation

LeadMagic MCP setup for Vercel AI SDK | LeadMagic