---
title: Run a redirect operation locally
description: Create, verify, and clean up a Quirello redirect against the in-memory Operator Contract.
---

Use this tutorial to prove one complete Quirello mutation path without Cloudflare bindings or a remote website.

## run the lesson

From the repository root, run the source tutorial test:

```bash
pnpm --dir src/packages/quirello test src/tutorials/redirect.test.ts
```

The lesson creates an exact-match redirect from `/old-campaign` to `/campaigns/current`, reads it back through the same Operator Contract, then deletes it. A passing test proves the input and result schemas at the package boundary. It makes no network call and leaves no remote state.

## use the same flow with a host

The remote version connects to the host's `/q/mcp` endpoint, runs the same three operations, and closes the MCP client:

```ts
await runRemoteRedirectTutorial({
  mcpUrl: "http://localhost:3160/q/mcp",
});
```

Local hostnames do not need a bearer token. A non-local host requires the Quirello Operator Token. Do not point this tutorial at a shared environment because it deliberately creates and deletes a redirect.

Read the [full runnable source](https://github.com/patronage/quirello/blob/main/src/tutorials/redirect.ts) and [its test](https://github.com/patronage/quirello/blob/main/src/tutorials/redirect.test.ts) for the detailed implementation. Use the [MCP operations guide](/how-to/mcp-operations) for forms and media.
