login_with_otp
Authenticate to your P-Link wallet by entering your email and the one-time password received via email to access payment and transaction features.
Instructions
Login using otp. Connect to your P-Link wallet using the one time password you received by email
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Yes | Email of your account. | ||
| otp | Yes | otp in order to access your account. You can receive your one time password by email usgin this MCP server tools or get it on https://p-link.io |
Implementation Reference
- src/tools/auth.ts:73-106 (handler)Core handler function for login_with_otp tool. Posts OTP and email to /api/consumeOTP endpoint, parses response, sets session authentication if API_KEY and pubk received, returns success message and public Solana wallet address or throws error on invalid OTP.export async function login_with_otp(args: any) { const { otp, email } = args; var jsP = { otp,email } const fet = await fetch(BASE + '/api/consumeOTP', { method: 'POST', headers: { Accept: 'application.json', 'Content-Type': 'application/json' }, body: JSON.stringify(jsP) }); var dat = await fet.text(); process.stderr.write(`[caisse][info] APIuser ${dat}\n`); var data = JSON.parse(dat); //var data = await getAPIuser(API_KEY); if (typeof data === 'object' && data && 'API_KEY' in data && 'pubk' in data) { setSessionAuth({ ok: true, APIKEY: data.API_KEY, scopes: ['*'], }); return { result: 'Login successfull, otp consumed', publicSolanaWalletAddress: data.pubk } //ctx.auth = getSessionAuth(); } else { throw new Error("otp incorrect"); console.error('Erreur API:', data); } return data; }
- src/tools/auth.ts:16-19 (schema)Zod-based input schema for the login_with_otp tool defining required email and otp fields with descriptions.export const otpInput = { email: z.string().email().describe("Email of your account."), otp: z.string().describe("otp in order to access your account. You can receive your one time password by email usgin this MCP server tools or get it on https://p-link.io") };
- src/solution.ts:30-35 (registration)Tool registration entry in the static tools array used by listTools handler, specifying name, description, inputSchema derived from otpInput, and annotations.{ name: "login_with_otp", description: login_with_otp_title, inputSchema: jsonSchema(zodToJsonSchema(z.object(otpInput))).jsonSchema, annotations: { title: login_with_otp_title, readOnlyHint: true } },
- src/solution.ts:126-128 (handler)Dispatch logic in the main callTool request handler switch statement that invokes the login_with_otp implementation function.case "login_with_otp": result = await login_with_otp(args); break;
- src/tools/auth.ts:30-30 (helper)Title string used in tool description and annotations.export const login_with_otp_title = 'Login using otp. Connect to your P-Link wallet using the one time password you received by email';