Stateful Simulation Alpha
Exercise deterministic multi-step outage and auth-expiry flows.
Stateful Simulation (Alpha)
Run deterministic multi-step failure flows with session continuity.
Why this exists
Real incidents are often stateful: auth degrades over time, outage behavior ramps, and retries change outcomes. Stateless tests miss this.
When to use this vs DIY script
Use FakeMCP stateful simulation when you need profile-based transitions that are reusable in CI and demos. Use DIY scripts when you only need a one-off local state machine.
Endpoint
POST /v1/scenario/stateful
Profiles in alpha
token_expiry_after_n_callspartial_outage_ramp
Example: token expiry after N calls
export BASE_URL="https://fakemcp.com"
first="$(curl -sS -X POST "$BASE_URL/v1/scenario/stateful" \
-H "Content-Type: application/json" \
-d '{
"profile": "token_expiry_after_n_calls",
"params": { "expireAfterCalls": 2 }
}')"
session_id="$(node -e 'const b=JSON.parse(process.argv[1]); process.stdout.write(b.sessionId)' "$first")"
curl -sS -X POST "$BASE_URL/v1/scenario/stateful" \
-H "Content-Type: application/json" \
-d "{
\"profile\": \"token_expiry_after_n_calls\",
\"sessionId\": \"${session_id}\",
\"params\": { \"expireAfterCalls\": 2 }
}"
Example: partial outage ramp
curl -sS -X POST "$BASE_URL/v1/scenario/stateful" \
-H "Content-Type: application/json" \
-d '{
"profile": "partial_outage_ramp"
}'
Repeat with returned sessionId to observe deterministic state transitions.