MCP 404 Errors: Debugging Guide with BetterStack Monitoring
MCP 404 errors from wrong URLs, renamed tools, or stale caches. Systematic debugging checklist and uptime monitoring setup.
MCP 404 errors mean your agent called a tool endpoint that does not exist. The three most common causes: wrong server URL in your MCP config, the server removed or renamed a tool, or your client is sending requests to a stale endpoint. Here is how to debug each one systematically.
Cause 1: Wrong Server URL
The most common 404 is a misconfigured server URL. MCP clients connect to a server endpoint and discover available tools. If the URL is wrong, the connection itself may succeed (HTTP 200 on the base URL) but tool calls return 404 because the tool discovery path is incorrect.
{
"mcpServers": {
"search": {
"url": "https://mcp.scavio.dev/mcp",
"headers": {
"x-api-key": "your-api-key"
}
}
}
}Verify the exact URL with the MCP server provider. Common mistakes: missing /mcp suffix, using /api/v1 instead of /mcp, or using http instead of https.
Cause 2: Tool Renamed or Removed
MCP servers can update their tool schemas at any time. If a server renames "web_search" to "search" and your agent config still references "web_search", you get a 404. Check the server's tool list to confirm current tool names.
import requests
# List available tools from an MCP server
def list_mcp_tools(server_url, api_key):
"""Fetch available tools to verify names."""
r = requests.post(
server_url,
headers={
"x-api-key": api_key,
"Content-Type": "application/json"
},
json={
"jsonrpc": "2.0",
"method": "tools/list",
"id": 1
},
timeout=10
)
tools = r.json().get("result", {}).get("tools", [])
for tool in tools:
print(f"Tool: {tool['name']}")
print(f" Description: {tool.get('description', 'N/A')}")
return tools
list_mcp_tools("https://mcp.scavio.dev/mcp", "your-key")Cause 3: Stale Client Cache
Some MCP clients cache tool schemas on first connection and do not re-fetch them. If the server updates and your client has a stale cache, tool calls fail with 404. Restart the client or clear its cache.
In Claude Desktop, restart the app. In Cursor, reload the window. In custom implementations, add a cache TTL to your tool discovery logic.
Setting Up BetterStack Monitoring
BetterStack (or any uptime monitor) should ping your MCP server's health endpoint every 60 seconds. When the server goes down, you get alerted before your agents start throwing 404s in production.
# BetterStack heartbeat check for MCP server
import requests, os
def mcp_health_check():
"""Check if MCP server is responding to tool discovery."""
try:
r = requests.post(
"https://mcp.scavio.dev/mcp",
headers={
"x-api-key": os.environ["SCAVIO_API_KEY"],
"Content-Type": "application/json"
},
json={
"jsonrpc": "2.0",
"method": "tools/list",
"id": 1
},
timeout=5
)
if r.status_code == 200 and "result" in r.json():
# Send heartbeat to BetterStack
requests.get(os.environ["BETTERSTACK_HEARTBEAT_URL"])
return True
except Exception as e:
print(f"MCP health check failed: {e}")
return False
mcp_health_check()Debugging Checklist
1. Verify server URL matches the provider's docs exactly. 2. List available tools and confirm the tool name your agent is calling exists. 3. Check if the server requires authentication headers. 4. Restart your MCP client to clear cached tool schemas. 5. Check server status page or uptime monitor. 6. If using a proxy or gateway, verify it is not stripping MCP-specific headers.
Common MCP 404 Error Messages
"Tool not found" means the server is up but the tool name is wrong. "404 Not Found" on the HTTP level means the server URL is wrong. "Connection refused" means the server is down entirely. Each requires a different fix -- do not conflate them.