All MCP clientsFocused: Sheets
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-coreSign-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)
Recommendedtypescript · 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_sheets = await createMCPClient({
transport: {
type: "http",
url: "https://mcp.leadmagic.io/mcp/sheets-core",
// 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_sheets.tools();
// Pass `tools` into generateText, streamText, or your agent.
} finally {
await leadmagic_sheets.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_sheets",
serverUrl: "https://mcp.leadmagic.io/mcp/sheets-core",
serverDescription:
"LeadMagic B2B enrichment: email, contacts, account intel, hiring signals, ads, jobs, credits.",
authorization: process.env.LEADMAGIC_OAUTH_TOKEN,
allowedTools: ["list_sheets","get_sheet","read_sheet_rows","set_sheet_cells","add_sheet_rows","delete_sheet_rows","get_sheet_stats","list_sheet_runs","get_sheet_run","list_sheet_run_rows","run_sheet_column","pause_sheet_run","cancel_sheet_run","add_sheet_column","add_sheet_columns","update_sheet_column","delete_sheet_column","restore_sheet_column","create_sheet","update_sheet","check_credit_balance","preview_cost"],
}),
};