generate_magic_link
Create a secure magic link for client login using a client ID, simplifying authentication.
Instructions
Generate a magic login link for a client.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| client_id | Yes | Client ID |
Implementation Reference
- server/index.js:290-301 (handler)The tool handler for generate_magic_link. Registers an MCP tool that accepts a client_id, calls the /v1/workspace/client/magic-link API endpoint via POST, and returns the JSON result.
server.tool( "generate_magic_link", "Generate a magic login link for a client.", { client_id: z.string().describe("Client ID"), }, { title: "Generate Magic Link", readOnlyHint: false, destructiveHint: false, openWorldHint: false }, async ({ client_id }) => { const data = await apiCall("/v1/workspace/client/magic-link", "POST", { client_id }); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } ); - server/index.js:112-123 (helper)The apiCall helper function used by the handler to make authenticated HTTP requests to the backend API.
async function apiCall(path, method, body) { const url = `${BASE_URL}${path}`; const res = await fetch(url, { method, headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json", }, ...(body ? { body: JSON.stringify(body) } : {}), }); return res.json(); }