Skip to content

Commit 53f3792

Browse files
authored
Add note about VS Code and FastMCP streamable HTTP (#33)
1 parent 6c6f477 commit 53f3792

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/toolhive/guides-cli/client-configuration.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,29 @@ connectivity.
241241

242242
Refer to your containerization platform's documentation for details on how to
243243
configure network access between containers and the host.
244+
245+
### VS Code can't connect to some streamable-http servers
246+
247+
You might encounter errors with Visual Studio Code connecting to some
248+
Python-based MCP servers using the Streamable HTTP transport protocol:
249+
250+
```text
251+
[info] Connection state: Error Error sending message to http://localhost:49574/mcp: TypeError: fetch failed
252+
[error] Server exited before responding to `initialize` request.
253+
```
254+
255+
This is a known interaction between VS Code and the FastMCP SDK used by
256+
Python-based MCP servers. If you inspect the HTTP connection, you'll see a
257+
`307 Temporary Redirect` response, which VS Code doesn't handle correctly.
258+
259+
There are two workarounds:
260+
261+
1. Change the URL in your VS Code settings to add a trailing slash to the MCP
262+
server URL. For example, change `http://localhost:49574/mcp` to
263+
`http://localhost:49574/mcp/`. You'll need to re-apply this if you stop and
264+
restart the MCP server.
265+
2. If the MCP server supports SSE, switch to using the SSE transport instead of
266+
Streamable HTTP.
267+
268+
You can track a proposed fix for this issue in the
269+
[MCP Python SDK repository](https://github.com/modelcontextprotocol/python-sdk/pull/781).

0 commit comments

Comments
 (0)