Skip to main content

Documentation Index

Fetch the complete documentation index at: https://redop.useagents.site/docs/llms.txt

Use this file to discover all available pages before exploring further.

This tutorial shows the quickest way to add auth to a hosted Redop server.

What you will add

  • header-based auth with a built-in plugin
  • protected HTTP tools
  • a client call that includes the expected header

Step 1: Add the plugin

import { apiKey, Redop } from "@redopjs/redop";

new Redop({ serverInfo: { name: "auth-demo" } })
  .use(
    apiKey({
      key: process.env.API_SECRET ?? "dev-secret",
    }),
  )
  .tool("ping", {
    handler: () => ({ ok: true }),
  });

Step 2: Call the tool with the header

Send the header your plugin expects:
x-api-key: dev-secret

Step 3: Keep advanced config optional

If you need to change where the validated value is stored on ctx, use contextKey. Most servers can ignore that option.

Next