** Please make sure you read the contribution guide and file the issues in the right place. **
Contribution guide.
Describe the bug
Try to connect to localhost sse mcp server but got 502
To Reproduce
- Run mcp server in local, other clients can connect to it.
import datetime
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("real-fastmcp-server", port=9999)
@mcp.tool()
def echo(text: str) -> str:
"""
Echo back input text with timestamp
Args:
text: input text
Returns:
str: input text with timestamp
"""
timestamp = datetime.datetime.now().isoformat()
return f"[{timestamp}] Echo: {text}"
if __name__ == "__main__":
mcp.run(transport='sse')
- Try to connect to it
import asyncio
from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset, SseConnectionParams
async def main():
connection_params = SseConnectionParams(url="http://localhost:9999/sse")
toolset = MCPToolset(connection_params=connection_params)
tools = await toolset.get_tools()
if __name__ == "__main__":
asyncio.run(main())
- Error occurs
| httpx.HTTPStatusError: Server error '502 Bad Gateway' for url 'http://localhost:9999/sse'
Expected behavior
Should be able to connect to mcp server
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: Windows 10
- Python version(python -V): 3.11
- ADK version(pip show google-adk): 1.12.0
Model Information:
For example, which model is being used.
Additional context
Add any other context about the problem here.
** Please make sure you read the contribution guide and file the issues in the right place. **
Contribution guide.
Describe the bug
Try to connect to localhost sse mcp server but got 502
To Reproduce
Expected behavior
Should be able to connect to mcp server
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Model Information:
For example, which model is being used.
Additional context
Add any other context about the problem here.