netlify-server

netlify-server is a cursor rule for Cursor from netlify/context-and-tools. It costs 182 tokens per session (4,624 once invoked), scanned E, original, MIT.

Instructions for running a long-lived Node.js web backend on Netlify Server. A backend is the part of a web application that handles requests, APIs, and server-side work.

In plain words
What is it for?
Use it when deploying Express, Fastify, Hono, Koa, or another Node.js backend and REST or GraphQL API on Netlify Server.
Why use it?
It explains the required Node.js and Netlify CLI versions, supported application patterns, and deployment constraints. This helps avoid using the service in an incompatible way.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it when deploying Express, Fastify, Hono, Koa, or another Node.js backend and REST or GraphQL API on Netlify Server.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/netlify/context-and-tools/netlify-server
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/netlify/context-and-tools

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for netlify-server

README.md
[![agentmods](https://agentmods.dev/badge/rules/netlify/context-and-tools/netlify-server/github.svg)](https://agentmods.dev/rules/netlify/context-and-tools/netlify-server)
Your own site
<a href="https://agentmods.dev/rules/netlify/context-and-tools/netlify-server"><img src="https://agentmods.dev/badge/rules/netlify/context-and-tools/netlify-server/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for netlify-server

Your own site · 80×15
<a href="https://agentmods.dev/rules/netlify/context-and-tools/netlify-server"><img src="https://agentmods.dev/badge/rules/netlify/context-and-tools/netlify-server.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 182 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,624 The whole file, excluding the scripts and references it only reads on demand.
Security scan E 3 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00182 $0.04624
Opus 5.5 $0.00073 $0.01850
Sonnet 5.5 $0.00036 $0.00925
Haiku 4.5 $0.00018 $0.00462

Measured 20d ago against content hash a6621ca6ae1c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade E, and why

netlify-server scanned grade E with 3 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 20d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Hidden instructionshighPrompt injection

Directives inside HTML comments, invisible characters or bidirectional overrides are read by the model and not by the person reviewing the file.

<!-- system: agent-context/server/system.md — human-owned, merged by ctx-gen; edit system.md, not this section -->

Cloud metadata endpointhighServer-side request forgery

One request to 169.254.169.254 can return temporary IAM credentials.

(including 169.254.169.254), re-check after every redirect, and return only

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

| Object with `fetch` (Fetchable, e.g. Hono) | `fetch(request, context)` | `upgradeWebSocket` |
cursor/rules/netlify-server.mdc · 365 lines

How it starts

The opening of the file, as written. The whole thing — 365 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Netlify Server

Early Access, so APIs may change. It is available on credit-based plans and on Enterprise plans with credits enabled. It requires Node.js 24+ for both build and local dev, and Netlify CLI 27.17.0+ for both local dev and deploys.

It is free during Early Access and intended for evaluation, experimentation, and low-volume production use. At GA it will bill credits for reserved memory (GB-hours) and active CPU (vCPU-hours). Every request the server handles already counts toward the web requests meter.

Reach for this / avoid this

// ✅ netlify/server/index.ts — handler (same signature as Netlify Functions)
import type { Context, Config } from "@netlify/server";
export default async (req: Request, context: Context) =>
  new Response(`Hello from ${context.geo.city ?? "somewhere"}`);
export const config: Config = { path: "/api/*" };
// ✅ Fetchable app (Hono etc.): export as is
export default app;
// ✅ Node request listener: wrap it, do NOT call listen(). WebSockets work.
export default createServer(handleRequest);
// ✅ Framework that starts itself (Express/Fastify): listen on PORT within 10 s
app.listen(process.env.PORT);
// ❌ export default (req, res) => {...}   // two params = treated as a fetch handler, breaks
// ❌ export default expressApp            // works, but WebSocket upgrades get 501
// ❌ server.close(() => process.exit(0))  // cuts off shutdown hooks and background work
// ❌ setInterval / fire-and-forget promise // invisible to Netlify; the instance can stop mid-work

You don't configure ports, add health endpoints, or install adapters. Install the package with npm install @netlify/server.

Entry file and detection

  • Use one server per project: netlify/server/index.ts, .mts, .js, or .mjs. The build fails if more than one exists.
  • Startup runs once per instance:
    1. PORT is set.
    2. The entry file is imported, running top-level code (top-level await is awaited).
    3. onStart hooks run in order.
    4. The default export is inspected.
  • No traffic arrives until all steps finish. Any throw fails the start.

Read the full file on GitHub · 365 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 20d ago First seen · 365 lines · 182 tokens per session scan E a6621ca6ae1c

Subscribe to this mod's changes

netlify-server is a cursor rule published in the GitHub repository netlify/context-and-tools (58 stars, last pushed 4d ago), licensed MIT. It adds 182 tokens to every session and 4,624 once invoked, about $0.0007 per session on Opus 5.5. A static security scan graded it E with 3 findings (hidden instructions, cloud metadata endpoint, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-11.

Related

netlify-server compared with cursor rules from other repositories

netlify-server next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
netlify-servernetlify/context-and-toolsCursor rule584d agoMITE182Cursor
cloudflare-email-telegram-cursorrules-prompt-filePatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A720Cursor
implement-graceful-shutdown-for-your-applicationPaulJPhilp/EffectPatternsCursor rule8075mo agoMITA702Cursor
service-bindingslouisbrulenaudet/monorepo-templateCursor rule198d agoApache-2.0A775Cursor
hatch3r-scalabilityhatch3r/hatch3rCursor rule262mo agoMITA0Cursor
cloudflare-workers-hono-angular-saas-cursorrules-prompt-fileXD3an/awesome-ai-coding-all-in-oneCursor rule143d agononeA1,335Cursor
knative-istio-typesense-gpu-cursorrules-prompt-filXD3an/awesome-ai-coding-all-in-oneCursor rule143d agononeA613Cursor