Skip to content

[BUG]When I use mcps but tools is None, it will not load mcp tools #4568

@kid0317

Description

@kid0317

Description

when I use mcp like this

sandbox_agent = Agent(
role="…",
goal="…",
backstory="…",
mcps=[
        MCPServerHTTP(
            url="http://localhost:8022/mcp",  
        )
    ],
)

mcp will not load. I check the source code at crewai/agent/core.py ,

if mcps and self.tools is not None:
        self.tools.extend(mcps)

Steps to Reproduce

use mcps but tools is None

Expected behavior

can just use mcps

Screenshots/Code snippets

above

Operating System

macOS Ventura

Python Version

3.10

crewAI Version

1.7.2

crewAI Tools Version

1.7.2

Virtual Environment

Venv

Evidence

if mcps and self.tools is not None:
self.tools.extend(mcps)

Possible Solution

when tools is None, let it []

Additional context

no more

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions