Fix MCP Connector 500 api_error in Anthropic TypeScript SDK (June 2025)
Error message
MCP Connector 500 api_error June ~11 2025
This guide explains how to diagnose and resolve a 500 api_error that appears when using the MCP Connector feature in the Anthropic TypeScript SDK, specifically for errors that began occurring around June 10-11, 2025. The exact error message is: 500 {"type":"error","error":{"type":"api_error","message":"Internal server error"}}. According to the GitHub issue discussion, the most common cause is a timeout when the Anthropic API attempts to connect to your MCP server via Server-Sent Events (SSE) and the server does not respond with any HTTP response, causing the connection to hang and eventually time out, which the API incorrectly surfaces as a 500 error.
What Causes This Error
The following causes are identified in the sources, ordered from most common to least:
-
MCP server not responding to SSE connection attempts: The Anthropic API tries to establish an SSE connection to the MCP server URL you provide. If the server does not reply with any HTTP response (not even an error status), the connection attempt times out. The API then returns a 500
api_errorinstead of a more descriptive error. This was confirmed by Anthropic engineer felixfbecker in the GitHub issue, who traced a specific request ID and found the root cause was a timeout connecting to the given server URL. -
API-side bug in error handling: The same engineer acknowledged that returning a 500 in this timeout scenario is a bug on Anthropic's end. The API should handle the timeout gracefully and return a more informative error. This means even if your MCP server configuration is correct, you may encounter this error due to the API's current behavior.
-
MCP server using SSE transport instead of streamable HTTP: The API now attempts streamable HTTP transport first before falling back to SSE. If your MCP server only supports SSE and does not handle the initial connection handshake properly, the timeout can occur. The fix being deployed on the API side aims to improve this fallback behavior.
How to Fix It

Solution 1: Ensure your MCP server responds to SSE connection attempts (Recommended)
This is the primary fix identified in the GitHub issue. Your MCP server must be configured to respond to incoming SSE connection requests with an HTTP response, even if it's a simple acknowledgment or a redirect to streamable HTTP. If the server hangs or takes too long to respond, the API will time out and return the 500 error.
Steps:
-
Verify that your MCP server is running and accessible from the internet. The server URL in the issue example is
https://spongebob-6.tail7943f.ts.net/mcp, which uses a Tailscale Funnel URL. Ensure your server is reachable from Anthropic's servers (not just from your local network). -
Check your server logs for incoming connection attempts from Anthropic's IP ranges. Look for any signs of the server failing to respond or taking longer than a few seconds to reply.
-
If your MCP server is a custom implementation, ensure it sends an HTTP response (e.g., 200 OK with appropriate headers) as soon as an SSE connection is established. Do not wait for data to be available before sending the initial response.
-
Consider implementing streamable HTTP transport on your MCP server. According to the GitHub comment, the API now tries streamable HTTP first, so if your server supports it, the connection should succeed without falling back to SSE. Streamable HTTP is a more modern transport that avoids the long-lived connection requirements of SSE.
Expected outcome: After ensuring your server responds promptly to connection attempts, the 500 error should no longer occur. If it does, proceed to Solution 2.
Solution 2: Wait for the API-side fix to be deployed
The Anthropic engineer stated: "We obviously shouldn't 500 in this case, that's a bug on our end. I will give an update here once a fix is deployed." This means the API itself will be updated to handle timeouts more gracefully. If your MCP server is correctly configured but you still see the error, it may be that the fix has not yet reached your region or API endpoint.
Steps:
-
Monitor the GitHub issue at https://github.com/anthropics/anthropic-sdk-typescript/issues/784 for updates on the fix deployment.
-
Retry your requests periodically. The fix may be rolled out gradually across Anthropic's infrastructure.
-
If you have a support plan, contact Anthropic support and reference the GitHub issue and your request ID (found in the error headers as
request-id, e.g.,req_011CQ6ZeTeEGxMxnk9MF8n4H). The engineer offered to investigate specific request IDs, so providing yours can help them diagnose if your issue is different.
Expected outcome: Once the fix is deployed, the API should return a more descriptive error (e.g., a timeout error) instead of the 500, allowing you to identify and fix the root cause more easily.
Solution 3: Switch to streamable HTTP transport on your MCP server
As mentioned in the GitHub comment, the API now attempts streamable HTTP transport first before falling back to SSE. If your MCP server supports streamable HTTP, the connection should succeed without hitting the SSE timeout issue.
Steps:
-
Check if your MCP server framework supports streamable HTTP. If you are using a library like
@modelcontextprotocol/sdk, ensure you are using the latest version that includes streamable HTTP support. -
Configure your server to use streamable HTTP transport. This typically involves setting a flag or using a different server class. Refer to your MCP server's documentation for specific instructions.
-
Update your client code to use the
mcp-client-2025-04-04beta flag, as shown in the issue's example request:
{
"model": "claude-sonnet-4-20250514",
"max_tokens": 1000,
"messages": [
{
"role": "user",
"content": "What tools do you have available?"
}
],
"stream": true,
"mcp_servers": [
{
"type": "url",
"url": "https://your-server.com/mcp",
"name": "my-mcp-server",
"authorization_token": "your-token"
}
],
"betas": [
"mcp-client-2025-04-04"
]
}
Expected outcome: With streamable HTTP, the connection should be established quickly, avoiding the SSE timeout that causes the 500 error.
If Nothing Works
If none of the above solutions resolve the error, consider the following escalation paths:
-
Provide your request ID to the Anthropic engineer: In the GitHub issue, felixfbecker offered to investigate specific request IDs. The request ID is available in the error response headers (e.g.,
"request-id": "req_011CQ6ZeTeEGxMxnk9MF8n4H"). Post a comment on the issue with your request ID and a description of your MCP server setup. -
Open a new GitHub issue: If the existing issue is closed or your problem differs, open a new issue in the
anthropic-sdk-typescriptrepository with the full error stack trace, your request payload (with sensitive tokens redacted), and the request ID. -
Contact Anthropic support: If you have a paid plan, reach out to Anthropic support directly. Reference the GitHub issue and provide the request ID for faster diagnosis.
-
Temporary workaround: If the error is blocking your application, consider removing the MCP server configuration temporarily and using direct tool definitions instead. This avoids the MCP Connector entirely until the API-side fix is deployed.
How to Prevent It
Based on the sources, the following practices can help prevent this error:
-
Use streamable HTTP transport on your MCP server: The API prefers this transport, and it avoids the timeout issues associated with SSE connections. Implement streamable HTTP if your server framework supports it.
-
Ensure your MCP server responds quickly to connection attempts: Even if using SSE, configure your server to send an immediate HTTP response upon connection, rather than waiting for data.
-
Keep your Anthropic SDK and MCP server libraries up to date: The API-side fix and any client-side improvements will be released in new versions. Update your dependencies regularly.
-
Monitor the GitHub issue for updates: The issue at https://github.com/anthropics/anthropic-sdk-typescript/issues/784 contains the latest information on the bug and its resolution. Subscribe to it for notifications.
-
Test your MCP server independently: Before integrating with the Anthropic API, test your MCP server with a standalone SSE client to ensure it responds correctly to connection attempts and doesn't hang.
The #1 Claude Newsletter
The most important claude updates, guides, and fixes — one weekly email.
No spam, unsubscribe anytime. Privacy policy
Related Error Solutions
Keep exploring Claude
Claude resources
Latest AI answers
Skip the manual work
Ready-made AI workflows and automation templates — import and run instead of building from scratch.