Skip to content

Conversation

@pedro-inf-custodio
Copy link

Description

This PR follows up on #343, which was previously closed. After its closure, additional analysis and evidence were shared showing that the issue still persists (discussion in #343 ).

As some time has passed, I’m opening this new PR to continue the discussion in a clean state and propose a concrete fix based on that analysis.

Summary

  • The issue is still reproducible under certain conditions.
  • This PR addresses the remaining problem and includes supporting changes where needed.

Reproduction

from langchain_mcp_adapters.client import MultiServerMCPClient
from langchain.agents import create_agent
from langchain_openai import AzureChatOpenAI

mcp_config = {
    "awslabs.ecs-mcp-server": {
        "command": "uvx",
        "args": ["--from", "awslabs-ecs-mcp-server", "ecs-mcp-server"],
        "env": {
            "FASTMCP_LOG_LEVEL": "ERROR",
            "ALLOW_WRITE": "false",
            "ALLOW_SENSITIVE_DATA": "false",
        },
        "transport": "stdio",
    }
}
mcp_client = MultiServerMCPClient(connections=mcp_config)
mcp_tools = await mcp_client.get_tools()


agent = create_agent(
    model=AzureChatOpenAI(
        azure_deployment="gpt-4.1",
        azure_endpoint=...,
        api_key=...,
        api_version="2024-12-01-preview",
    ),
    tools=mcp_tools,
)


agent.invoke(
    {
        "messages": [
            {
                "role": "user",
                "content": "What are the all the AWS regions where ECS is available?",
            }
        ]
    }
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant