> ## Documentation Index
> Fetch the complete documentation index at: https://anything.notte.cc/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Setup for agents

> Paste this into your coding agent and let it wire Anything API into your project.

Copy the prompt into Claude Code, Cursor, or Codex. The agent connects the MCP server, finds or builds the API you need, and wires it into your code. Grab an API key at [console.notte.cc](https://console.notte.cc) first. Browsing is public, running and building are not.

```md Agent prompt expandable theme={"system"}
Step 1: Connect Anything API

Add the Anything API MCP server:

  claude mcp add --transport http --scope user anything-api https://anything.notte.cc/mcp

Then run /mcp and sign in with the user's Notte account. For CI or a headless
environment, pass a key instead of using OAuth:

  claude mcp add --transport http --scope user anything-api https://anything.notte.cc/mcp \
    --header "Authorization: Bearer $NOTTE_API_KEY"

Get a key at https://console.notte.cc. The server is plain streamable HTTP, so
Cursor, Codex, and Claude Desktop take the same URL with their own config
syntax.

Step 2: Ask the user

Ask two things:

a) What web task do you need an API for? Name the site, what goes in, and which
   fields should come back.
b) Is this a fresh project, or an integration into an existing codebase?

Step 3: Find or build the API

Always search before building. Building costs minutes and credits. Running
something that already exists costs seconds.

- Call `search` with the task description. Narrow it with `base_url` or
  `category` when the user named a specific site.
- If a result fits, call `spec` with its function_id to read the exact
  parameter and response schema. Do this before writing any code.
- Call `run` with that function_id and a `variables` object to confirm it
  returns what the user actually wants.
- Only if nothing fits, call `build` with a plain-English description: which
  site, what goes in, what comes out. It blocks for 2 to 10 minutes and returns
  a new function_id. If the client's tool timeout is shorter than that, tell the
  user to build at https://anything.notte.cc and come back with the id.

Never ask which workspace to use. The credential decides it.

Step 4: Integrate

Fresh project: ask which language the user prefers (Python or TypeScript),
scaffold a minimal project, and install the SDK.

  Python:     pip install notte-sdk
  TypeScript: npm install notte-sdk

Existing project: read the codebase first. Language, package manager, project
structure, where environment variables are loaded from, and how HTTP calls are
already made. Match those conventions rather than introducing new ones.

Store the key as NOTTE_API_KEY wherever the project already keeps its secrets.
Never hard-code it.

  Python:

    import os
    from notte_sdk import NotteClient

    client = NotteClient(api_key=os.environ["NOTTE_API_KEY"])
    result = client.Function("YOUR_FUNCTION_ID").run(zip_code="94110")

  TypeScript:

    import { NotteClient } from "notte-sdk";

    const notte = new NotteClient({ apiKey: process.env.NOTTE_API_KEY! });
    const result = await notte
      .NotteFunction({ function_id: "YOUR_FUNCTION_ID" })
      .run({ zip_code: "94110" });

If the project's language has no SDK, call the endpoint over plain HTTPS. Both
auth headers are required and must carry the same key, and the endpoint answers
a redirect, so the client has to follow it:

  curl --location 'https://api.notte.cc/functions/YOUR_FUNCTION_ID/runs/start' \
    --header 'x-notte-api-key: YOUR_NOTTE_API_KEY' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer YOUR_NOTTE_API_KEY' \
    --data '{"function_id": "YOUR_FUNCTION_ID", "variables": {}}'

Step 5: Verify

Run the project and confirm the response carries the fields the user asked for.
The payload is under `result`. The run also shows up in the API's Runs tab and
on the Activity page at https://anything.notte.cc.

If something fails, diagnose it before retrying. Common issues:

- A run that raises still returns HTTP 200, with the traceback inside `result`.
  Read the payload, not the status code.
- 422 on a direct HTTP call means the `x-notte-api-key` header is missing, or
  does not match the bearer token.
- 401 means the key is wrong or absent. Check it at https://console.notte.cc.
- Wrong variable names are your side of the contract. Re-read `spec`.
- A traceback that reads like the site changed is expected to self-heal. The
  API redeploys itself within minutes, so retry once before rebuilding.
```
