Skip to content

how to connect streamble http server by domain? #1077

Open
@EmilyLike

Description

@EmilyLike

i have a serious question on streamble http.
i have establish a server includes 10 ips.
i can connect ip through detail ip.
but i cann't connect through the domain name like http://example.server.com/mcp.
the error is :
://ad-mcp.jd.com/mcp/ "HTTP/1.1 200 OK" INFO:mcp.client.streamable_http:Received session ID: 1f12d09dbfb947158071e34626caae4f DEBUG:httpcore.http11:receive_response_body.started request=<Request [b'POST']> DEBUG:mcp.client.streamable_http:SSE message: root=JSONRPCResponse(jsonrpc='2.0', id=0, result={'protocolVersion': '2025-03-26', 'capabilities': {'experimental': {}, 'prompts': {'listChanged': False}, 'resources': {'subscribe': False, 'listChanged': False}, 'tools': {'listChanged': False}}, 'serverInfo': {'name': 'My API', 'version': '1.9.1'}}) DEBUG:httpcore.http11:response_closed.started DEBUG:httpcore.http11:response_closed.complete 正在连接服务器... DEBUG:mcp.client.streamable_http:Sending client message: root=JSONRPCNotification(method='notifications/initialized', params=None, jsonrpc='2.0') DEBUG:httpcore.connection:connect_tcp.started host='ad-mcp.jd.com' port=80 local_address=None timeout=30 socket_options=None DEBUG:httpcore.connection:connect_tcp.started host='ad-mcp.jd.com' port=80 local_address=None timeout=30 socket_options=None DEBUG:httpcore.http11:receive_response_body.failed exception=GeneratorExit() DEBUG:httpcore.connection:connect_tcp.complete return_value=<httpcore._backends.anyio.AnyIOStream object at 0x1032e47f0> DEBUG:httpcore.http11:send_request_headers.started request=<Request [b'POST']> DEBUG:httpcore.http11:send_request_headers.complete DEBUG:httpcore.http11:send_request_body.started request=<Request [b'POST']> DEBUG:httpcore.http11:send_request_body.complete DEBUG:httpcore.http11:receive_response_headers.started request=<Request [b'POST']> DEBUG:httpcore.connection:connect_tcp.complete return_value=<httpcore._backends.anyio.AnyIOStream object at 0x1032e52a0> DEBUG:httpcore.http11:send_request_headers.started request=<Request [b'GET']> DEBUG:httpcore.http11:send_request_headers.complete DEBUG:httpcore.http11:send_request_body.started request=<Request [b'GET']> DEBUG:httpcore.http11:send_request_body.complete DEBUG:httpcore.http11:receive_response_headers.started request=<Request [b'GET']> DEBUG:httpcore.http11:receive_response_headers.complete return_value=(b'HTTP/1.1', 307, b'Temporary Redirect', [(b'date', b'Thu, 03 Jul 2025 08:59:38 GMT'), (b'server', b'uvicorn'), (b'content-length', b'0'), (b'location', b'http://ad-mcp.jd.com/mcp/'), (b'connection', b'close')]) INFO:httpx:HTTP Request: POST http://ad-mcp.jd.com/mcp "HTTP/1.1 307 Temporary Redirect" DEBUG:httpcore.http11:receive_response_body.started request=<Request [b'POST']> DEBUG:httpcore.http11:receive_response_body.complete DEBUG:httpcore.http11:response_closed.started DEBUG:httpcore.http11:response_closed.complete DEBUG:httpcore.connection:connect_tcp.started host='ad-mcp.jd.com' port=80 local_address=None timeout=30 socket_options=None DEBUG:httpcore.http11:receive_response_headers.complete return_value=(b'HTTP/1.1', 307, b'Temporary Redirect', [(b'date', b'Thu, 03 Jul 2025 08:59:38 GMT'), (b'server', b'uvicorn'), (b'content-length', b'0'), (b'location', b'http://ad-mcp.jd.com/mcp/'), (b'connection', b'close')]) INFO:httpx:HTTP Request: GET http://ad-mcp.jd.com/mcp "HTTP/1.1 307 Temporary Redirect" DEBUG:httpcore.http11:receive_response_body.started request=<Request [b'GET']> DEBUG:httpcore.http11:receive_response_body.complete DEBUG:httpcore.http11:response_closed.started DEBUG:httpcore.http11:response_closed.complete DEBUG:httpcore.connection:connect_tcp.started host='ad-mcp.jd.com' port=80 local_address=None timeout=30 socket_options=None DEBUG:httpcore.connection:connect_tcp.complete return_value=<httpcore._backends.anyio.AnyIOStream object at 0x1032e5420> DEBUG:httpcore.http11:send_request_headers.started request=<Request [b'POST']> DEBUG:httpcore.http11:send_request_headers.complete DEBUG:httpcore.http11:send_request_body.started request=<Request [b'POST']> DEBUG:httpcore.http11:send_request_body.complete DEBUG:httpcore.http11:receive_response_headers.started request=<Request [b'POST']> DEBUG:httpcore.http11:receive_response_headers.complete return_value=(b'HTTP/1.1', 400, b'Bad Request', [(b'date', b'Thu, 03 Jul 2025 08:59:38 GMT'), (b'server', b'uvicorn'), (b'content-length', b'41'), (b'connection', b'close')]) INFO:httpx:HTTP Request: POST http://ad-mcp.jd.com/mcp/ "HTTP/1.1 400 Bad Request" DEBUG:httpcore.http11:response_closed.started DEBUG:httpcore.http11:response_closed.complete ERROR:mcp.client.streamable_http:Error in post_writer: Client error '400 Bad Request' for url 'http://ad-mcp.jd.com/mcp/' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 DEBUG:httpcore.connection:connect_tcp.complete return_value=<httpcore._backends.anyio.AnyIOStream object at 0x103287eb0> DEBUG:httpcore.connection:connect_tcp.started host='ad-mcp.jd.com' port=80 local_address=None timeout=30 socket_options=None DEBUG:httpcore.http11:send_request_headers.started request=<Request [b'GET']> DEBUG:httpcore.http11:send_request_headers.complete DEBUG:httpcore.http11:send_request_body.started request=<Request [b'GET']> DEBUG:httpcore.http11:send_request_body.complete DEBUG:httpcore.http11:receive_response_headers.started request=<Request [b'GET']> DEBUG:httpcore.http11:receive_response_headers.complete return_value=(b'HTTP/1.1', 400, b'Bad Request', [(b'date', b'Thu, 03 Jul 2025 08:59:38 GMT'), (b'server', b'uvicorn'), (b'content-length', b'41'), (b'connection', b'close')]) INFO:httpx:HTTP Request: GET http://ad-mcp.jd.com/mcp/ "HTTP/1.1 400 Bad Request" DEBUG:httpcore.http11:response_closed.started DEBUG:httpcore.http11:response_closed.complete DEBUG:mcp.client.streamable_http:GET stream error (non-fatal): Client error '400 Bad Request' for url 'http://ad-mcp.jd.com/mcp/' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 DEBUG:httpcore.connection:connect_tcp.complete return_value=<httpcore._backends.anyio.AnyIOStream object at 0x103284b20> DEBUG:httpcore.http11:send_request_headers.started request=<Request [b'DELETE']> DEBUG:httpcore.http11:send_request_headers.complete DEBUG:httpcore.http11:send_request_body.started request=<Request [b'DELETE']> DEBUG:httpcore.http11:send_request_body.complete DEBUG:httpcore.http11:receive_response_headers.started request=<Request [b'DELETE']> DEBUG:httpcore.http11:receive_response_headers.complete return_value=(b'HTTP/1.1', 307, b'Temporary Redirect', [(b'date', b'Thu, 03 Jul 2025 08:59:38 GMT'), (b'server', b'uvicorn'), (b'content-length', b'0'), (b'location', b'http://ad-mcp.jd.com/mcp/'), (b'connection', b'close')]) INFO:httpx:HTTP Request: DELETE http://ad-mcp.jd.com/mcp "HTTP/1.1 307 Temporary Redirect" DEBUG:httpcore.http11:receive_response_body.started request=<Request [b'DELETE']> DEBUG:httpcore.http11:receive_response_body.complete DEBUG:httpcore.http11:response_closed.started DEBUG:httpcore.http11:response_closed.complete DEBUG:httpcore.connection:connect_tcp.started host='ad-mcp.jd.com' port=80 local_address=None timeout=30 socket_options=None DEBUG:httpcore.connection:connect_tcp.complete return_value=<httpcore._backends.anyio.AnyIOStream object at 0x103504460> DEBUG:httpcore.http11:send_request_headers.started request=<Request [b'DELETE']> DEBUG:httpcore.http11:send_request_headers.complete DEBUG:httpcore.http11:send_request_body.started request=<Request [b'DELETE']> DEBUG:httpcore.http11:send_request_body.complete DEBUG:httpcore.http11:receive_response_headers.started request=<Request [b'DELETE']> DEBUG:httpcore.http11:receive_response_headers.complete return_value=(b'HTTP/1.1', 400, b'Bad Request', [(b'date', b'Thu, 03 Jul 2025 08:59:38 GMT'), (b'server', b'uvicorn'), (b'content-length', b'41'), (b'connection', b'close')]) INFO:httpx:HTTP Request: DELETE http://ad-mcp.jd.com/mcp/ "HTTP/1.1 400 Bad Request" DEBUG:httpcore.http11:receive_response_body.started request=<Request [b'DELETE']> DEBUG:httpcore.http11:receive_response_body.complete DEBUG:httpcore.http11:response_closed.started DEBUG:httpcore.http11:response_closed.complete WARNING:mcp.client.streamable_http:Session termination failed: 400 发生错误: Traceback (most recent call last): File "/Users/liuyaxin7/code/ad-mcp-server/fastmcpClient.py", line 24, in main await client.ping() File "/Users/liuyaxin7/code/ad-mcp-server/.venv/lib/python3.10/site-packages/fastmcp/client/client.py", line 210, in ping result = await self.session.send_ping() File "/Users/liuyaxin7/code/ad-mcp-server/.venv/lib/python3.10/site-packages/mcp/client/session.py", line 161, in send_ping return await self.send_request( File "/Users/liuyaxin7/code/ad-mcp-server/.venv/lib/python3.10/site-packages/mcp/shared/session.py", line 265, in send_request await self._write_stream.send( File "/Users/liuyaxin7/code/ad-mcp-server/.venv/lib/python3.10/site-packages/anyio/streams/memory.py", line 255, in send raise BrokenResourceError from None anyio.BrokenResourceError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions