insumer_request_domain_verification
Request a domain verification token for a merchant. Returns token and three methods: DNS TXT, HTML meta tag, or file upload. After placing token, call verify to complete and earn a trust badge.
Instructions
Request a domain verification token for a merchant. Returns the token and three verification methods: DNS TXT record, HTML meta tag, or file upload. After placing the token, call insumer_verify_domain to complete verification. Verified merchants get a trust badge in the public directory. Owner only.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Merchant ID | |
| domain | Yes | Domain to verify (e.g. 'example.com') |
Implementation Reference
- src/index.ts:672-681 (handler)The async handler function that executes the domain verification request. It sends a POST request to /merchants/{id}/domain-verification with the merchant ID and domain, then returns the formatted result containing the verification token and methods (DNS TXT record, HTML meta tag, or file upload).
async (args) => { const { id, ...body } = args; const result = await apiCall( "POST", `/merchants/${encodeURIComponent(id)}/domain-verification`, body ); return formatResult(result); } ); - src/index.ts:668-671 (schema)Input schema for the tool using Zod validation. Requires an 'id' (Merchant ID string) and 'domain' (domain to verify, e.g. 'example.com').
{ id: z.string().describe("Merchant ID"), domain: z.string().describe("Domain to verify (e.g. 'example.com')"), }, - src/index.ts:665-681 (registration)Registration of the tool on the MCP server using server.tool() with the name 'insumer_request_domain_verification', a description explaining the purpose and verification methods, the schema, and the handler.
server.tool( "insumer_request_domain_verification", "Request a domain verification token for a merchant. Returns the token and three verification methods: DNS TXT record, HTML meta tag, or file upload. After placing the token, call insumer_verify_domain to complete verification. Verified merchants get a trust badge in the public directory. Owner only.", { id: z.string().describe("Merchant ID"), domain: z.string().describe("Domain to verify (e.g. 'example.com')"), }, async (args) => { const { id, ...body } = args; const result = await apiCall( "POST", `/merchants/${encodeURIComponent(id)}/domain-verification`, body ); return formatResult(result); } ); - src/index.ts:17-40 (helper)The apiCall helper function used by the handler. It constructs the URL using API_BASE, sends a fetch request with the API key header and JSON body, and parses the JSON response.
async function apiCall( method: string, path: string, body?: Record<string, unknown> ): Promise<{ ok: boolean; data?: unknown; error?: unknown; meta?: unknown }> { if (!apiKey) { return { ok: false, error: "INSUMER_API_KEY is not set. Call the insumer_setup tool to generate a free API key instantly, then add it to your MCP config as INSUMER_API_KEY and restart." }; } const url = `${API_BASE}${path}`; const res = await fetch(url, { method, headers: { "Content-Type": "application/json", "X-API-Key": apiKey, }, body: body ? JSON.stringify(body) : undefined, }); return res.json() as Promise<{ ok: boolean; data?: unknown; error?: unknown; meta?: unknown; }>; } - src/index.ts:61-76 (helper)The formatResult helper used by the handler to format API responses into MCP content. Returns a success content block on ok, or an error content block with isError: true on failure.
function formatResult(result: { ok: boolean; data?: unknown; error?: unknown; meta?: unknown; }) { if (result.ok) { return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }], }; } return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }], isError: true, }; }