Skip to content

Agent get started

Arcjet is the runtime security platform that ships with your code. Enforce budgets, stop prompt injection, detect bots, and protect personal information with Arcjet’s AI security building blocks.

This page walks AI coding agents through getting Arcjet set up in any project.

The Arcjet plugin for Claude Code and Cursor is the fastest way to add Arcjet security. Install it with a single command:

Terminal window
npx plugins add arcjet/arcjet-plugin

The plugin handles everything automatically — MCP connection, API key setup, SDK installation, and adding protection rules. Just trigger a skill:

SkillPurpose
/arcjet:protect-routeDesigned for web apps. Adds protection to route handlers with automatic framework detection
/arcjet:add-ai-protectionDesigned for AI apps. Implements prompt injection detection, PII blocking, and token budget rate limiting

That’s it. The plugin detects your framework, connects to MCP, and walks you through the rest. Skip to Common agent prompts for usage examples, or continue below for manual setup with other tools.

Use this path if you’re working with VS Code Copilot, Windsurf, ChatGPT, Claude Desktop, or prefer to set things up step by step.

The Arcjet MCP server lets you manage your account directly from your AI coding tool.

  1. In ChatGPT, go to Settings.
  2. Navigate to Connectors and select Add connection.
  3. Enter https://api.arcjet.com/mcp as the server URL.
  4. Select OAuth for authentication.
  5. Click Create.

OAuth authentication happens automatically on first connection — a browser window will open for the user to sign in.

See the MCP server docs for the full tool reference.

Use the MCP tools to retrieve your site key:

  1. Call list-teams to get available teams.
  2. Call list-sites with the team ID to find the site (or call create-site to create a new one).
  3. Call get-site-key with the site ID to retrieve the ARCJET_KEY.

Set the key in the project environment:

# .env.local (Next.js, Astro) or .env (other frameworks)
ARCJET_KEY=ajkey_yourkey
ARCJET_ENV=development

If the user doesn’t have an Arcjet account yet, direct them to app.arcjet.com to create one (free trial).

Detect the framework by checking the project files:

  • package.json — look for next, express, fastify, @nestjs/core, @sveltejs/kit, hono, @remix-run/node, react-router, astro, nuxt, or check if the runtime is Bun or Deno.
  • pyproject.toml / requirements.txt — look for fastapi or flask.

Then install the correct package:

FrameworkInstall command
Next.jsnpm i @arcjet/next
Expressnpm i @arcjet/node @arcjet/inspect
Node.jsnpm i @arcjet/node @arcjet/inspect
Node.js + Hononpm i @arcjet/node @arcjet/inspect
Fastifynpm i @arcjet/fastify
NestJSnpm i @arcjet/nest
SvelteKitnpm i @arcjet/sveltekit @arcjet/inspect
Remixnpm i @arcjet/remix @arcjet/inspect
React Routernpm i @arcjet/react-router @arcjet/inspect
Bunbun add @arcjet/bun @arcjet/inspect
Bun + Honobun add @arcjet/bun @arcjet/inspect
Denodeno add npm:@arcjet/deno npm:@arcjet/inspect
Nuxtnpx nuxt module add @arcjet/nuxt
Astronpx astro add @arcjet/astro
Python FastAPIpip install arcjet or uv add arcjet
Python Flaskpip install arcjet or uv add arcjet

Add Arcjet rules to protect the application. See the llms.txt file for complete, copy-paste code examples for every framework, including the rule parameter reference and decision API.

The typical setup is:

  1. Create an Arcjet client instance once, outside request handlers.
  2. Configure rules: shield (WAF), detectBot, rate limiting (tokenBucket, fixedWindow, or slidingWindow), and optionally sensitiveInfo or detectPromptInjection for AI apps.
  3. Call protect() inside each route handler and check decision.isDenied().
App typeRules
AI / LLM chatshield + detectBot + tokenBucket + sensitiveInfo + detectPromptInjection
Public APIshield + detectBot + fixedWindow or tokenBucket
Signup / login formshield + detectBot + validateEmail + slidingWindow
Internal / admin routeshield + filter (country/VPN blocking)
Any web appshield + detectBot (good baseline)

After adding protection and starting the app:

  1. Send a test request to a protected route.
  2. Use the MCP list-requests tool to confirm requests are flowing to Arcjet.
  3. Use get-request-details or explain-decision to inspect individual decisions.
  4. Use analyze-traffic for a dashboard-level overview of request patterns.
  5. Check the Arcjet dashboard for real-time request monitoring.

If requests are not appearing, verify that ARCJET_KEY and ARCJET_ENV are set correctly and that protect() is being called in the route handler.

These prompts work well when given to an AI coding agent with the Arcjet plugin installed or MCP server connected:

  • “Protect my API routes with Arcjet” — adds shield, bot detection, and rate limiting to all API routes.
  • “Add rate limiting to my app” — adds a token bucket or fixed window rate limit.
  • “Set up bot protection” — blocks automated clients while allowing search engines.
  • “Add prompt injection detection to my AI chat endpoint” — adds detectPromptInjection with message scanning.
  • “Block sensitive data from reaching my LLM” — adds sensitiveInfo (JS) or detect_sensitive_info (Python) to scan for PII.
  • “Set up Arcjet security for my app” — full end-to-end setup with shield, bot detection, and rate limiting.
  • “Give me a security briefing for my site” — calls get-security-briefing to return traffic analysis, threat landscape, anomalies, and recommendations.
  • “Investigate this suspicious IP address” — calls investigate-ip for geo, threat intelligence, and request activity.
  • “What would happen if I promote my dry-run rules to live?” — calls get-dry-run-impact to show blocked requests, affected IPs, and false-positive risk.
  • Quick start guide — framework-specific setup with full code examples
  • Arcjet Plugin — plugin for Claude Code and Cursor with automatic security guidance
  • llms.txt — machine-readable reference with all framework examples, rule parameters, and decision API
  • MCP server — full MCP tool reference and client setup
  • Best practices — recommended patterns and anti-patterns