Skip to content

502 while using localhost sse #2707

Closed
Closed

Description

@DoctorReid

** 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

  1. 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')
  1. 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())
  1. 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.

Activity

  1. added
    mcp[Component] This issues is related to MCP support
    on Aug 24, 2025
  2. added theissue type on Aug 24, 2025
  3. added
    tools[Component] This issue is related to tools
    on Nov 4, 2025
  4. hangfei commented on Nov 4, 2025

    @hangfei
    Collaborator

    Please provide complete error trace to see which classes throws the error.

  5. hangfei commented on Nov 11, 2025

    @hangfei
    Collaborator

    This should be fixed or it's not related to ADK. Moving to discussion to get some help from adk-bot.

  6. locked and limited conversation to collaborators on Nov 11, 2025
  7. converted this issue into a discussion #3483 on Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

mcp[Component] This issues is related to MCP supporttools[Component] This issue is related to tools

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions