All MCP clientsFocused: Data enrichment
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/enrichment-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_enrichment = await createMCPClient({
transport: {
type: "http",
url: "https://mcp.leadmagic.io/mcp/enrichment-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_enrichment.tools();
// Pass `tools` into generateText, streamText, or your agent.
} finally {
await leadmagic_enrichment.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_enrichment",
serverUrl: "https://mcp.leadmagic.io/mcp/enrichment-core",
serverDescription:
"LeadMagic B2B enrichment: email, contacts, account intel, hiring signals, ads, jobs, credits.",
authorization: process.env.LEADMAGIC_OAUTH_TOKEN,
allowedTools: ["search_people","search_companies","find_work_email","validate_work_email","find_company_funding","enrich_company","find_local_leads","find_mobile_number","b2b_profile_to_work_email","linkedin_profile_to_work_email","detect_job_change","list_company_competitors","get_company_technographics","find_lookalike_companies","find_people_by_role","find_company_employees","search_profile","email_to_b2b_profile","find_personal_email","account_intel","enrich_contact","find_decision_makers","get_account_analytics","check_credit_balance","preview_cost"],
}),
};