Add request timeouts to Supermemory MCP client calls#1142
Draft
Dhravya wants to merge 2 commits into
Draft
Conversation
- Pass explicit timeout: 30_000 to the Supermemory SDK constructor so all
SDK-backed calls (search, add, forget, profile) are bounded to 30 seconds
- Add AbortSignal.timeout(FETCH_TIMEOUT_MS) to the manual fetch calls in
getProjects() and getDocuments() which had no timeout before
- Accept an optional { signal?: AbortSignal } argument on both methods so
callers can thread a request-scoped signal when one is available
- Catch AbortError / TimeoutError in handleError() and surface a friendly
'Request to Supermemory API timed out' message instead of an opaque crash
- Follow existing codebase convention (FETCH_TIMEOUT_MS constant, same value
used in apps/api/src/services/extraction/extractors/image.ts)
Co-authored-by: Dhravya Shah <dhravya@supermemory.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-mcp | 3693fdb | Jun 20 2026, 01:16 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-app | 3693fdb | Commit Preview URL Branch Preview URL |
Jun 20 2026, 01:17 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Outbound requests from the
supermemory-mcpDurable Object toapi.supermemory.aihad no client-side timeout, causing stalls of up to ~318 seconds when downstream services (Turbopuffer, Gemini) were slow. Two separate code paths were affected:search,add,forget,profile) — theSupermemorySDK client was constructed without atimeoutoption, so it defaulted to 60 seconds or whatever the underlying runtime allows.fetchcalls (getProjects,getDocuments) — these had nosignalorAbortSignalat all, meaning they could stall indefinitely.Changes (
apps/mcp/src/client.ts)FETCH_TIMEOUT_MS = 30_000— new constant following the existing pattern inapps/api/src/services/extraction/extractors/image.ts.timeout: FETCH_TIMEOUT_MSso all SDK-backed calls are bounded to 30 seconds.getProjects(options?: { signal?: AbortSignal })— thread anAbortSignalinto the fetch; defaults toAbortSignal.timeout(30_000)when no caller-supplied signal is present.getDocuments(containerTags?, page?, limit?, options?: { signal?: AbortSignal })— same pattern.handleError— new guard catchesAbortError/TimeoutErrorand surfaces a friendly"Request to Supermemory API timed out"message instead of an opaque crash, consistent with existing friendly error messages.Assumptions
server.tsdo not currently have an easy per-requestAbortSignalfrom theMcpAgent/ExecutionContext, so theoptionsparameter is left as an extension point for future use; all existing call sites pick up the default 30-second timeout automatically.@supermemory/tools,@supermemory/ai-sdk) are not caused by this change — the MCP package itself has no new type errors.