> ## 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.

# Built-In Plugins

> Reference for the built-in plugins exported by @redopjs/redop.

These are the built-in plugins exported from `@redopjs/redop` today. Each one returns a `Redop` instance, so you attach it with `.use(...)`.

## `logger(opts?)`

* logs tool start, end, and error events
* options:
  * `level?: "debug" | "info" | "warn" | "error"`
  * `write?: (entry) => void`
* default level: `info`

```ts theme={null}
import { logger, Redop } from "@redopjs/redop";

new Redop({ serverInfo: { name: "logs" } }).use(logger({ level: "info" }));
```

## `apiKey(opts?)`

* validates an HTTP header on HTTP requests
* options:
  * `key?: string`
  * `keys?: string[]`
  * `headerName?: string`
  * `contextKey?: string`
  * `required?: boolean`
  * `validateKey?: (apiKey, event) => boolean | Promise<boolean>`
  * legacy aliases still supported: `secret`, `ctxKey`, `validate`
* default header: `x-api-key`
* default context key: `apiKey`

```ts theme={null}
import { apiKey, Redop } from "@redopjs/redop";

new Redop({ serverInfo: { name: "auth" } }).use(
  apiKey({
    key: process.env.API_SECRET ?? "dev-secret",
  }),
);
```

## `jwt(opts)`

* validates bearer JWTs on HTTP requests
* supports shared-secret verification or JWKS
* options:
  * `secret?: string`
  * `jwksUri?: string`
  * `issuer?: string`
  * `audience?: string | string[]`
  * `requiredScopes?: string[]`
  * `optional?: boolean`

```ts theme={null}
import { jwt, Redop } from "@redopjs/redop";

new Redop({ serverInfo: { name: "auth" } }).use(
  jwt({
    secret: process.env.JWT_SECRET ?? "dev-jwt-secret",
  }),
);
```

## `oauth(opts)`

* validates OAuth bearer tokens using issuer discovery (OAuth AS or OpenID) + JWKS
* when `resource` is set, serves RFC 9728 Protected Resource Metadata and returns HTTP 401/403 `WWW-Authenticate` challenges for MCP clients (Claude, etc.)
* options:
  * `issuer: string`
  * `resource?: string` (absolute MCP URL — required for Claude-style OAuth)
  * `audience?: string | string[]` (defaults to `resource`)
  * `authorizationServers?: string[]` (defaults to `[issuer]`)
  * `requiredScopes?: string[]`
  * `scopesSupported?: string[]`
  * `optional?: boolean`

```ts theme={null}
import { oauth, Redop } from "@redopjs/redop";

new Redop({ serverInfo: { name: "auth" } }).use(
  oauth({
    issuer: "https://auth.example.com",
    resource: "https://mcp.example.com/mcp",
    requiredScopes: ["mcp:tools"],
  }),
);
```

## See also

* [API key authentication](/docs/guides/authentication/api-key)
* [JWT authentication](/docs/guides/authentication/jwt)
* [OAuth authentication](/docs/guides/authentication/oauth)
* [Logger plugin](/docs/guides/logger-plugin)
* [Build a plugin or middleware](/docs/guides/build-plugin-or-middleware)
* [Middleware, hooks, and plugins](/docs/concepts/composition)
