Skip to content

Commit 210be04

Browse files
authored
docs: When using streamable_http, the mcp-url must end with a slash. On cloud servers we get the following error (#206)
## 📝 Summary of Commit Fix README: Add trailing slashes to `streamable_http` URLs to prevent 307 redirects. When using the `streamable_http` adapter, the `mcp-url` must end with a trailing slash (`/`). Without it, requests to cloud-based deployments can return a `307 Temporary Redirect` error. This PR updates the `README.md` to reflect the correct usage by adding trailing slashes to the `mcp-url` values in all `streamable_http` examples. ## ❗ Before ```bash --mcp-url http://localhost:8000/mcp ``` ## ✅ After ```bash --mcp-url http://localhost:8000/mcp/ ``` ## 📚 Why this matters In production environments (e.g., behind load balancers or cloud services), the missing slash causes an unnecessary redirect which can break `POST` requests. Adding the slash avoids this issue. ## ✅ Tested Verified in a cloud environment where the redirect caused failed requests when the trailing slash was missing. (eg: `Digitalocean`) I created two app-platform : `langchain-mcp-client` and `fastmcp-mcp-server` --- Let me know if you'd like me to update other docs or examples as well.
1 parent 0a16a7b commit 210be04

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ client = MultiServerMCPClient(
123123
},
124124
"weather": {
125125
# make sure you start your weather server on port 8000
126-
"url": "http://localhost:8000/mcp",
126+
"url": "http://localhost:8000/mcp/",
127127
"transport": "streamable_http",
128128
}
129129
}
@@ -169,7 +169,7 @@ from mcp.client.streamable_http import streamablehttp_client
169169
from langgraph.prebuilt import create_react_agent
170170
from langchain_mcp_adapters.tools import load_mcp_tools
171171
172-
async with streamablehttp_client("http://localhost:3000/mcp") as (read, write, _):
172+
async with streamablehttp_client("http://localhost:3000/mcp/") as (read, write, _):
173173
async with ClientSession(read, write) as session:
174174
# Initialize the connection
175175
await session.initialize()
@@ -191,7 +191,7 @@ client = MultiServerMCPClient(
191191
{
192192
"math": {
193193
"transport": "streamable_http",
194-
"url": "http://localhost:3000/mcp"
194+
"url": "http://localhost:3000/mcp/"
195195
},
196196
}
197197
)
@@ -220,7 +220,7 @@ client = MultiServerMCPClient(
220220
},
221221
"weather": {
222222
# make sure you start your weather server on port 8000
223-
"url": "http://localhost:8000/mcp",
223+
"url": "http://localhost:8000/mcp/",
224224
"transport": "streamable_http",
225225
}
226226
}
@@ -269,7 +269,7 @@ async def make_graph():
269269
},
270270
"weather": {
271271
# make sure you start your weather server on port 8000
272-
"url": "http://localhost:8000/mcp",
272+
"url": "http://localhost:8000/mcp/",
273273
"transport": "streamable_http",
274274
}
275275
}

0 commit comments

Comments
 (0)