undici

The HTTP/1.1 client that powers Node.js's native fetch(). undici is the official Node.js HTTP client written from scratch for performance — no legacy http.ClientRequest overhead. Provides connection pooling, pipelining, WebSocket, and a fetch-compatible API. Used directly when maximum HTTP throughput is needed or when controlling connection pools explicitly in high-performance Node.js agents.

Evaluated Mar 06, 2026 (0d ago) v6.x
Homepage ↗ Repo ↗ Developer Tools http client node fetch http2 performance official streams pool
⚙ Agent Friendliness
64
/ 100
Can an agent use this?
🔒 Security
90
/ 100
Is it safe for agents?
⚡ Reliability
87
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
80
Error Messages
78
Auth Simplicity
95
Rate Limits
92

🔒 Security

TLS Enforcement
98
Auth Strength
88
Scope Granularity
85
Dep. Hygiene
95
Secret Handling
88

Official Node.js project with strong security review. TLS enforced. No third-party dependencies. Part of Node.js core security review process.

⚡ Reliability

Uptime/SLA
100
Version Stability
85
Breaking Changes
82
Error Recovery
80
AF Security Reliability

Best When

You need maximum HTTP throughput in Node.js with explicit connection pool control, or you want the same HTTP engine that powers Node.js native fetch.

Avoid When

You need ergonomic high-level features like automatic retries and pagination — use Got or axios instead.

Use Cases

  • Build high-throughput HTTP clients for agent data pipelines using undici's connection pool for parallel requests with shared connections
  • Use as the underlying HTTP transport in frameworks and libraries where raw performance matters more than high-level ergonomics
  • Implement mock interceptors for testing without network calls using undici's built-in MockAgent that intercepts at the pool level
  • Control HTTP connection pooling explicitly — set maxConcurrency, connections, and pipelining for fine-tuned agent HTTP behavior
  • Build WebSocket clients with undici's WebSocket class for agent real-time communication (undici WebSocket added in Node.js 21)

Not For

  • High-level HTTP client work — use Got, axios, or ky for retry logic, pagination helpers, and ergonomic request building
  • Older Node.js versions — undici requires Node.js 18+; use Got 11 or axios for Node.js 14/16
  • Browser-side code — undici is Node.js only; use native browser fetch for browser environments

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

No built-in auth — HTTP client only. Authentication passed via request headers.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

undici is open source, MIT licensed, and developed under the Node.js project.

Agent Metadata

Pagination
none
Idempotent
Partial
Retry Guidance
Not documented

Known Gotchas

  • undici Pool reuses connections aggressively — if a server closes connections unexpectedly, SocketError is thrown; implement retry logic for connection reset errors
  • Response body must be consumed or destroyed — failing to read response.body causes connection to stall and the pool to deadlock for pipelined requests
  • undici.fetch() is not identical to browser fetch — some edge cases in the Fetch spec are handled differently; test thoroughly if migrating from node-fetch
  • MockAgent intercepts at the Client level — set up interceptors before creating the Client, not after; order matters for mock matching
  • Timeouts in undici are body/connect/headers separately — bodyTimeout default is 300s which may be too long for agent pipelines with streaming responses
  • Connection pool maxConcurrency defaults to unlimited — set explicit limits to prevent overwhelming target servers in agent batch processing scenarios

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for undici.

$99

Scores are editorial opinions as of 2026-03-06.

5215
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered