MCP-PostgreSQL-Ops icon indicating copy to clipboard operation
MCP-PostgreSQL-Ops copied to clipboard

[BUG] timeout and PRM fetch issues with hosted version

Open clgtm opened this issue 9 months ago β€’ 3 comments

Bug Description

Steps to Reproduce

Command: authprobe scan --explain --trace-failure https://gitmcp.io/call518/MCP-PostgreSQL-Ops

Scanning: https://gitmcp.io/call518/MCP-PostgreSQL-Ops

Scan time: Feb 12, 2026 06:17:50 UTC

Github: https://github.com/authprobe/authprobe

Expected Behavior

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ LLM EXPLANATION β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” The AuthProbe scan found critical failures related to MCP initialization and OAuth protection metadata retrieval for the target server at https://gitmcp.io/call518/MCP-PostgreSQL-Ops, which indicate non-compliance with MCP and OAuth-related specifications. Below is a detailed analysis referencing the relevant specs.


Summary of Failures

  • [2] MCP initialize + tools/list:
    Failure due to a timeout when sending the MCP initialize JSON-RPC request. The client did not receive a timely JSON-RPC response.

    • Error: context deadline exceeded (Client.Timeout or context cancellation while reading body)
    • Expected: The MCP server MUST accept and respond to the initialize JSON-RPC request with a valid JSON response (per MCP 2025-11-25).
  • [3] PRM fetch matrix:
    The endpoint /.well-known/oauth-protected-resource/call518/MCP-PostgreSQL-Ops returns HTTP 200 but the scan reports that the PRM (Protected Resource Metadata) is unreachable or unusable, meaning OAuth discovery metadata is missing or malformed.

    • The /.well-known/oauth-protected-resource is accessible but the specific resource path does not yield usable OAuth discovery metadata.
    • OAuth 2.0 Resource Server Metadata (RFC 8414) appear to be not usable or missing.

Spec-Grounded Explanation

1. MCP Initialization Failure (Step 2)

  • Spec References:

    • MCP 2025-11-25 (MCP core spec) requires that an MCP server:
      • Accept the JSON-RPC 2.0 initialize method call upon connection initiation, as per the MCP protocol.
      • Return a valid JSON-RPC 2.0 response within a reasonable timeout.
    • JSON-RPC 2.0 defines the message format and requires servers to reply with a JSON object with id, jsonrpc: "2.0" and either result or error.
  • Expected Behavior:
    The MCP server must listen on the endpoint and successfully parse and respond to the initialize method call as a JSON-RPC 2.0 request. This response initializes the protocol conversation, indicating supported capabilities and server state.

  • Why Failure is Valid and Justified:
    The fact that the client timed out waiting for the JSON-RPC response means the server either did not:

    • Listen/accept on the expected endpoint, or
    • Process the initialize request properly, or
    • Respond with a valid JSON-RPC 2.0 reply within the timeout window.

    This constitutes a critical failure because MCP clients rely on this initialize handshake to proceed.

  • Implications for the Server:
    The server is currently not MCP-compliant for basic initialization handling. This should be corrected by ensuring that the MCP JSON-RPC endpoint:

    • Accepts the initialize method,
    • Returns a valid JSON-RPC 2.0 response within the allowed time,
    • Implements the MCP protocol state machine correctly.

2. PRM Fetch Matrix Failure (Step 3)

  • Spec References:
    • RFC 8414 (OAuth 2.0 Authorization Server Metadata) and **RFC 9728 (OAuth 2.0 Protected Resource Metadata

Actual Behavior

Funnel
  [1] MCP probe (401 + WWW-Authenticate)      [-] SKIP
        auth not required

  [2] MCP initialize + tools/list             [X] FAIL
        initialize error: context deadline exceeded (Client.Timeout or context
        cancellation while reading body)

  [3] PRM fetch matrix                        [X] FAIL
        https://gitmcp.io/.well-known/oauth-protected-resource -> 200
        https://gitmcp.io/.well-known/oauth-protected-resource/call518/MCP-PostgreSQL-Ops
        -> 200
        PRM unreachable or unusable; OAuth discovery unavailable

  [4] Auth server metadata                    [-] SKIP
        auth not required

  [5] Token endpoint readiness (heuristics)   [-] SKIP
        auth not required

  [6] Dynamic client registration (RFC 7591)  [-] SKIP
        auth not required

Primary Finding (HIGH): MCP_INITIALIZE_FAILED (confidence 1.00)
  Evidence:
      initialize error: context deadline exceeded (Client.Timeout or context cancellation while
      reading body)
      MCP servers should accept the initialize JSON-RPC request and return a valid JSON response
      per the MCP specification.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ RFC RATIONALE β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
Explain (RFC 9728 rationale)
1) MCP probe
- AuthProbe did not receive a 401 response that indicates authentication is required, so RFC 9728 PRM discovery is skipped.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ CALL TRACE β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
Call Trace Using: https://github.com/authprobe/authprobe

  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    
  β”‚ authprobe  β”‚                                                    β”‚ MCP Server β”‚    
  β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜                                                    β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜    
        β”‚                                                                 β”‚           
        β”‚ ╔═══ Step 1: MCP probe                    ═══════β•ͺ═══════════════════╗
        β”‚  GET https://gitmcp.io/call518/MCP-PostgreSQL-Ops              
        β”‚  Reason: 401 + WWW-Authenticate discovery                      
        β”‚    Accept:  text/event-stream
        β”‚    Host:    gitmcp.io
        β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Ίβ”‚
        β”‚  200 OK                                                        
        β”‚    Access-Control-Allow-Headers:   Content-Type, mcp-session-id
        β”‚    Access-Control-Allow-Methods:   GET, POST, OPTIONS
        β”‚    Access-Control-Allow-Origin:    *
        β”‚    Access-Control-Expose-Headers:  mcp-session-id
        β”‚    Access-Control-Max-Age:         86400
        β”‚    Alt-Svc:                        h3=":443"; ma=86400
        β”‚    Cache-Control:                  no-cache
        β”‚    Cf-Ray:                         9cc9f6842f9c2083-SJC
        β”‚    Content-Type:                   text/event-stream
        β”‚    Date:                           Thu, 12 Feb 2026 06:17:27 GMT
        β”‚    Server:                         cloudflare
        β”‚    Speculation-Rules:              "/cdn-cgi/speculation"
        β”‚    Vary:                           Accept-Encoding
        │◄──────────────────────────────────────────────────────────────────
        β”‚                                                                  β”‚
        β”‚ ╔═══ Step 2: MCP initialize               ═══════β•ͺ═══════════════════╗
        β”‚  POST https://gitmcp.io/call518/MCP-PostgreSQL-Ops             
        β”‚  Reason: Step 2: MCP initialize + tools/list (pre-init tools/list)
        β”‚    Accept:                application/json, text/event-stream
        β”‚    Content-Type:          application/json
        β”‚    Host:                  gitmcp.io
        β”‚    Mcp-Protocol-Version:  2025-11-25
        β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Ίβ”‚
        β”‚  400 Bad Request                                               
        β”‚    Alt-Svc:         h3=":443"; ma=86400
        β”‚    Cf-Ray:          9cc9f6b60a332083-SJC
        β”‚    Content-Length:  110
        β”‚    Content-Type:    text/plain;charset=UTF-8
        β”‚    Date:            Thu, 12 Feb 2026 06:17:34 GMT
        β”‚    Server:          cloudflare
        β”‚    Vary:            Accept-Encoding
        │◄──────────────────────────────────────────────────────────────────
        β”‚                                                                  β”‚
        β”‚ ╔═══ Step 3: PRM Discovery                ═══════β•ͺ═══════════════════╗
        β”‚  GET https://gitmcp.io/.well-known/oauth-protected-resource    
        β”‚  Reason: Step 3: PRM fetch matrix                              
        β”‚    Accept:  application/json
        β”‚    Host:    gitmcp.io
        β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Ίβ”‚
        β”‚  200 OK                                                        
        β”‚    Alt-Svc:            h3=":443"; ma=86400
        β”‚    Cf-Ray:             9cc9f71a38e62083-SJC
        β”‚    Content-Type:       text/html
        β”‚    Date:               Thu, 12 Feb 2026 06:17:50 GMT
        β”‚    Server:             cloudflare
        β”‚    Speculation-Rules:  "/cdn-cgi/speculation"
        β”‚    Vary:               Accept-Encoding
        │◄──────────────────────────────────────────────────────────────────
        β”‚                                                                  β”‚
        β”‚  GET https://gitmcp.io/.well-known/oauth-protected-resource/call518/MCP-PostgreSQL-Ops
        β”‚  Reason: Step 3: PRM fetch matrix                              
        β”‚    Accept:  application/json
        β”‚    Host:    gitmcp.io
        β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Ίβ”‚
        β”‚  200 OK                                                        
        β”‚    Alt-Svc:            h3=":443"; ma=86400
        β”‚    Cf-Ray:             9cc9f71a69752083-SJC
        β”‚    Content-Type:       text/html
        β”‚    Date:               Thu, 12 Feb 2026 06:17:50 GMT
        β”‚    Server:             cloudflare
        β”‚    Speculation-Rules:  "/cdn-cgi/speculation"
        β”‚    Vary:               Accept-Encoding
        │◄──────────────────────────────────────────────────────────────────
        β–Ό                                                                  β–Ό

