Description
All MCP read tools in mcp/tools/read-tools.ts call fetchAllProductsFromDb(), fetchAllProfilesFromDb(), fetchCachedEvents(), validateDiscountCode(), and raw dbPool.query() with no timeout guard at the MCP layer. If the database is slow, overloaded, or unreachable, every one of these tool calls will hang indefinitely — blocking the MCP server and the AI agent waiting on a response.
Current Behavior
The following DB calls across 7 registered tools have no timeout:
| Tool |
Call |
Line |
search_products |
fetchAllProductsFromDb() |
231 |
get_product_details |
fetchAllProductsFromDb() |
315 |
list_companies |
fetchAllProfilesFromDb() |
375 |
get_company_details |
Promise.all([fetchAllProfilesFromDb(), fetchAllProductsFromDb(), fetchCachedEvents(31555)]) |
423 |
get_reviews |
fetchCachedEvents(31555) |
570 |
check_discount_code |
validateDiscountCode() |
623 |
get_storefront |
dbPool.query() × 2, Promise.all([fetchAllProfilesFromDb(), fetchAllProductsFromDb()]) |
689, 713, 765 |
A slow or hung DB connection causes the tool to wait forever with no error returned to the caller.
Expected Behavior
Each DB fetch in the MCP layer should be wrapped with a timeout (e.g. 10–30 seconds). If the deadline is exceeded, the tool should return a structured error response:
json
{
"error": "DB fetch timed out",
"code": "TIMEOUT",
"_meta": {
"responseTimeMs": 10000,
"dataSource": "cached_db"
}
}
This keeps the MCP server responsive and gives the AI agent a clear signal to retry or fall back.
Steps to Reproduce
- Simulate a slow DB by throttling the database connection or making fetchAllProductsFromDb() delay artificially (e.g. await new Promise(r => setTimeout(r, 60000))).
- Call any of the affected MCP tools: search_products, get_product_details, list_companies, get_company_details, get_reviews, check_discount_code, or get_storefront.
- Observe that the tool call never resolves — no timeout error, no response, no feedback.
Next.js Version
16.2.3
Operating System
macOS
Node.js Version
20.7.0
Browser
Chrome
Screenshots
No response
Additional Context
No response
Code of Conduct
Description
All MCP read tools in
mcp/tools/read-tools.tscallfetchAllProductsFromDb(),fetchAllProfilesFromDb(),fetchCachedEvents(),validateDiscountCode(), and rawdbPool.query()with no timeout guard at the MCP layer. If the database is slow, overloaded, or unreachable, every one of these tool calls will hang indefinitely — blocking the MCP server and the AI agent waiting on a response.Current Behavior
The following DB calls across 7 registered tools have no timeout:
search_productsfetchAllProductsFromDb()get_product_detailsfetchAllProductsFromDb()list_companiesfetchAllProfilesFromDb()get_company_detailsPromise.all([fetchAllProfilesFromDb(), fetchAllProductsFromDb(), fetchCachedEvents(31555)])get_reviewsfetchCachedEvents(31555)check_discount_codevalidateDiscountCode()get_storefrontdbPool.query()× 2,Promise.all([fetchAllProfilesFromDb(), fetchAllProductsFromDb()])A slow or hung DB connection causes the tool to wait forever with no error returned to the caller.
Expected Behavior
Each DB fetch in the MCP layer should be wrapped with a timeout (e.g. 10–30 seconds). If the deadline is exceeded, the tool should return a structured error response:
json
{
"error": "DB fetch timed out",
"code": "TIMEOUT",
"_meta": {
"responseTimeMs": 10000,
"dataSource": "cached_db"
}
}
This keeps the MCP server responsive and gives the AI agent a clear signal to retry or fall back.
Steps to Reproduce
Next.js Version
16.2.3
Operating System
macOS
Node.js Version
20.7.0
Browser
Chrome
Screenshots
No response
Additional Context
No response
Code of Conduct