Docs MCP

Use Auld with your product’s users

If your product exposes its own MCP server or tools to many users, call the REST API from your tool handlers instead of handing out Auld tokens.

#The pattern

Your server authenticates the user, then calls Auld with your project key and that user’s identity as viewer or author. The key names the project; there is no project id field.

#Inside your tool handler

Your MCP server (TypeScript, illustrative)
// Inside your own MCP tool handler, after you have authenticated the user.
server.tool("recall_history", { query: z.string() }, async ({ query }, { authInfo }) => {
  const userId = authInfo.extra.userId;              // from your auth, never from arguments
  const res = await fetch(`${process.env.AULD_API_BASE}/v1/recall`, {
    method: "POST",
    headers: { Authorization: `Bearer ${process.env.AULD_API_KEY}`, "Content-Type": "application/json" },
    body: JSON.stringify({ query, viewer: userId, maxTokens: 1500 }),
  });
  const { memories } = await res.json();
  return { content: [{ type: "text", text: memories.map((m: any) => m.text).join("\n") }] };
});

Illustrative interface example · replace the host and key placeholders

#Why not give each user an Auld token?

  • You keep one place to enforce your own permissions.
  • Your users never see Auld credentials.
  • You can add business rules — for example, hiding memories from records a user can no longer access in your product.