You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
postgrestRequest returns PostgREST error responses as successful results #540
When PostgREST answers a postgrestRequest call with an error status, the tool returns the error body as a normal result and isError is not set. A request for a table that does not exist, or with a malformed filter, looks like a successful call.
To Reproduce
Run mcp-server-postgrest against a Supabase project's REST API:
mcp-server-postgrest --apiUrl https://<project-ref>.supabase.co/rest/v1 --apiKey <publishable key> --schema public
Call postgrestRequest with { "method": "GET", "path": "/no_such_table?select=*" }.
The call returns isError: false and:
{"result":{"code":"PGRST205","details":null,"hint":null,"message":"Could not find the table 'public.no_such_table' in the schema cache"}}
Call it with { "method": "GET", "path": "/no_such_table?select=*&bad=" }. This also returns isError: false:
{"result":{"code":"PGRST100","details":"unexpected end of input expecting \"not\" or operator (eq, gt, ...)","hint":null,"message":"\"failed to parse filter ()\" (line 1, column 1)"}}
Start the server with an invalid --apiKey and call it with { "method": "GET", "path": "/" }. This also returns isError: false:
{"result":{"message":"Invalid API key","hint":"Double check your Supabase `anon` or `service_role` API key."}}
Expected behavior
A response with an error status is returned as an error (isError: true) that includes the status code and the response body, so the caller can tell the request failed.
Activity
fix(postgrest): report HTTP error responses as tool errors
fix(postgrest): report HTTP error responses as tool errors (supabase#541