Environment Details

PostgreSQL Environment

  • PostgreSQL Version:
  • Extensions Installed:
    • [ ] pg_stat_statements
    • [ ] pg_stat_monitor
    • [ ] Other: ___
  • Environment Type:
    • [ ] Self-managed PostgreSQL
    • [ ] Docker container
    • [ ] AWS RDS
    • [ ] AWS Aurora
    • [ ] Google Cloud SQL
    • [ ] Azure Database
    • [ ] Other: ___
  • User Permissions:
    • [ ] Superuser
    • [ ] Regular user with pg_read_all_stats
    • [ ] Regular user without special permissions
    • [ ] Other: ___

MCP Server Environment

  • Installation Method:
    • [ ] PyPI (uvx)
    • [ ] Local source
    • [ ] Docker
  • Python Version:
  • MCP Server Version:
  • Client Used:
    • [ ] Claude Desktop
    • [ ] Open WebUI
    • [ ] MCP Inspector
    • [ ] Other: ___

Error Messages

[Paste error messages here]

Configuration

{
  "env": {
    "POSTGRES_HOST": "localhost",
    "POSTGRES_PORT": "5432",
    "POSTGRES_DB": "your_db"
  }
}

Additional Context

  • Does this affect all tools or specific ones?
  • When did this start happening?
  • Any recent changes to your environment?

Screenshots

clgtm avatar Feb 12 '26 19:02 clgtm

Hi @clgtm β€” thank you for the detailed report.

Conclusion

For issue #17 ([BUG] timeout and PRM fetch issues with hosted version), the primary failures appear to be related to the gitmcp.io hosted/proxy layer, rather than this repository’s server runtime itself.


What we verified

1) MCP initialize failure (timeout / 400)

  • The reported target is https://gitmcp.io/call518/MCP-PostgreSQL-Ops.
  • That endpoint is served through a third-party wrapping/hosting layer (gitmcp.io), not a directly self-hosted process from this repo.
  • The initialize failure pattern (400 + timeout behavior) is therefore most consistent with upstream hosted endpoint/protocol handling.

2) PRM (/.well-known/oauth-protected-resource) failure

  • The scan shows HTTP 200 responses with Content-Type: text/html.
  • That indicates non-JSON PRM discovery responses at the hosted layer, which aligns with infrastructure behavior outside this codebase.

Improvements made on this project side

During triage, we also reviewed and improved auth/runtime consistency in this repo:

  • Unified REMOTE_AUTH_ENABLE boolean parsing (true/1/yes/on)
  • Removed non-standard token metadata fields (user, description)
  • Moved auth application to runtime (main) instead of import-time lock-in
  • Clarified CLI precedence with:
    • --auth-enable
    • --auth-disable (new)
  • Adjusted --type default behavior so FASTMCP_TYPE env is respected as intended

Local streamable-http validation now behaves as expected:

  • Auth OFF: unauthenticated request β†’ 200
  • Auth ON: unauthenticated request β†’ 401, valid bearer token β†’ 200

call518 avatar Feb 25 '26 21:02 call518

Hi @clgtm β€” thanks again for the report and for sharing a fresh AuthProbe run.

