Documentation

TypeScript

Use the platform fetch API to call Northsun (formerly Mnemix) over the frozen public caller-memory contract. This keeps your integration pinned to the three stable REST endpoints while a corrected stable npm client is prepared.

Node 18 or newer includes the required global fetch.

Create a small client

Host migration: the canonical platform host is moving to mcp.northsun.ai. During the transition mcp.mnemix.ai continues to serve the full surface unchanged — existing integrations keep working, no action required. When the successor host is generally available, responses from this host will carry a Deprecation header (RFC 9745) and a Link rel="successor-version" header pointing at the corresponding mcp.northsun.ai URL; a retirement date, if one is ever set, will be announced in advance with a Sunset header (RFC 8594). No cutoff is scheduled.

const baseUrl = "https://mcp.mnemix.ai";
const apiKey = process.env.MNEMIX_API_KEY!;

async function northsun<T>(path: string, init: RequestInit = {}): Promise<T> {
  const response = await fetch(`${baseUrl}${path}`, {
    ...init,
    headers: {
      Authorization: `Bearer ${apiKey}`,
      "Content-Type": "application/json",
      ...init.headers,
    },
  });

  if (!response.ok) {
    const body = await response.text();
    throw new Error(`Northsun ${response.status}: ${body}`);
  }

  return response.status === 204
    ? (undefined as T)
    : ((await response.json()) as T);
}

Production applications should add a request timeout, structured error parsing, and the retry policy in Errors and retries.

Recall before the interaction

const packet = await northsun<{
  known: boolean;
  caller: { name: string | null };
  memory: { summary: string };
  enrichment: {
    person: { name: string | null; title?: string | null; company?: string | null } | null;
    company: { name: string | null } | null;
    phone: { carrier: string | null; line_type: string | null } | null;
  };
}>("/v1/recall_and_enrich", {
  method: "POST",
  body: JSON.stringify({
    phone_number: "+15551234567",
    trigger: "answered",
    session_id: "call_01",
  }),
});

console.log(packet.caller.name);
console.log(packet.memory.summary);
console.log(packet.enrichment.phone?.line_type);

Enrichment fields may be null. Treat enrichment as additional context, not as a condition for continuing the call.

Write back after hangup

await northsun<void>("/v1/calls/end", {
  method: "POST",
  body: JSON.stringify({
    phone_number: "+15551234567",
    session_id: "call_01",
    transcript: [
      { role: "user", text: "Please call me Tuesday.", ts_ms: 0 },
      { role: "agent", text: "I will note that request.", ts_ms: 2_400 },
    ],
    duration_s: 18,
    outcome: "callback_requested",
  }),
});

The endpoint returns 204 No Content on success.

Read without enrichment

const phone = encodeURIComponent("+15551234567");
const caller = await northsun(`/v1/caller/${phone}`);

This endpoint does not create a caller and does not trigger enrichment. An unknown number returns 404 with code not_found.

npm client status

The registry currently contains @mnemix-ai/client@0.2.0, but that release does not align with the frozen three-endpoint contract documented here. Do not adopt it for a new production integration. Use native HTTP until the package registry contains a release whose base URL, methods, types, and route mappings match this reference.

If you already use the beta client, pin its exact version and follow the contract named in your beta agreement. Repository code may be newer than the package you installed.

Next steps