postgrestRequest returns PostgREST error responses as successful results

Open Beginner friendly
#540 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@irisfield is already working on this.

Since Nov 10, 2026.

  • #541 by @irisfield — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, typescript
Domain
api, backend

Research direction

Find the postgrestRequest implementation in the mcp-server-postgrest package and read how it handles the HTTP response and constructs the tool result. Check the existing tests for that request, or add coverage for an error status if none is mentioned in the issue. Done means non-success responses return isError: true and include the status code and response body.

Written by the indexing model from the issue text.

Description

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

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

  1. 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
    
  2. Call postgrestRequest with { "method": "GET", "path": "/no_such_table?select=*" }.

  3. 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"}}
    
  4. 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)"}}
    
  5. 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.

System information

  • OS: Ubuntu (WSL2)
  • Browser: N/A
  • Version of @supabase/mcp-server-postgrest: 0.2.0
  • Version of Node.js: 24.15.0
Dominant language
TypeScript
Stars
3k
Forks
432
Avg merge
1d 7h
Merged PRs (30d)
52

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from supabase/mcp

All issues in supabase/mcp

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.