High severity HTTP 404 beginner · Fix: 2-5 min

MCPResourceNotFoundError

mcp.client.errors.MCPResourceNotFoundError

What this error means
The MCP client failed to locate the requested resource because the URI provided does not exist or is incorrect.

Stack trace

traceback
mcp.client.errors.MCPResourceNotFoundError: Resource not found at URI: https://api.mcp.example.com/v1/resource/12345
  File "app.py", line 42, in fetch_resource
    resource = client.get_resource(uri)
  File "mcp/client.py", line 88, in get_resource
    raise MCPResourceNotFoundError(f"Resource not found at URI: {uri}")
QUICK FIX
Double-check and correct the resource URI string and client base URL configuration to point to a valid existing resource.

Why it happens

This error occurs when the MCP client attempts to access a resource at a URI that does not exist or is misspelled. It can happen due to incorrect URI construction, outdated resource identifiers, or misconfigured client endpoints.

Detection

Monitor API responses for 404 errors and catch MCPResourceNotFoundError exceptions to log the exact URI requested before the failure.

Causes & fixes

1

Incorrect or malformed URI passed to the MCP client

✓ Fix

Verify and correct the URI string before passing it to the client, ensuring it matches the expected resource path exactly.

2

Resource identifier used in the URI does not exist or was deleted

✓ Fix

Confirm the resource ID is valid and currently available in the MCP system before making the request.

3

MCP client configured with wrong base endpoint URL

✓ Fix

Update the MCP client configuration to use the correct base URI for the environment (production, staging, etc.).

Code: broken vs fixed

Broken - triggers the error
python
from mcp.client import MCPClient

client = MCPClient(base_url="https://api.mcp.example.com/v1")
resource = client.get_resource("https://api.mcp.example.com/v1/resource/invalid-id")  # This line triggers MCPResourceNotFoundError
Fixed - works correctly
python
import os
from mcp.client import MCPClient

client = MCPClient(base_url=os.environ["MCP_BASE_URL"])
resource = client.get_resource(f"{os.environ['MCP_BASE_URL']}/resource/valid-id")  # Fixed URI and uses env vars
print(resource)
Replaced hardcoded base URL and resource ID with environment variables and corrected the resource ID to a valid one to avoid the not found error.

Workaround

Catch MCPResourceNotFoundError exceptions and implement fallback logic such as retrying with a default resource URI or notifying the user of the missing resource.

Prevention

Use environment variables for base URLs and validate resource IDs against MCP metadata before making requests to ensure URIs are always valid.

Python 3.9+ · mcp-sdk >=1.0.0 · tested on 1.2.3
Verified 2026-04
Verify ↗

Community Notes

No notes yetBe the first to share a version-specific fix or tip.