Re-check Result (latest scan vs original #17)

We compared your latest output with the original report in #17.

What improved

  • PRM step changed from FAIL β†’ SKIP
    • Original: PRM fetch matrix [X] FAIL
    • Latest: PRM fetch matrix [-] SKIP with PRM not required for public/no-auth MCP servers
  • So the OAuth/PRM path is no longer treated as a hard failure in the current scan outcome.

What is still failing

  • Step 2 (MCP initialize + tools/list) still fails
    • context deadline exceeded
    • Trace now clearly shows: Bad Request: Mcp-Session-Id header is required

This indicates the endpoint being scanned (https://gitmcp.io/call518/MCP-PostgreSQL-Ops) is enforcing/requesting session behavior that does not match AuthProbe’s pre-init request flow in this path.

Project-side status

On this repository side, we already improved auth/runtime consistency:

  • unified REMOTE_AUTH_ENABLE parsing
  • removed non-standard token metadata fields
  • moved auth application to runtime (main) instead of import-time lock-in
  • added explicit --auth-disable to make CLI override behavior symmetric
  • corrected transport precedence behavior (FASTMCP_TYPE env handling)

Local direct validation confirms expected behavior:

  • auth enabled: no token β†’ 401, valid token β†’ 200 initialize
  • auth disabled: request proceeds without token

Current conclusion

Issue #17 is partially improved but not fully resolved from scanner perspective:

  • βœ… PRM-related failure severity reduced (now skipped)
  • ❌ Initialize/tools-list still fails at the gitmcp.io hosted endpoint path

Given the evidence (Mcp-Session-Id header is required on pre-init flow), the remaining blocker appears to be in the hosted/wrapping layer behavior for that endpoint, not a direct reproducible failure in local self-hosted runtime of this repo.

We should keep this issue open for now as β€œpartially improved, pending hosted endpoint compatibility”.

call518 avatar Feb 25 '26 21:02 call518

Hi @clgtm, thank you for the report and for the follow-up scan results.

We re-validated this issue carefully against the latest project code and compared results with direct local runtime behavior.

Summary

  • The remaining failure is still at the hosted endpoint path:
    • https://gitmcp.io/call518/MCP-PostgreSQL-Ops
    • Step 2 fails with:
      • context deadline exceeded
      • Bad Request: Mcp-Session-Id header is required
  • This points to behavior in the hosted/wrapping layer for that endpoint flow, not a reproducible defect in this repository’s direct runtime.

What we improved in this repository

We also shipped auth/runtime consistency fixes during this triage:

  • unified REMOTE_AUTH_ENABLE parsing
  • removed non-standard token metadata fields
  • moved auth application to runtime (main) instead of import-time lock-in
  • added explicit --auth-disable for symmetric CLI override
  • corrected transport precedence so env/CLI behavior is consistent

Verification result (direct self-hosted runtime)

  • auth enabled:
    • no token β†’ 401
    • valid bearer token β†’ 200 initialize
  • auth disabled:
    • request proceeds without token as expected

Given the above, there is no remaining repository-local defect we can action further here.
The unresolved scanner signal appears specific to the gitmcp.io hosted endpoint behavior.

Closing this issue from the repository side.
If you can reproduce the same failure against a directly self-hosted instance of this project, please open a new issue with exact request/response traces and we will investigate immediately.Hi @clgtm, thank you for the report and for the follow-up scan results.

We re-validated this issue carefully against the latest project code and compared results with direct local runtime behavior.

Summary

  • The remaining failure is still at the hosted endpoint path:
    • https://gitmcp.io/call518/MCP-PostgreSQL-Ops
    • Step 2 fails with:
      • context deadline exceeded
      • Bad Request: Mcp-Session-Id header is required
  • This points to behavior in the hosted/wrapping layer for that endpoint flow, not a reproducible defect in this repository’s direct runtime.

What we improved in this repository

We also shipped auth/runtime consistency fixes during this triage:

  • unified REMOTE_AUTH_ENABLE parsing
  • removed non-standard token metadata fields
  • moved auth application to runtime (main) instead of import-time lock-in
  • added explicit --auth-disable for symmetric CLI override
  • corrected transport precedence so env/CLI behavior is consistent

Verification result (direct self-hosted runtime)

  • auth enabled:
    • no token β†’ 401
    • valid bearer token β†’ 200 initialize
  • auth disabled:
    • request proceeds without token as expected

Given the above, there is no remaining repository-local defect we can action further here.
The unresolved scanner signal appears specific to the gitmcp.io hosted endpoint behavior.

Closing this issue from the repository side.
If you can reproduce the same failure against a directly self-hosted instance of this project, please open a new issue with exact request/response traces and we will investigate immediately.

call518 avatar Feb 25 '26 21:02 call518