diff --git a/src/strands/mcp/__init__.py b/src/strands/mcp/__init__.py new file mode 100644 index 000000000..77daed8a5 --- /dev/null +++ b/src/strands/mcp/__init__.py @@ -0,0 +1,17 @@ +"""Canonical import path for the Model Context Protocol (MCP) integration. + +Model Context Protocol functionality is being promoted from +``strands.tools.mcp`` to this top-level ``strands.mcp`` package because MCP +now spans tools, prompts, resources, tasks, and elicitation -- concepts +that extend beyond ``tools``. + +For now this package is a thin re-export of ``strands.tools.mcp``. A +follow-up change will invert the relationship: the implementation will +live here and ``strands.tools.mcp`` will become a deprecated alias. +Users can safely migrate imports to ``strands.mcp`` today; the public +API is identical and object identity is preserved. +""" + +from ..tools.mcp import MCPAgentTool, MCPClient, MCPTransport, TasksConfig, ToolFilters + +__all__ = ["MCPAgentTool", "MCPClient", "MCPTransport", "TasksConfig", "ToolFilters"] diff --git a/tests/strands/mcp/__init__.py b/tests/strands/mcp/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/strands/mcp/test_canonical_import_path.py b/tests/strands/mcp/test_canonical_import_path.py new file mode 100644 index 000000000..0194d3bee --- /dev/null +++ b/tests/strands/mcp/test_canonical_import_path.py @@ -0,0 +1,25 @@ +"""Tests for the canonical ``strands.mcp`` import path. + +The implementation currently lives in ``strands.tools.mcp``. This test +locks in the contract that ``strands.mcp`` re-exports the same objects so +that users can migrate imports ahead of the follow-up refactor that +moves the implementation. +""" + + +def test_strands_mcp_reexports_public_api() -> None: + import strands.mcp as new + import strands.tools.mcp as old + + assert new.MCPClient is old.MCPClient + assert new.MCPAgentTool is old.MCPAgentTool + assert new.MCPTransport is old.MCPTransport + assert new.TasksConfig is old.TasksConfig + assert new.ToolFilters is old.ToolFilters + + +def test_strands_mcp_all_matches_tools_mcp_all() -> None: + import strands.mcp as new + import strands.tools.mcp as old + + assert sorted(new.__all__) == sorted(old.__all__)