-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
Feature Area
Integration with external tools
Is your feature request related to a an existing bug? Please link it here.
Feature Request: HTTP Support for Local MCP Servers
Summary
Add support for http:// URLs in MCP server references to enable local MCP server connections. Currently, CrewAI only supports https:// URLs for external MCP servers, which prevents developers from using local MCP servers running on http://localhost or other local HTTP endpoints.
Use Case
When developing with CrewAI and MCP (Model Context Protocol), developers often run local MCP servers for:
- Local development and testing
- Internal tooling and services
- Development environments without SSL certificates
- Localhost-based MCP servers (e.g.,
http://localhost:7365/mcp)
Currently, these local servers cannot be used with CrewAI agents because the library only accepts https:// URLs.
Current Behavior
-
Validation: The
validate_mcps()method inbase_agent.pyhas inconsistent behavior:- It accepts
http://URLs in the validation check - But the error message incorrectly states only
https://is supported - This creates confusion and inconsistent behavior
- It accepts
-
Tool Retrieval: The
_get_mcp_tools_from_string()method inagent/core.pyonly handleshttps://URLs:if mcp_ref.startswith("https://"): return self._get_external_mcp_tools(mcp_ref)
http://URLs are silently ignored, returning an empty tool list- No error is raised, making debugging difficult
Expected Behavior
- Accept
http://URLs in MCP server references alongsidehttps:// - Successfully retrieve tools from local MCP servers using
http://URLs - Provide clear error messages that accurately reflect supported URL schemes
- Support both
http://andhttps://for external MCP server connections
Describe the solution you'd like
Proposed Solution
-
Update Validator (
base_agent.py):- Accept
http://,https://, andcrewai-amp:in validation - Update error message to reflect all supported schemes
- Accept
-
Update Tool Retrieval (
agent/core.py):- Modify
_get_mcp_tools_from_string()to handle bothhttp://andhttps:// - Ensure
_get_external_mcp_tools()works with both protocols
- Modify
-
Documentation:
- Update docstrings to mention HTTP support
- Add examples showing local MCP server usage
Example Usage
agent = Agent(
role="Data Collector",
goal="Collect data using MCP tools",
backstory="...",
mcps=["http://localhost:7365/mcp#diff_general_info"] # Currently fails
)Impact
- High: This is a blocker for local development workflows
- Low Risk: HTTP support is a straightforward addition that doesn't break existing functionality
- Developer Experience: Significantly improves the development experience for MCP integration
Technical Details
The changes required are minimal:
- Update URL scheme checks from
startswith("https://")tostartswith(("http://", "https://")) - Ensure the underlying MCP client library supports HTTP (most do)
- Update validation logic and error messages
Related Issues
- Local MCP servers are a common development pattern
- Many MCP server implementations default to HTTP for local development
- SSL certificates are not always available in development environments
Describe alternatives you've considered
No response
Additional context
No response
Willingness to Contribute
Yes, I'd be happy to submit a pull request