Put a proof-of-work gate in front of HTTP endpoints you operate. Choose the protected requests and their difficulty. Each accepted challenge is consumed, so another acceptance requires fresh work.
Protect agent invocations, HTTP MCP requests, inference triggers or submission endpoints with Python FastAPI, WSGI or Node Express middleware. The reference uses SHA-256 work. The source preparation for 0.2.0 is merged; it is not yet a tagged or published package release.
Start with an endpoint you own. Keep upstream rate limits before Maxwell, then require authentication and permissions before the request reaches your agent or application.
Live request path
01Caller and client solver
02TLS, upstream filtering and rate limits
03Maxwell checks fresh work and consumes the challenge
04Authentication, permissions and input validation
05Your agent or application
Route every protected request through this boundary. A directly reachable origin or alternate path can bypass the gate.
01
Choose the expensive entry point.
Integrate FastAPI/Starlette ASGI middleware, WSGI middleware or Express middleware at the HTTP route that starts costly work. These integrations protect application requests; they do not install a network firewall or automatically cover WebSockets, stdio MCP connections or an agent’s internal tool calls.
02
Set a policy your callers can meet.
Generate a random signing secret of at least 32 bytes and keep it in your environment or secret manager. The default difficulty is fixed at 18. An optional rule can increase difficulty after failed proof submissions; adapting to traffic rate, server load or trusted identities requires your own integration. Legitimate callers also perform the work, so measure their delay before choosing a policy.
03
Connect the client and acceptance state.
The JavaScript client’s fetchWithMaxwell wrapper solves and retries a recognized challenge once. Other clients implement the documented challenge, solve and retry loop. One process can use the default in-memory store; multiple workers or hosts need shared Redis state without live-key eviction and with suitable persistence. Preserve that state across restarts, or rotate the signing secret if accepted-nonce state is lost.
04
Test replay, capacity and caller delay.
Confirm that the first valid solution reaches the application and a replay is refused. Monitor admitted traffic, rejection reasons, store health and legitimate-client completion. A full store rejects new acceptances; size it for peak accepted traffic and challenge lifetime. A consumed proof does not mean the application completed, so application retries need fresh work and their own idempotency policy.
Watch the caller search, the gate consume a challenge, and a replay stop before your agent. Play the sequence or inspect each step. This illustration does not send requests or compute real work.
Maxwell / illustrated reference flow
The caller does the work. Your agent stays behind the gate.
Watch challenge A travel out, its solution come back, and one request pass. Replaying A stops at Maxwell; challenge B needs fresh work.
Request
A request without a solution stops at Maxwell. It does not reach the protected agent or API.
Illustration only. This sequence does not contact a service or measure protection. Single-use enforcement needs shared state across workers. Callers who can afford the work can still pass; keep authentication and upstream rate limits.
Real computation · Local preview
Run a real challenge and replay check.
Your browser computes SHA-256 work, then sends the solution to a harmless endpoint in this preview. The server uses the pinned reference SDK to accept it once and refuse its replay.
Starts only when you choose Run.
Difficulty 12; expected search is 4,096 hash attempts under the documented model. Measurements are one run on this device and server, not a benchmark guarantee. This demonstration invokes no agent, tests no external target, and activates no protection for another system.
The real endpoint is disabled here. Follow the maintainer quickstart to run the SDK on your own machine.
Under the documented classical random-oracle model, a fresh solution takes an expected 2d hash attempts at difficulty d. Each additional bit doubles expected work. This is a search-work model; solve time and deployment cost depend on hardware and implementation.
Maintainer advantage
Fresh work for every acceptance.
At difficulty 20, the model gives approximately one million hash attempts per fresh solution on average. The server checks one candidate hash, authenticates the challenge and checks acceptance state. Single use prevents one solved challenge from buying repeated access during its lifetime.
Attackers who can afford the work can still submit requests. Maxwell does not classify their intent or guarantee that attacks become uneconomic. Upstream defenses must handle bandwidth floods; authentication, permissions, isolation and input validation remain responsible for what a solved request may do.
Default middleware uses an in-memory nonce store for one process. Multiple workers or hosts need a shared store, such as Redis, to preserve single-use acceptance across the deployment.
Low-level verification without a nonce store is stateless and replayable within the challenge TTL. A full store fails closed; plan capacity, monitor rejection counts, and apply upstream rate limits. These choices belong in your integration review.
The MCP catalog offers a paid Maxwell Defense Rehearsal: a policy recommendation, local SHA-256 microbenchmark and endpoint-trial checks. The service describes its price and input requirements.
A rehearsal does not activate managed protection or certify your system. It is separate from this free illustration and from an SDK deployment you operate.
The reference documents its computational protocol and tests. The separate T-IB-09 research model declares one external asymmetry axiom. Read the exact statements and artifacts before extending a claim to your application.
Bring the endpoint you operate, its traffic patterns, deployment shape and failure constraints. We can assess fit and integration requirements before you enable a gate.