All MCP clientsFocused: Bulk and signals
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/workflowsSign-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_workflows = await createMCPClient({
transport: {
type: "http",
url: "https://mcp.leadmagic.io/mcp/workflows",
// 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_workflows.tools();
// Pass `tools` into generateText, streamText, or your agent.
} finally {
await leadmagic_workflows.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_workflows",
serverUrl: "https://mcp.leadmagic.io/mcp/workflows",
serverDescription:
"LeadMagic B2B enrichment: email, contacts, account intel, hiring signals, ads, jobs, credits.",
authorization: process.env.LEADMAGIC_OAUTH_TOKEN,
allowedTools: ["create_bulk_upload_session","process_attached_csv","resolve_bulk_upload_mapping","submit_detected_bulk_job","submit_bulk_job","list_bulk_jobs","get_bulk_job_status","get_bulk_job_rows","get_bulk_job_errors","get_bulk_job_logs","get_bulk_job_events","export_bulk_job","pause_bulk_job","resume_bulk_job","restart_bulk_job","watch_bulk_job_progress","find_jobs","get_company_hiring_signals","search_jobs","search_google_ads","search_meta_ads","search_b2b_ads","get_b2b_ad_details","check_credit_balance","preview_cost"],
}),
};